OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 27 matching lines...) Expand all Loading... | |
38 this.element.classList.add('tabbed-pane'); | 38 this.element.classList.add('tabbed-pane'); |
39 this.contentElement.classList.add('tabbed-pane-shadow'); | 39 this.contentElement.classList.add('tabbed-pane-shadow'); |
40 this.contentElement.tabIndex = -1; | 40 this.contentElement.tabIndex = -1; |
41 this._headerElement = this.contentElement.createChild('div', 'tabbed-pane-he ader'); | 41 this._headerElement = this.contentElement.createChild('div', 'tabbed-pane-he ader'); |
42 this._headerContentsElement = this._headerElement.createChild('div', 'tabbed -pane-header-contents'); | 42 this._headerContentsElement = this._headerElement.createChild('div', 'tabbed -pane-header-contents'); |
43 this._tabSlider = createElementWithClass('div', 'tabbed-pane-tab-slider'); | 43 this._tabSlider = createElementWithClass('div', 'tabbed-pane-tab-slider'); |
44 this._tabsElement = this._headerContentsElement.createChild('div', 'tabbed-p ane-header-tabs'); | 44 this._tabsElement = this._headerContentsElement.createChild('div', 'tabbed-p ane-header-tabs'); |
45 this._tabsElement.setAttribute('role', 'tablist'); | 45 this._tabsElement.setAttribute('role', 'tablist'); |
46 this._contentElement = this.contentElement.createChild('div', 'tabbed-pane-c ontent'); | 46 this._contentElement = this.contentElement.createChild('div', 'tabbed-pane-c ontent'); |
47 this._contentElement.setAttribute('role', 'tabpanel'); | 47 this._contentElement.setAttribute('role', 'tabpanel'); |
48 this._contentElement.createChild('content'); | 48 var contentTag = this._contentElement.createChild('content'); |
49 contentTag.createChild('span', 'content child'); | |
chenwilliam
2017/02/25 00:56:43
remove this?
luoe
2017/03/09 18:48:28
Done.
| |
49 /** @type {!Array.<!UI.TabbedPaneTab>} */ | 50 /** @type {!Array.<!UI.TabbedPaneTab>} */ |
50 this._tabs = []; | 51 this._tabs = []; |
51 /** @type {!Array.<!UI.TabbedPaneTab>} */ | 52 /** @type {!Array.<!UI.TabbedPaneTab>} */ |
52 this._tabsHistory = []; | 53 this._tabsHistory = []; |
53 /** @type {!Map<string, !UI.TabbedPaneTab>} */ | 54 /** @type {!Map<string, !UI.TabbedPaneTab>} */ |
54 this._tabsById = new Map(); | 55 this._tabsById = new Map(); |
55 this._currentTabLocked = false; | 56 this._currentTabLocked = false; |
56 this._autoSelectFirstItemOnShow = true; | 57 this._autoSelectFirstItemOnShow = true; |
57 | 58 |
58 this._dropDownButton = this._createDropDownButton(); | 59 this._dropDownButton = this._createDropDownButton(); |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
482 else | 483 else |
483 constraints = constraints.addHeight(new UI.Constraints(new UI.Size(0, 30)) ); | 484 constraints = constraints.addHeight(new UI.Constraints(new UI.Size(0, 30)) ); |
484 return constraints; | 485 return constraints; |
485 } | 486 } |
486 | 487 |
487 _updateTabElements() { | 488 _updateTabElements() { |
488 UI.invokeOnceAfterBatchUpdate(this, this._innerUpdateTabElements); | 489 UI.invokeOnceAfterBatchUpdate(this, this._innerUpdateTabElements); |
489 } | 490 } |
490 | 491 |
491 /** | 492 /** |
492 * @param {string} text | 493 * @param {!Element} element |
493 */ | 494 */ |
494 setPlaceholderText(text) { | 495 setPlaceholderElement(element) { |
495 this._noTabsMessage = text; | 496 this._noTabsMessageElement = element; |
496 } | 497 } |
497 | 498 |
498 _innerUpdateTabElements() { | 499 _innerUpdateTabElements() { |
499 if (!this.isShowing()) | 500 if (!this.isShowing()) |
500 return; | 501 return; |
501 | 502 |
502 if (!this._tabs.length) { | 503 if (!this._tabs.length) { |
503 this._contentElement.classList.add('has-no-tabs'); | 504 this._contentElement.classList.add('has-no-tabs'); |
504 if (this._noTabsMessage && !this._noTabsMessageElement) { | 505 if (this._noTabsMessageElement) |
505 this._noTabsMessageElement = this._contentElement.createChild('div', 'ta bbed-pane-placeholder fill'); | 506 this.element.appendChild(this._noTabsMessageElement); |
506 this._noTabsMessageElement.textContent = this._noTabsMessage; | |
507 } | |
508 } else { | 507 } else { |
509 this._contentElement.classList.remove('has-no-tabs'); | 508 this._contentElement.classList.remove('has-no-tabs'); |
510 if (this._noTabsMessageElement) { | 509 if (this._noTabsMessageElement) { |
511 this._noTabsMessageElement.remove(); | 510 this._noTabsMessageElement.remove(); |
512 delete this._noTabsMessageElement; | 511 delete this._noTabsMessageElement; |
chenwilliam
2017/02/25 00:56:43
We don't want to delete this property.
luoe
2017/03/09 18:48:28
Done.
| |
513 } | 512 } |
514 } | 513 } |
515 | 514 |
516 this._measureDropDownButton(); | 515 this._measureDropDownButton(); |
517 this._updateWidths(); | 516 this._updateWidths(); |
518 this._updateTabsDropDown(); | 517 this._updateTabsDropDown(); |
519 this._updateTabSlider(); | 518 this._updateTabSlider(); |
520 } | 519 } |
521 | 520 |
522 /** | 521 /** |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1222 * @param {!Array.<string>} ids | 1221 * @param {!Array.<string>} ids |
1223 */ | 1222 */ |
1224 closeTabs(tabbedPane, ids) {}, | 1223 closeTabs(tabbedPane, ids) {}, |
1225 | 1224 |
1226 /** | 1225 /** |
1227 * @param {string} tabId | 1226 * @param {string} tabId |
1228 * @param {!UI.ContextMenu} contextMenu | 1227 * @param {!UI.ContextMenu} contextMenu |
1229 */ | 1228 */ |
1230 onContextMenu(tabId, contextMenu) {} | 1229 onContextMenu(tabId, contextMenu) {} |
1231 }; | 1230 }; |
OLD | NEW |