| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 * This is a view class showing tree-menu. | 6 * This is a view class showing tree-menu. |
| 7 * @param {Object} profiler Must have addListener method. | 7 * @param {Object} profiler Must have addListener method. |
| 8 * @construct | 8 * @construct |
| 9 */ | 9 */ |
| 10 var MenuView = function(profiler) { | 10 var MenuView = function(profiler) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 $tree.tree('selectNode', null); | 29 $tree.tree('selectNode', null); |
| 30 return; | 30 return; |
| 31 } | 31 } |
| 32 | 32 |
| 33 var node = $tree.tree('getNodeById', id); | 33 var node = $tree.tree('getNodeById', id); |
| 34 $tree.tree('selectNode', node); | 34 $tree.tree('selectNode', node); |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * Update menu view when model updated. | 38 * Update menu view when model updated. |
| 39 * @param {Array.<Object>} models | 39 * @param {Array<Object>} models |
| 40 * @private | 40 * @private |
| 41 */ | 41 */ |
| 42 MenuView.prototype.redraw_ = function(models) { | 42 MenuView.prototype.redraw_ = function(models) { |
| 43 function convert(origin, target) { | 43 function convert(origin, target) { |
| 44 target.label = origin.name; | 44 target.label = origin.name; |
| 45 target.id = origin.id; | 45 target.id = origin.id; |
| 46 | 46 |
| 47 if ('children' in origin) { | 47 if ('children' in origin) { |
| 48 target.children = []; | 48 target.children = []; |
| 49 origin.children.forEach(function(originChild) { | 49 origin.children.forEach(function(originChild) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 }); | 107 }); |
| 108 this.$tree_.bind('tree.close', function(event) { | 108 this.$tree_.bind('tree.close', function(event) { |
| 109 event.preventDefault(); | 109 event.preventDefault(); |
| 110 self.profiler_.unsetSub(event.node.id); | 110 self.profiler_.unsetSub(event.node.id); |
| 111 self.profiler_.setSelected(event.node.id); | 111 self.profiler_.setSelected(event.node.id); |
| 112 }); | 112 }); |
| 113 } else { | 113 } else { |
| 114 this.$tree_.tree('loadData', data); | 114 this.$tree_.tree('loadData', data); |
| 115 } | 115 } |
| 116 }; | 116 }; |
| OLD | NEW |