OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 return this._smallChildren; | 46 return this._smallChildren; |
47 }, | 47 }, |
48 | 48 |
49 set smallChildren(x) | 49 set smallChildren(x) |
50 { | 50 { |
51 if (this._smallChildren === x) | 51 if (this._smallChildren === x) |
52 return; | 52 return; |
53 | 53 |
54 this._smallChildren = x; | 54 this._smallChildren = x; |
55 | 55 |
56 if (this._smallChildren) | 56 this._childrenListNode.classList.toggle("small", this._smallChildren); |
57 this._childrenListNode.classList.add("small"); | |
58 else | |
59 this._childrenListNode.classList.remove("small"); | |
60 }, | 57 }, |
61 | 58 |
62 onattach: function() | 59 onattach: function() |
63 { | 60 { |
64 this._listItemNode.classList.add("sidebar-tree-section"); | 61 this._listItemNode.classList.add("sidebar-tree-section"); |
65 }, | 62 }, |
66 | 63 |
67 onreveal: function() | 64 onreveal: function() |
68 { | 65 { |
69 if (this.listItemElement) | 66 if (this.listItemElement) |
(...skipping 14 matching lines...) Expand all Loading... |
84 */ | 81 */ |
85 WebInspector.SidebarTreeElement = function(className, title, subtitle, represent
edObject, hasChildren) | 82 WebInspector.SidebarTreeElement = function(className, title, subtitle, represent
edObject, hasChildren) |
86 { | 83 { |
87 TreeElement.call(this, "", representedObject, hasChildren); | 84 TreeElement.call(this, "", representedObject, hasChildren); |
88 | 85 |
89 if (hasChildren) { | 86 if (hasChildren) { |
90 this.disclosureButton = document.createElement("button"); | 87 this.disclosureButton = document.createElement("button"); |
91 this.disclosureButton.className = "disclosure-button"; | 88 this.disclosureButton.className = "disclosure-button"; |
92 } | 89 } |
93 | 90 |
94 this.iconElement = document.createElementWithClass("img", "icon"); | 91 this.iconElement = document.createElementWithClass("div", "icon"); |
95 this.statusElement = document.createElementWithClass("div", "status"); | 92 this.statusElement = document.createElementWithClass("div", "status"); |
96 this.titlesElement = document.createElementWithClass("div", "titles"); | 93 this.titlesElement = document.createElementWithClass("div", "titles"); |
97 | 94 |
98 this.titleContainer = this.titlesElement.createChild("span", "title-containe
r"); | 95 this.titleContainer = this.titlesElement.createChild("span", "title-containe
r"); |
99 this.titleElement = this.titleContainer.createChild("span", "title"); | 96 this.titleElement = this.titleContainer.createChild("span", "title"); |
100 | 97 |
101 this.subtitleElement = this.titlesElement.createChild("span", "subtitle"); | 98 this.subtitleElement = this.titlesElement.createChild("span", "subtitle"); |
102 | 99 |
103 this.className = className; | 100 this.className = className; |
104 this.mainTitle = title; | 101 this.mainTitle = title; |
105 this.subtitle = subtitle; | 102 this.subtitle = subtitle; |
106 } | 103 } |
107 | 104 |
108 WebInspector.SidebarTreeElement.prototype = { | 105 WebInspector.SidebarTreeElement.prototype = { |
109 get small() | 106 get small() |
110 { | 107 { |
111 return this._small; | 108 return this._small; |
112 }, | 109 }, |
113 | 110 |
114 set small(x) | 111 set small(x) |
115 { | 112 { |
116 this._small = x; | 113 this._small = x; |
117 | 114 if (this._listItemNode) |
118 if (this._listItemNode) { | 115 this._listItemNode.classList.toggle("small", this._small); |
119 if (this._small) | |
120 this._listItemNode.classList.add("small"); | |
121 else | |
122 this._listItemNode.classList.remove("small"); | |
123 } | |
124 }, | 116 }, |
125 | 117 |
126 get mainTitle() | 118 get mainTitle() |
127 { | 119 { |
128 return this._mainTitle; | 120 return this._mainTitle; |
129 }, | 121 }, |
130 | 122 |
131 set mainTitle(x) | 123 set mainTitle(x) |
132 { | 124 { |
133 this._mainTitle = x; | 125 this._mainTitle = x; |
134 this.refreshTitles(); | 126 this.refreshTitles(); |
135 }, | 127 }, |
136 | 128 |
137 get subtitle() | 129 get subtitle() |
138 { | 130 { |
139 return this._subtitle; | 131 return this._subtitle; |
140 }, | 132 }, |
141 | 133 |
142 set subtitle(x) | 134 set subtitle(x) |
143 { | 135 { |
144 this._subtitle = x; | 136 this._subtitle = x; |
145 this.refreshTitles(); | 137 this.refreshTitles(); |
146 }, | 138 }, |
147 | 139 |
148 set wait(x) | 140 set wait(x) |
149 { | 141 { |
150 if (x) | 142 this._listItemNode.classList.toggle("wait", x); |
151 this._listItemNode.classList.add("wait"); | |
152 else | |
153 this._listItemNode.classList.remove("wait"); | |
154 }, | 143 }, |
155 | 144 |
156 refreshTitles: function() | 145 refreshTitles: function() |
157 { | 146 { |
158 var mainTitle = this.mainTitle; | 147 var mainTitle = this.mainTitle; |
159 if (this.titleElement.textContent !== mainTitle) | 148 if (this.titleElement.textContent !== mainTitle) |
160 this.titleElement.textContent = mainTitle; | 149 this.titleElement.textContent = mainTitle; |
161 | 150 |
162 var subtitle = this.subtitle; | 151 var subtitle = this.subtitle; |
163 if (subtitle) { | 152 if (subtitle) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 }, | 186 }, |
198 | 187 |
199 onreveal: function() | 188 onreveal: function() |
200 { | 189 { |
201 if (this._listItemNode) | 190 if (this._listItemNode) |
202 this._listItemNode.scrollIntoViewIfNeeded(false); | 191 this._listItemNode.scrollIntoViewIfNeeded(false); |
203 }, | 192 }, |
204 | 193 |
205 __proto__: TreeElement.prototype | 194 __proto__: TreeElement.prototype |
206 } | 195 } |
OLD | NEW |