Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/OverviewOutputTab.java @ 2982:d2a54ae0016b
Switched from 2 columns and 3 rows to 3 columns and 2 rows in sq chart overview.
flys-client/trunk@4981 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 13 Jul 2012 10:09:20 +0000 |
parents | 5161e25392ea |
children | e746e57c65c0 |
comparison
equal
deleted
inserted
replaced
2981:d700f6492386 | 2982:d2a54ae0016b |
---|---|
86 for (int j = 0; j < height; j++) { | 86 for (int j = 0; j < height; j++) { |
87 charts[i][j] = new Canvas(); | 87 charts[i][j] = new Canvas(); |
88 | 88 |
89 // This is for 3, 6 or 9 charts only! | 89 // This is for 3, 6 or 9 charts only! |
90 // TODO: Calculate the height. | 90 // TODO: Calculate the height. |
91 charts[i][j].setHeight("30%"); | 91 charts[i][j].setHeight("50%"); |
92 | 92 |
93 String type = | 93 String type = |
94 ((OutputMode)relModes.values() | 94 ((OutputMode)relModes.values() |
95 .toArray()[j + i * height]).getName(); | 95 .toArray()[j + i * height]).getName(); |
96 columns[i].addMember(charts[i][j]); | 96 columns[i].addMember(charts[i][j]); |
110 * @param event The resize event. | 110 * @param event The resize event. |
111 */ | 111 */ |
112 @Override | 112 @Override |
113 public void onResized(ResizedEvent event) { | 113 public void onResized(ResizedEvent event) { |
114 for (int i = 0; i < charts.length; i++) { | 114 for (int i = 0; i < charts.length; i++) { |
115 columns[i].setWidth(root.getWidth()/2); | 115 // This is for 3, 6 or 9 charts only! |
116 // TODO: Calculate the width. | |
117 columns[i].setWidth(root.getWidth()/3); | |
118 | |
116 for (int j = 0; j < charts[i].length; j++) { | 119 for (int j = 0; j < charts[i].length; j++) { |
117 String type = | 120 String type = |
118 ((OutputMode)relModes.values() | 121 ((OutputMode)relModes.values() |
119 .toArray()[j + i * charts[i].length]).getName(); | 122 .toArray()[j + i * charts[i].length]).getName(); |
120 Canvas[] children = charts[i][j].getChildren(); | 123 Canvas[] children = charts[i][j].getChildren(); |
138 * Returns the column count for the grid. | 141 * Returns the column count for the grid. |
139 * | 142 * |
140 * @param count all fields | 143 * @param count all fields |
141 * @return the column count | 144 * @return the column count |
142 */ | 145 */ |
143 protected int getColumnCount(int count) { | 146 protected int getRowCount(int count) { |
144 if (count <= 3) { | 147 if (count <= 3) { |
145 return 1; | 148 return 1; |
146 } | 149 } |
147 else if (count > 3 && count < 9) { | 150 else if (count > 3 && count < 9) { |
148 return 2; | 151 return 2; |
157 * Returns the row count for the grid. | 160 * Returns the row count for the grid. |
158 * | 161 * |
159 * @param count all fields | 162 * @param count all fields |
160 * @return the row count | 163 * @return the row count |
161 */ | 164 */ |
162 protected int getRowCount(int count) { | 165 protected int getColumnCount(int count) { |
163 if(count <= 3) { | 166 if(count <= 3) { |
164 return count; | 167 return count; |
165 } | 168 } |
166 else if(count > 3 && count < 9) { | 169 else if(count > 3 && count < 9) { |
167 return ((count + (count % 2))/getColumnCount(count)); | 170 return ((count + (count % 2))/getRowCount(count)); |
168 } | 171 } |
169 else { | 172 else { |
170 return (count + (3 - (count % 3))/getColumnCount(count)); | 173 return (count + (3 - (count % 3))/getRowCount(count)); |
171 } | 174 } |
172 } | 175 } |
173 | 176 |
174 | 177 |
175 /** | 178 /** |