| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 /** | 4 /** |
| 5 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 WebInspector.ReportView = class extends WebInspector.VBox { | 7 UI.ReportView = class extends UI.VBox { |
| 8 /** | 8 /** |
| 9 * @param {string} title | 9 * @param {string} title |
| 10 */ | 10 */ |
| 11 constructor(title) { | 11 constructor(title) { |
| 12 super(true); | 12 super(true); |
| 13 this.registerRequiredCSS('ui/reportView.css'); | 13 this.registerRequiredCSS('ui/reportView.css'); |
| 14 | 14 |
| 15 var contentBox = this.contentElement.createChild('div', 'report-content-box'
); | 15 var contentBox = this.contentElement.createChild('div', 'report-content-box'
); |
| 16 this._headerElement = contentBox.createChild('div', 'report-header vbox'); | 16 this._headerElement = contentBox.createChild('div', 'report-header vbox'); |
| 17 this._headerElement.createChild('div', 'report-title').textContent = title; | 17 this._headerElement.createChild('div', 'report-title').textContent = title; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 35 */ | 35 */ |
| 36 setURL(url) { | 36 setURL(url) { |
| 37 if (this._url === url) | 37 if (this._url === url) |
| 38 return; | 38 return; |
| 39 if (!this._urlElement) | 39 if (!this._urlElement) |
| 40 this._urlElement = this._headerElement.createChild('div', 'report-url link
'); | 40 this._urlElement = this._headerElement.createChild('div', 'report-url link
'); |
| 41 | 41 |
| 42 this._url = url; | 42 this._url = url; |
| 43 this._urlElement.removeChildren(); | 43 this._urlElement.removeChildren(); |
| 44 if (url) | 44 if (url) |
| 45 this._urlElement.appendChild(WebInspector.linkifyURLAsNode(url)); | 45 this._urlElement.appendChild(UI.linkifyURLAsNode(url)); |
| 46 } | 46 } |
| 47 | 47 |
| 48 /** | 48 /** |
| 49 * @return {!WebInspector.Toolbar} | 49 * @return {!UI.Toolbar} |
| 50 */ | 50 */ |
| 51 createToolbar() { | 51 createToolbar() { |
| 52 var toolbar = new WebInspector.Toolbar(''); | 52 var toolbar = new UI.Toolbar(''); |
| 53 this._headerElement.appendChild(toolbar.element); | 53 this._headerElement.appendChild(toolbar.element); |
| 54 return toolbar; | 54 return toolbar; |
| 55 } | 55 } |
| 56 | 56 |
| 57 /** | 57 /** |
| 58 * @param {string} title | 58 * @param {string} title |
| 59 * @param {string=} className | 59 * @param {string=} className |
| 60 * @return {!WebInspector.ReportView.Section} | 60 * @return {!UI.ReportView.Section} |
| 61 */ | 61 */ |
| 62 appendSection(title, className) { | 62 appendSection(title, className) { |
| 63 var section = new WebInspector.ReportView.Section(title, className); | 63 var section = new UI.ReportView.Section(title, className); |
| 64 section.show(this._sectionList); | 64 section.show(this._sectionList); |
| 65 return section; | 65 return section; |
| 66 } | 66 } |
| 67 | 67 |
| 68 removeAllSection() { | 68 removeAllSection() { |
| 69 this._sectionList.removeChildren(); | 69 this._sectionList.removeChildren(); |
| 70 } | 70 } |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 /** | 73 /** |
| 74 * @unrestricted | 74 * @unrestricted |
| 75 */ | 75 */ |
| 76 WebInspector.ReportView.Section = class extends WebInspector.VBox { | 76 UI.ReportView.Section = class extends UI.VBox { |
| 77 /** | 77 /** |
| 78 * @param {string} title | 78 * @param {string} title |
| 79 * @param {string=} className | 79 * @param {string=} className |
| 80 */ | 80 */ |
| 81 constructor(title, className) { | 81 constructor(title, className) { |
| 82 super(); | 82 super(); |
| 83 this.element.classList.add('report-section'); | 83 this.element.classList.add('report-section'); |
| 84 if (className) | 84 if (className) |
| 85 this.element.classList.add(className); | 85 this.element.classList.add(className); |
| 86 this._headerElement = this.element.createChild('div', 'report-section-header
'); | 86 this._headerElement = this.element.createChild('div', 'report-section-header
'); |
| 87 this._titleElement = this._headerElement.createChild('div', 'report-section-
title'); | 87 this._titleElement = this._headerElement.createChild('div', 'report-section-
title'); |
| 88 this._titleElement.textContent = title; | 88 this._titleElement.textContent = title; |
| 89 this._fieldList = this.element.createChild('div', 'vbox'); | 89 this._fieldList = this.element.createChild('div', 'vbox'); |
| 90 /** @type {!Map.<string, !Element>} */ | 90 /** @type {!Map.<string, !Element>} */ |
| 91 this._fieldMap = new Map(); | 91 this._fieldMap = new Map(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 /** | 94 /** |
| 95 * @param {string} title | 95 * @param {string} title |
| 96 */ | 96 */ |
| 97 setTitle(title) { | 97 setTitle(title) { |
| 98 if (this._titleElement.textContent !== title) | 98 if (this._titleElement.textContent !== title) |
| 99 this._titleElement.textContent = title; | 99 this._titleElement.textContent = title; |
| 100 } | 100 } |
| 101 | 101 |
| 102 /** | 102 /** |
| 103 * @return {!WebInspector.Toolbar} | 103 * @return {!UI.Toolbar} |
| 104 */ | 104 */ |
| 105 createToolbar() { | 105 createToolbar() { |
| 106 var toolbar = new WebInspector.Toolbar(''); | 106 var toolbar = new UI.Toolbar(''); |
| 107 this._headerElement.appendChild(toolbar.element); | 107 this._headerElement.appendChild(toolbar.element); |
| 108 return toolbar; | 108 return toolbar; |
| 109 } | 109 } |
| 110 | 110 |
| 111 /** | 111 /** |
| 112 * @param {string} title | 112 * @param {string} title |
| 113 * @param {string=} textValue | 113 * @param {string=} textValue |
| 114 * @return {!Element} | 114 * @return {!Element} |
| 115 */ | 115 */ |
| 116 appendField(title, textValue) { | 116 appendField(title, textValue) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 */ | 164 */ |
| 165 appendRow() { | 165 appendRow() { |
| 166 return this._fieldList.createChild('div', 'report-row'); | 166 return this._fieldList.createChild('div', 'report-row'); |
| 167 } | 167 } |
| 168 | 168 |
| 169 clearContent() { | 169 clearContent() { |
| 170 this._fieldList.removeChildren(); | 170 this._fieldList.removeChildren(); |
| 171 this._fieldMap.clear(); | 171 this._fieldMap.clear(); |
| 172 } | 172 } |
| 173 }; | 173 }; |
| OLD | NEW |