litesoft
Diff Revisions
2
vs
49
for /trunk/Java/GWT/Client/src/org/litesoft/GWT/client/widgets/datatables/TableHelper.java
|
@@ -1,3 +1,4 @@ |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://litesoft.org/License.txt |
1 |
2 |
|
package org.litesoft.GWT.client.widgets.datatables; |
2 |
3 |
|
|
3 |
4 |
|
import java.util.*; |
|
@@ -12,18 +13,18 @@ |
12 |
13 |
|
public abstract static class GridHelper |
13 |
14 |
|
{ |
14 |
15 |
|
private final HTMLTable mGrid; |
15 |
|
- |
|
|
16 |
+ |
|
16 |
17 |
|
public GridHelper(HTMLTable pGrid) |
17 |
18 |
|
{ |
18 |
19 |
|
mGrid = pGrid; |
19 |
20 |
|
} |
20 |
|
- |
|
|
21 |
+ |
|
21 |
22 |
|
public int getRowForEvent(Event pEvent) |
22 |
23 |
|
{ |
23 |
24 |
|
Element targetCell = mGrid.getEventTargetCell(pEvent); |
24 |
25 |
|
return (targetCell != null) ? getRowIndex(DOM.getParent(targetCell)) : -1; |
25 |
26 |
|
} |
26 |
|
- |
|
|
27 |
+ |
|
27 |
28 |
|
public Cell getCellForEvent(Event pEvent) |
28 |
29 |
|
{ |
29 |
30 |
|
Element targetCell = mGrid.getEventTargetCell(pEvent); |
|
@@ -39,12 +40,12 @@ |
39 |
40 |
|
} |
40 |
41 |
|
return null; |
41 |
42 |
|
} |
42 |
|
- |
|
|
43 |
+ |
|
43 |
44 |
|
protected abstract int getRowIndex(Element pRowElement); |
44 |
|
- |
|
|
45 |
+ |
|
45 |
46 |
|
protected abstract int getCellIndex(Element pRowElement, Element pCellElement); |
46 |
47 |
|
} |
47 |
|
- |
|
|
48 |
+ |
|
48 |
49 |
|
public static abstract class GridClickHandler<RowType> implements ClickHandler |
49 |
50 |
|
{ |
50 |
51 |
|
private final List<ColumnDefinition<RowType, ?>> mColDefs; |
|
@@ -85,7 +86,7 @@ |
85 |
86 |
|
|
86 |
87 |
|
protected abstract RowType getRowValue(int pRow); |
87 |
88 |
|
} |
88 |
|
- |
|
|
89 |
+ |
|
89 |
90 |
|
public static class Cell |
90 |
91 |
|
{ |
91 |
92 |
|
private final int mRow; |
|
@@ -96,12 +97,12 @@ |
96 |
97 |
|
mRow = pRow; |
97 |
98 |
|
mCol = pCol; |
98 |
99 |
|
} |
99 |
|
- |
|
|
100 |
+ |
|
100 |
101 |
|
public int getRow() |
101 |
102 |
|
{ |
102 |
103 |
|
return mRow; |
103 |
104 |
|
} |
104 |
|
- |
|
|
105 |
+ |
|
105 |
106 |
|
public int getCol() |
106 |
107 |
|
{ |
107 |
108 |
|
return mCol; |