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"use strict"; 6 7class View { 8 constructor(id, broker) { 9 this.divElement = d3.select("#" + id); 10 this.divNode = this.divElement[0][0]; 11 this.parentNode = this.divNode.parentNode; 12 } 13 14 isScrollable() { 15 return false; 16 } 17 18 show(data, rememberedSelection) { 19 this.parentNode.appendChild(this.divElement[0][0]); 20 this.initializeContent(data, rememberedSelection); 21 this.resizeToParent(); 22 this.divElement.attr(VISIBILITY, 'visible'); 23 } 24 25 resizeToParent() { 26 var view = this; 27 var documentElement = document.documentElement; 28 var y; 29 if (this.parentNode.clientHeight) 30 y = Math.max(this.parentNode.clientHeight, documentElement.clientHeight); 31 else 32 y = documentElement.clientHeight; 33 this.parentNode.style.height = y + 'px'; 34 } 35 36 hide() { 37 this.divElement.attr(VISIBILITY, 'hidden'); 38 this.deleteContent(); 39 this.parentNode.removeChild(this.divNode); 40 } 41 42 detachSelection() { 43 return null; 44 } 45} 46