1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.gwtwidgets.client.temp;
17
18 import com.google.gwt.user.client.ui.FlexTable;
19 import com.google.gwt.user.client.ui.Widget;
20
21 /***
22 * Fix for removeRow(0 bug.
23 * See http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/78104bd661bebedd
24 * for a full explaination.
25 *
26 * @author Iancu Mihai (iancu.mihai@gmail.com)
27 */
28 class TFlexTable extends FlexTable
29 {
30 public void removeRow (int row)
31 {
32 int total = this.getRowCount();
33 int rowsBellow = total - row - 1;
34 Widget[][] toMove = new Widget[rowsBellow][];
35
36 for (int i = row + 1; i < total; i++) {
37 int rCols = this.getCellCount(i);
38 Widget[] wRow = new Widget[rCols];
39 for (int j = 0; j < rCols; j++) {
40 Widget w = this.getWidget(i, j);
41 if (w != null) this.remove(w);
42 wRow[j] = w;
43 }
44 toMove[i - row - 1] = wRow;
45 }
46 super.removeRow(row);
47
48 for (int i = row; i < total - 1; i++) {
49 int rCols = this.getCellCount(i);
50 Widget[] wRow = toMove[i - row];
51 for (int j = 0; j < rCols; j++) {
52 Widget w = wRow[j];
53 if (w != null) this.setWidget(i, j, w);
54 }
55 }
56 }
57 }