view.ts 1.07 KB
Newer Older
1 2 3 4
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5
export abstract class View {
6 7 8
  protected container: HTMLElement;
  protected divNode: HTMLElement;
  protected abstract createViewElement(): HTMLElement;
9

10 11
  constructor(idOrContainer: string | HTMLElement) {
    this.container = typeof idOrContainer == "string" ? document.getElementById(idOrContainer) : idOrContainer;
12
    this.divNode = this.createViewElement();
13 14
  }

15
  public show(): void {
16
    this.container.appendChild(this.divNode);
17 18
  }

19
  public hide(): void {
20
    this.container.removeChild(this.divNode);
21 22
  }
}
23

24 25 26 27 28 29 30 31 32
export abstract class PhaseView extends View {
  public abstract initializeContent(data: any, rememberedSelection: Set<any>): void;
  public abstract detachSelection(): Set<string>;
  public abstract onresize(): void;
  public abstract searchInputAction(searchInput: HTMLInputElement, e: Event, onlyVisible: boolean): void;

  constructor(idOrContainer: string | HTMLElement) {
    super(idOrContainer);
  }
33
}