Subversion Repository Public Repository

litesoft

Diff Revisions 947 vs 948 for /trunk/Java/GWT/Client/src/com/google/gwt/gen2/table/client/FlexTable.java

Diff revisions: vs.
  @@ -22,16 +22,14 @@
22 22 * <p/>
23 23 * TODO: Incorporate changes into actual class.
24 24 */
25 - public class FlexTable extends HTMLTable
26 - {
25 + public class FlexTable extends HTMLTable {
27 26
28 27 /**
29 28 * FlexTable-specific implementation of {@link HTMLTable.CellFormatter}. The
30 29 * formatter retrieved from {@link HTMLTable#getCellFormatter()} may be cast
31 30 * to this class.
32 31 */
33 - public class FlexCellFormatter extends CellFormatter
34 - {
32 + public class FlexCellFormatter extends CellFormatter {
35 33
36 34 /**
37 35 * Gets the column span for the given cell. This is the number of logical
  @@ -44,8 +42,7 @@
44 42 *
45 43 * @throws IndexOutOfBoundsException
46 44 */
47 - public int getColSpan( int row, int column )
48 - {
45 + public int getColSpan( int row, int column ) {
49 46 return DOM.getElementPropertyInt( getElement( row, column ), "colSpan" );
50 47 }
51 48
  @@ -60,8 +57,7 @@
60 57 *
61 58 * @throws IndexOutOfBoundsException
62 59 */
63 - public int getRowSpan( int row, int column )
64 - {
60 + public int getRowSpan( int row, int column ) {
65 61 return DOM.getElementPropertyInt( getElement( row, column ), "rowSpan" );
66 62 }
67 63
  @@ -75,8 +71,7 @@
75 71 *
76 72 * @throws IndexOutOfBoundsException
77 73 */
78 - public void setColSpan( int row, int column, int colSpan )
79 - {
74 + public void setColSpan( int row, int column, int colSpan ) {
80 75 DOM.setElementPropertyInt( ensureElement( row, column ), "colSpan", colSpan );
81 76 }
82 77
  @@ -90,8 +85,7 @@
90 85 *
91 86 * @throws IndexOutOfBoundsException
92 87 */
93 - public void setRowSpan( int row, int column, int rowSpan )
94 - {
88 + public void setRowSpan( int row, int column, int rowSpan ) {
95 89 DOM.setElementPropertyInt( ensureElement( row, column ), "rowSpan", rowSpan );
96 90 }
97 91 }
  @@ -114,8 +108,7 @@
114 108 }
115 109 }-*/;
116 110
117 - public FlexTable()
118 - {
111 + public FlexTable() {
119 112 super();
120 113 setCellFormatter( new FlexCellFormatter() );
121 114 setRowFormatter( new RowFormatter() );
  @@ -129,8 +122,7 @@
129 122 *
130 123 * @throws IndexOutOfBoundsException
131 124 */
132 - public void addCell( int row )
133 - {
125 + public void addCell( int row ) {
134 126 insertCell( row, getCellCount( row ) );
135 127 }
136 128
  @@ -144,8 +136,7 @@
144 136 * @throws IndexOutOfBoundsException
145 137 */
146 138 @Override
147 - public int getCellCount( int row )
148 - {
139 + public int getCellCount( int row ) {
149 140 checkRowBounds( row );
150 141 return getDOMCellCount( row );
151 142 }
  @@ -161,8 +152,7 @@
161 152 *
162 153 * @throws IndexOutOfBoundsException
163 154 */
164 - public int getColumnIndex( int row, int column )
165 - {
155 + public int getColumnIndex( int row, int column ) {
166 156 checkCellBounds( row, column );
167 157 return getRawColumnIndex( row, column );
168 158 }
  @@ -174,8 +164,7 @@
174 164 *
175 165 * @return the FlexTable's cell formatter
176 166 */
177 - public FlexCellFormatter getFlexCellFormatter()
178 - {
167 + public FlexCellFormatter getFlexCellFormatter() {
179 168 return (FlexCellFormatter) getCellFormatter();
180 169 }
181 170
  @@ -185,8 +174,7 @@
185 174 * @return number of rows
186 175 */
187 176 @Override
188 - public int getRowCount()
189 - {
177 + public int getRowCount() {
190 178 return getDOMRowCount();
191 179 }
192 180
  @@ -199,8 +187,7 @@
199 187 * @return the element
200 188 */
201 189 @Override
202 - public Element insertCell( int beforeRow, int beforeColumn )
203 - {
190 + public Element insertCell( int beforeRow, int beforeColumn ) {
204 191 return super.insertCell( beforeRow, beforeColumn );
205 192 }
206 193
  @@ -210,8 +197,7 @@
210 197 * @param beforeRow the row to insert
211 198 */
212 199 @Override
213 - public int insertRow( int beforeRow )
214 - {
200 + public int insertRow( int beforeRow ) {
215 201 return super.insertRow( beforeRow );
216 202 }
217 203
  @@ -224,8 +210,7 @@
224 210 * @throws IndexOutOfBoundsException
225 211 */
226 212 @Override
227 - public void removeCell( int row, int column )
228 - {
213 + public void removeCell( int row, int column ) {
229 214 super.removeCell( row, column );
230 215 }
231 216
  @@ -238,17 +223,14 @@
238 223 *
239 224 * @throws IndexOutOfBoundsException
240 225 */
241 - public void removeCells( int row, int column, int num )
242 - {
243 - for ( int i = 0; i < num; i++ )
244 - {
226 + public void removeCells( int row, int column, int num ) {
227 + for ( int i = 0; i < num; i++ ) {
245 228 removeCell( row, column );
246 229 }
247 230 }
248 231
249 232 @Override
250 - public void removeRow( int row )
251 - {
233 + public void removeRow( int row ) {
252 234 super.removeRow( row );
253 235 }
254 236
  @@ -258,8 +240,7 @@
258 240 * @param row the row to affect
259 241 * @param num the number of cells to add
260 242 */
261 - protected void addCells( int row, int num )
262 - {
243 + protected void addCells( int row, int num ) {
263 244 addCells( getBodyElement(), row, num );
264 245 }
265 246
  @@ -272,19 +253,16 @@
272 253 * @throws IndexOutOfBoundsException if the row is negative
273 254 */
274 255 @Override
275 - protected void prepareCell( int row, int column )
276 - {
256 + protected void prepareCell( int row, int column ) {
277 257 prepareRow( row );
278 - if ( column < 0 )
279 - {
258 + if ( column < 0 ) {
280 259 throw new IndexOutOfBoundsException( "Cannot create a column with a negative index: " + column );
281 260 }
282 261
283 262 // Ensure that the requested column exists.
284 263 int cellCount = getCellCount( row );
285 264 int required = column + 1 - cellCount;
286 - if ( required > 0 )
287 - {
265 + if ( required > 0 ) {
288 266 addCells( row, required );
289 267 }
290 268 }
  @@ -297,17 +275,14 @@
297 275 * @throws IndexOutOfBoundsException if the row is negative
298 276 */
299 277 @Override
300 - protected void prepareRow( int row )
301 - {
302 - if ( row < 0 )
303 - {
278 + protected void prepareRow( int row ) {
279 + if ( row < 0 ) {
304 280 throw new IndexOutOfBoundsException( "Cannot create a row with a negative index: " + row );
305 281 }
306 282
307 283 // Ensure that the requested row exists.
308 284 int rowCount = getRowCount();
309 - for ( int i = rowCount; i <= row; i++ )
310 - {
285 + for ( int i = rowCount; i <= row; i++ ) {
311 286 insertRow( i );
312 287 }
313 288 }
  @@ -324,27 +299,21 @@
324 299 *
325 300 * @throws IndexOutOfBoundsException
326 301 */
327 - private int getRawColumnIndex( int row, int column )
328 - {
302 + private int getRawColumnIndex( int row, int column ) {
329 303 // Get cells before me in my row
330 304 FlexCellFormatter formatter = getFlexCellFormatter();
331 305 int columnIndex = 0;
332 - for ( int curCell = 0; curCell < column; curCell++ )
333 - {
306 + for ( int curCell = 0; curCell < column; curCell++ ) {
334 307 columnIndex += formatter.getColSpan( row, curCell );
335 308 }
336 309
337 310 // Get cells that span down into my row
338 311 int numCells = 0;
339 - for ( int curRow = 0; curRow < row; curRow++ )
340 - {
312 + for ( int curRow = 0; curRow < row; curRow++ ) {
341 313 numCells = getCellCount( curRow );
342 - for ( int curCell = 0; curCell < numCells; curCell++ )
343 - {
344 - if ( (curRow + formatter.getRowSpan( curRow, curCell ) - 1) >= row )
345 - {
346 - if ( getRawColumnIndex( curRow, curCell ) <= columnIndex )
347 - {
314 + for ( int curCell = 0; curCell < numCells; curCell++ ) {
315 + if ( (curRow + formatter.getRowSpan( curRow, curCell ) - 1) >= row ) {
316 + if ( getRawColumnIndex( curRow, curCell ) <= columnIndex ) {
348 317 columnIndex += formatter.getColSpan( curRow, curCell );
349 318 }
350 319 }