import { WorkspaceRenderer } from "../renderer" ; const $ = require ( "jquery" ) ; export type WorkspaceTabConstructor = new ( path , button_node , content_node , renderer ) => WorkspaceTab ; export abstract class WorkspaceTab { private readonly _path : Array < string > ; private readonly _buttonNode : any ; private readonly _contentNode : any ; private readonly _renderer : WorkspaceRenderer ; public constructor ( path , buttonNode , contentNode , renderer ) { this . _path = path ; this . _buttonNode = buttonNode ; this . _contentNode = contentNode ; this . _renderer = renderer ; } public get path ( ) : Array < string > { return this . _path ; } public get buttonNode ( ) : any { return this . _buttonNode ; } public get contentNode ( ) : any { return this . _contentNode ; } public get renderer ( ) : WorkspaceRenderer { return this . _renderer ; } public get canBeClosed ( ) { return true ; } public getIcon ( ) { return null ; } public changeTitle ( title ) { $ ( this . buttonNode ) . find ( 'a span' ) . html ( title ) ; } public async focusIn ( ) { } protected scrollBefore ( ) { return $ ( this . contentNode ) . parent ( ) . scrollTop ( ) ; } protected scrollAfter ( before ) { $ ( this . contentNode ) . parent ( ) . scrollTop ( before ) ; } public async refresh ( ) { $ ( ".tooltip" ) . tooltip ( "dispose" ) ; const scroll = this . scrollBefore ( ) ; $ ( this . contentNode ) . html ( '' ) ; await this . release ( ) ; await this . init ( ) ; this . render ( ) ; this . scrollAfter ( scroll ) ; } public abstract async init ( ) ; public abstract async release ( ) ; public get fullTitle ( ) : string { return this . shortTitle ; } public abstract get shortTitle ( ) : string ; public abstract render ( ) ; }