| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of app; | 5 part of app; |
| 6 | 6 |
| 7 abstract class VirtualTreeRow { | 7 abstract class VirtualTreeRow { |
| 8 // Number of ems each subtree is indented. | 8 // Number of ems each subtree is indented. |
| 9 static const subtreeIndent = 1.05; | 9 static const subtreeIndent = 2.0; |
| 10 | 10 |
| 11 static const redColor = '#F44336'; | 11 static const redColor = '#F44336'; |
| 12 static const blueColor = '#3F51B5'; | 12 static const blueColor = '#3F51B5'; |
| 13 static const purpleColor = '#673AB7'; | 13 static const purpleColor = '#673AB7'; |
| 14 static const greenColor = '#4CAF50'; | 14 static const greenColor = '#4CAF50'; |
| 15 static const orangeColor = '#FF9800'; | 15 static const orangeColor = '#FF9800'; |
| 16 static const lightGrayColor = '#FAFAFA'; | 16 static const lightGrayColor = '#FAFAFA'; |
| 17 | 17 |
| 18 List backgroundColors = const [ | 18 List backgroundColors = const [ |
| 19 purpleColor, | 19 purpleColor, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 39 if (!changed) { | 39 if (!changed) { |
| 40 return; | 40 return; |
| 41 } | 41 } |
| 42 if (_expanded) { | 42 if (_expanded) { |
| 43 _expand(); | 43 _expand(); |
| 44 } else { | 44 } else { |
| 45 _collapse(); | 45 _collapse(); |
| 46 } | 46 } |
| 47 } | 47 } |
| 48 | 48 |
| 49 Element makeColorBar() { | 49 Element makeColorBar(int depth) { |
| 50 var element = new SpanElement(); | 50 var element = new SpanElement(); |
| 51 element.style.paddingLeft = '2px'; | 51 element.style.paddingLeft = '2px'; |
| 52 element.style.paddingRight = '2px'; | 52 element.style.paddingRight = '2px'; |
| 53 element.style.flexBasis = '2px'; | 53 element.style.flexBasis = '2px'; |
| 54 element.style.height = '${tree.rowHeight}px'; | 54 element.style.height = '${tree.rowHeight}px'; |
| 55 element.style.minHeight = '${tree.rowHeight}px'; | 55 element.style.minHeight = '${tree.rowHeight}px'; |
| 56 if (depth > 0) { | 56 if (depth > 0) { |
| 57 var colorIndex = (depth - 1) % backgroundColors.length; | 57 var colorIndex = (depth - 1) % backgroundColors.length; |
| 58 element.style.backgroundColor = backgroundColors[colorIndex]; | 58 element.style.backgroundColor = backgroundColors[colorIndex]; |
| 59 } | 59 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 71 new Element.tag('icon-expand-more') : | 71 new Element.tag('icon-expand-more') : |
| 72 new Element.tag('icon-chevron-right')); | 72 new Element.tag('icon-chevron-right')); |
| 73 } | 73 } |
| 74 _listeners.add(element.onClick.listen((e) { | 74 _listeners.add(element.onClick.listen((e) { |
| 75 e.stopPropagation(); | 75 e.stopPropagation(); |
| 76 toggle(); | 76 toggle(); |
| 77 })); | 77 })); |
| 78 return element; | 78 return element; |
| 79 } | 79 } |
| 80 | 80 |
| 81 Element makeIndenter({colored: true}) { | 81 Element makeIndenter(int depth, {colored: true}) { |
| 82 SpanElement element = new SpanElement(); | 82 SpanElement element = new SpanElement(); |
| 83 element.style.paddingLeft = '${subtreeIndent * depth}em'; | 83 element.style.paddingLeft = '${subtreeIndent * depth}em'; |
| 84 element.style.flexBasis = '${subtreeIndent * depth}em'; | 84 element.style.flexBasis = '${subtreeIndent * depth}em'; |
| 85 element.style.height = '${tree.rowHeight}px'; | 85 element.style.height = '${tree.rowHeight}px'; |
| 86 element.style.minHeight = '${tree.rowHeight}px'; | 86 element.style.minHeight = '${tree.rowHeight}px'; |
| 87 if (colored) { | 87 if (colored) { |
| 88 if (depth > 0) { | 88 if (depth > 0) { |
| 89 var colorIndex = (depth - 1) % backgroundColors.length; | 89 var colorIndex = (depth - 1) % backgroundColors.length; |
| 90 element.style.backgroundColor = backgroundColors[colorIndex]; | 90 element.style.backgroundColor = backgroundColors[colorIndex]; |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 return element; | 93 return element; |
| 94 } | 94 } |
| 95 | 95 |
| 96 Element makeText(String text, {String toolTip, String flexBasis: '7em'}) { | 96 Element makeText(String text, {String toolTip, |
| 97 String flexBasis: '4.5em', |
| 98 String cssClass}) { |
| 97 SpanElement element = new SpanElement(); | 99 SpanElement element = new SpanElement(); |
| 98 element.text = text; | 100 element.text = text; |
| 99 if (toolTip != null) { | 101 if (toolTip != null) { |
| 100 element.title = toolTip; | 102 element.title = toolTip; |
| 101 } | 103 } |
| 102 if (flexBasis != null) { | 104 if (flexBasis != null) { |
| 103 element.style.flexBasis = flexBasis; | 105 element.style.flexBasis = flexBasis; |
| 104 } | 106 } |
| 107 if (cssClass != null) { |
| 108 element.classes.add(cssClass); |
| 109 } |
| 105 return element; | 110 return element; |
| 106 } | 111 } |
| 107 | 112 |
| 108 Element makeGap({double ems: 0.5}) { | 113 Element makeGap({double ems: 0.5}) { |
| 109 SpanElement element = new SpanElement(); | 114 SpanElement element = new SpanElement(); |
| 110 var flexBasis = '${ems}em'; | 115 var flexBasis = '${ems}em'; |
| 111 element.style.flexBasis = flexBasis; | 116 element.style.flexBasis = flexBasis; |
| 112 return element; | 117 return element; |
| 113 } | 118 } |
| 114 | 119 |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 if (column != _sortColumnIndex) { | 746 if (column != _sortColumnIndex) { |
| 742 return columns[column].label + '\u2003'; | 747 return columns[column].label + '\u2003'; |
| 743 } | 748 } |
| 744 return columns[column].label + (_sortDescending ? arrowUp : arrowDown); | 749 return columns[column].label + (_sortDescending ? arrowUp : arrowDown); |
| 745 } | 750 } |
| 746 | 751 |
| 747 dynamic getValue(int row, int column) { | 752 dynamic getValue(int row, int column) { |
| 748 return rows[row].values[column]; | 753 return rows[row].values[column]; |
| 749 } | 754 } |
| 750 } | 755 } |
| OLD | NEW |