Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: ui/webui/resources/js/cr/ui/table/table_header.js

Issue 2603443002: Clang format JS: Disallow single line functions, conditionals, loops, and switch statements (Closed)
Patch Set: update c/b/r/ as well Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 /** 5 /**
6 * @fileoverview This implements a table header. 6 * @fileoverview This implements a table header.
7 */ 7 */
8 8
9 cr.define('cr.ui.table', function() { 9 cr.define('cr.ui.table', function() {
10 /** @const */ var TableSplitter = cr.ui.TableSplitter; 10 /** @const */ var TableSplitter = cr.ui.TableSplitter;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 var cm = this.table_.columnModel; 58 var cm = this.table_.columnModel;
59 for (var i = 0; i < cm.size; i++) { 59 for (var i = 0; i < cm.size; i++) {
60 headerCells[i].style.width = cm.getWidth(i) + 'px'; 60 headerCells[i].style.width = cm.getWidth(i) + 'px';
61 } 61 }
62 this.placeSplitters_(this.querySelectorAll('.table-header-splitter')); 62 this.placeSplitters_(this.querySelectorAll('.table-header-splitter'));
63 }, 63 },
64 64
65 batchCount_: 0, 65 batchCount_: 0,
66 66
67 startBatchUpdates: function() { this.batchCount_++; }, 67 startBatchUpdates: function() {
68 this.batchCount_++;
69 },
68 70
69 endBatchUpdates: function() { 71 endBatchUpdates: function() {
70 this.batchCount_--; 72 this.batchCount_--;
71 if (this.batchCount_ == 0) 73 if (this.batchCount_ == 0)
72 this.redraw(); 74 this.redraw();
73 }, 75 },
74 76
75 /** 77 /**
76 * Redraws table header. 78 * Redraws table header.
77 */ 79 */
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 175 }
174 labelDiv.appendChild(span); 176 labelDiv.appendChild(span);
175 return labelDiv; 177 return labelDiv;
176 }, 178 },
177 179
178 /** 180 /**
179 * Creates sort function for given column. 181 * Creates sort function for given column.
180 * @param {number} index The index of the column to sort by. 182 * @param {number} index The index of the column to sort by.
181 */ 183 */
182 createSortFunction_: function(index) { 184 createSortFunction_: function(index) {
183 return function() { this.table_.sort(index); }.bind(this); 185 return function() {
186 this.table_.sort(index);
187 }.bind(this);
184 }, 188 },
185 189
186 /** 190 /**
187 * Handles the touchstart event. If the touch happened close enough 191 * Handles the touchstart event. If the touch happened close enough
188 * to a splitter starts dragging. 192 * to a splitter starts dragging.
189 * @param {Event} e The touch event. 193 * @param {Event} e The touch event.
190 */ 194 */
191 handleTouchStart_: function(e) { 195 handleTouchStart_: function(e) {
192 e = /** @type {TouchEvent} */ (e); 196 e = /** @type {TouchEvent} */ (e);
193 if (e.touches.length != 1) 197 if (e.touches.length != 1)
(...skipping 20 matching lines...) Expand all
214 // Splitter itself shouldn't handle this event. 218 // Splitter itself shouldn't handle this event.
215 e.stopPropagation(); 219 e.stopPropagation();
216 }, 220 },
217 221
218 /** 222 /**
219 * Handles the double click on a column separator event. 223 * Handles the double click on a column separator event.
220 * Adjusts column width. 224 * Adjusts column width.
221 * @param {number} index Column index. 225 * @param {number} index Column index.
222 * @param {Event} e The double click event. 226 * @param {Event} e The double click event.
223 */ 227 */
224 handleDblClick_: function(index, e) { this.table_.fitColumn(index); }, 228 handleDblClick_: function(index, e) {
229 this.table_.fitColumn(index);
230 },
225 231
226 /** 232 /**
227 * Determines whether a full redraw is required. 233 * Determines whether a full redraw is required.
228 * @param {!NodeList} headerCells 234 * @param {!NodeList} headerCells
229 * @return {boolean} 235 * @return {boolean}
230 */ 236 */
231 needsFullRedraw_: function(headerCells) { 237 needsFullRedraw_: function(headerCells) {
232 var cm = this.table_.columnModel; 238 var cm = this.table_.columnModel;
233 // If the number of columns in the model has changed, a full redraw is 239 // If the number of columns in the model has changed, a full redraw is
234 // needed. 240 // needed.
(...skipping 15 matching lines...) Expand all
250 cr.defineProperty(TableHeader, 'table'); 256 cr.defineProperty(TableHeader, 'table');
251 257
252 /** 258 /**
253 * Rectangular area around the splitters sensitive to touch events 259 * Rectangular area around the splitters sensitive to touch events
254 * (in pixels). 260 * (in pixels).
255 */ 261 */
256 TableHeader.TOUCH_DRAG_AREA_WIDTH = 30; 262 TableHeader.TOUCH_DRAG_AREA_WIDTH = 30;
257 263
258 return {TableHeader: TableHeader}; 264 return {TableHeader: TableHeader};
259 }); 265 });
OLDNEW
« no previous file with comments | « ui/webui/resources/js/cr/ui/table/table_column_model.js ('k') | ui/webui/resources/js/cr/ui/tabs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698