OLD | NEW |
1 import 'dart:html'; | 1 import 'dart:html'; |
2 part 'realviews.dart'; | 2 part 'realviews.dart'; |
3 | 3 |
4 class Division { | 4 class Division { |
5 String name; | 5 String name; |
6 int id; | 6 int id; |
7 List<Product> products; | 7 List<Product> products; |
8 | 8 |
9 Division(this.name, this.id, this.products); | 9 Division(this.name, this.id, this.products); |
10 } | 10 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 sales.add(new YTD_Sales(600, "EU")); | 74 sales.add(new YTD_Sales(600, "EU")); |
75 sales.add(new YTD_Sales(10, "Canada")); | 75 sales.add(new YTD_Sales(10, "Canada")); |
76 sales.add(new YTD_Sales(8, "Mexico")); | 76 sales.add(new YTD_Sales(8, "Mexico")); |
77 products.add(new Product(300, "Dart", 2000, sales)); | 77 products.add(new Product(300, "Dart", 2000, sales)); |
78 divisions.add(new Division("Chrome", 2, products)); | 78 divisions.add(new Division("Chrome", 2, products)); |
79 | 79 |
80 products = []; | 80 products = []; |
81 sales = []; | 81 sales = []; |
82 divisions.add(new Division("Search", 4, products)); | 82 divisions.add(new Division("Search", 4, products)); |
83 | 83 |
84 var header = new Header("Google World Wide", new Date.now()); | 84 var header = new Header("Google World Wide", new DateTime.now()); |
85 var listView = new DivisionSales(divisions); | 85 var listView = new DivisionSales(divisions); |
86 | 86 |
87 document.body.elements.add(header.root); // Add top view. | 87 document.body.elements.add(header.root); // Add top view. |
88 document.body.elements.add(listView.root); // Add list view. | 88 document.body.elements.add(listView.root); // Add list view. |
89 | 89 |
90 // Hookup events. | 90 // Hookup events. |
91 for (var elem in listView.productZippy) { | 91 for (var elem in listView.productZippy) { |
92 elem.on.click.add((MouseEvent e) { | 92 elem.on.click.add((MouseEvent e) { |
93 var expandCollapseElem = e.toElement; | 93 var expandCollapseElem = e.toElement; |
94 | 94 |
95 DivElement salesDiv = expandCollapseElem.parent.elements.last; | 95 DivElement salesDiv = expandCollapseElem.parent.elements.last; |
96 | 96 |
97 bool showSales = (salesDiv.classes.contains(DivisionSales.showSales)); | 97 bool showSales = (salesDiv.classes.contains(DivisionSales.showSales)); |
98 | 98 |
99 expandCollapseElem.innerHTML = showSales ? "▶": "▼"; | 99 expandCollapseElem.innerHTML = showSales ? "▶": "▼"; |
100 expandCollapseElem.classes.remove(showSales ? DivisionSales.expand : Divis
ionSales.collapse); | 100 expandCollapseElem.classes.remove(showSales ? DivisionSales.expand : Divis
ionSales.collapse); |
101 expandCollapseElem.classes.add(showSales ? DivisionSales.collapse : Divisi
onSales.expand); | 101 expandCollapseElem.classes.add(showSales ? DivisionSales.collapse : Divisi
onSales.expand); |
102 | 102 |
103 salesDiv.classes.clear(); | 103 salesDiv.classes.clear(); |
104 salesDiv.classes.add(showSales ? DivisionSales.hideSales : DivisionSales.s
howSales); | 104 salesDiv.classes.add(showSales ? DivisionSales.hideSales : DivisionSales.s
howSales); |
105 }); | 105 }); |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
OLD | NEW |