import * as React from "react"; import * as classes from '../../styles/RcsbFvStyle.module.scss'; import {RcsbFvDOMConstants} from "../../RcsbFvConstants/RcsbFvConstants"; import { SaguaroPluginInterface, SaguaroPluginModelMapType } from "../../RcsbFvStructure/StructurePlugins/SaguaroPluginInterface"; import { RcsbFvSelection} from "../../RcsbFvSelection/RcsbFvSelection"; export interface AbstractViewInterface { componentId: string; title?: string; subtitle?: string; plugin: SaguaroPluginInterface; selection: RcsbFvSelection; } export abstract class AbstractView extends React.Component

{ protected componentDivId: string; protected pfvDivId: string; constructor(props:P & AbstractViewInterface) { super(props); this.componentDivId = props.componentId+"_"+RcsbFvDOMConstants.PFV_DIV; this.pfvDivId = props.componentId+"_"+RcsbFvDOMConstants.PFV_APP_ID; } render():JSX.Element { return (

{this.createTitle()} {this.createSubtitle()} {this.additionalContent()}
); } componentDidMount() { this.props.plugin.setSelectCallback(this.structureSelectionCallback.bind(this)); this.props.plugin.setModelChangeCallback(this.modelChangeCallback.bind(this)); window.addEventListener('resize', this.updatePfvDimensions.bind(this)); } private createTitle(): JSX.Element | null{ if(this.props.title) return (
{this.props.title}
) return null; } private createSubtitle(): JSX.Element | null{ if(this.props.subtitle) return (
{this.props.subtitle}
) return null; } protected structureSelectionCallback(): void{} protected modelChangeCallback(modelMap:SaguaroPluginModelMapType): void{} protected updatePfvDimensions(): void{} protected additionalContent(): JSX.Element | null { return null; } }