1 // Copyright 2015 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 export abstract class View { 6 container: HTMLElement; 7 divNode: HTMLElement; 8 abstract initializeContent(data: any, rememberedSelection: Selection): void; 9 abstract createViewElement(): HTMLElement; 10 abstract deleteContent(): void; 11 abstract detachSelection(): Set<string>; 12 13 constructor(id) { 14 this.container = document.getElementById(id); 15 this.divNode = this.createViewElement(); 16 } 17 18 isScrollable(): boolean { 19 return false; 20 } 21 22 show(data, rememberedSelection): void { 23 this.container.appendChild(this.divNode); 24 this.initializeContent(data, rememberedSelection); 25 } 26 27 hide(): void { 28 this.deleteContent(); 29 this.container.removeChild(this.divNode); 30 } 31 } 32 33 export interface PhaseView { 34 onresize(); 35 searchInputAction(searchInput: HTMLInputElement, e: Event); 36 } 37