|
@@ -1,8 +1,6 @@ |
1 |
1 |
|
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
2 |
|
package org.litesoft.GWT.client.widgets.datatables; |
3 |
3 |
|
|
4 |
|
- |
import java.util.*; |
5 |
|
- |
|
6 |
4 |
|
import org.litesoft.GWT.client.event.*; |
7 |
5 |
|
import org.litesoft.GWT.client.widgets.*; |
8 |
6 |
|
import org.litesoft.core.util.*; |
|
@@ -13,21 +11,21 @@ |
13 |
11 |
|
import com.google.gwt.user.client.*; |
14 |
12 |
|
import com.google.gwt.user.client.ui.*; |
15 |
13 |
|
|
|
14 |
+ |
import java.util.*; |
|
15 |
+ |
|
16 |
16 |
|
/** |
17 |
17 |
|
* TODO: size |
18 |
18 |
|
* TODO: min height? |
19 |
19 |
|
*/ |
20 |
20 |
|
public class RegularTable<T> extends SizeableSimplePanel implements HasSelectionHandlers<T>, |
21 |
|
- |
TableDataReloadable |
22 |
|
- |
{ |
|
21 |
+ |
TableDataReloadable { |
23 |
22 |
|
protected final Table<T> mTable; |
24 |
23 |
|
|
25 |
24 |
|
/** |
26 |
25 |
|
* @param pModel the data source |
27 |
26 |
|
* @param pDefinition the column definition |
28 |
27 |
|
*/ |
29 |
|
- |
public RegularTable( ListTableModel<T> pModel, TableDefinitionPlus<T> pDefinition ) |
30 |
|
- |
{ |
|
28 |
+ |
public RegularTable( ListTableModel<T> pModel, TableDefinitionPlus<T> pDefinition ) { |
31 |
29 |
|
this( pModel, pDefinition, null ); |
32 |
30 |
|
} |
33 |
31 |
|
|
|
@@ -36,8 +34,7 @@ |
36 |
34 |
|
* @param pDefinition the column definition |
37 |
35 |
|
* @param pRowClickCommand {@link Command} to execute upon clicking a row, or <code>null</code> |
38 |
36 |
|
*/ |
39 |
|
- |
public RegularTable( ListTableModel<T> pModel, TableDefinitionPlus<T> pDefinition, TableClickCommand<T> pRowClickCommand ) |
40 |
|
- |
{ |
|
37 |
+ |
public RegularTable( ListTableModel<T> pModel, TableDefinitionPlus<T> pDefinition, TableClickCommand<T> pRowClickCommand ) { |
41 |
38 |
|
mTable = new Table<T>( pModel, pDefinition, pRowClickCommand ); |
42 |
39 |
|
mTable.setWidth( "100%" ); |
43 |
40 |
|
mTable.setHeight( "100%" ); |
|
@@ -46,95 +43,77 @@ |
46 |
43 |
|
mTable.addSelectionHandler( new SelectionDelegator<T>( this ) ); |
47 |
44 |
|
} |
48 |
45 |
|
|
49 |
|
- |
protected TableModel<T> getModel() |
50 |
|
- |
{ |
|
46 |
+ |
protected TableModel<T> getModel() { |
51 |
47 |
|
return mTable.getModel(); |
52 |
48 |
|
} |
53 |
49 |
|
|
54 |
|
- |
public ImmutableArrayList<T> getAllRows() |
55 |
|
- |
{ |
|
50 |
+ |
public ImmutableArrayList<T> getAllRows() { |
56 |
51 |
|
return mTable.getAllRows(); |
57 |
52 |
|
} |
58 |
53 |
|
|
59 |
|
- |
public RowSelectionPolicy getSelectionPolicy() |
60 |
|
- |
{ |
|
54 |
+ |
public RowSelectionPolicy getSelectionPolicy() { |
61 |
55 |
|
return mTable.getSelectionPolicy(); |
62 |
56 |
|
} |
63 |
57 |
|
|
64 |
|
- |
public void setSelectionPolicy( RowSelectionPolicy pSelectionPolicy ) |
65 |
|
- |
{ |
|
58 |
+ |
public void setSelectionPolicy( RowSelectionPolicy pSelectionPolicy ) { |
66 |
59 |
|
mTable.setSelectionPolicy( pSelectionPolicy ); |
67 |
60 |
|
} |
68 |
61 |
|
|
69 |
|
- |
public void deselectAll() |
70 |
|
- |
{ |
|
62 |
+ |
public void deselectAll() { |
71 |
63 |
|
mTable.deselectAll(); |
72 |
64 |
|
} |
73 |
65 |
|
|
74 |
|
- |
public void selectAll() |
75 |
|
- |
{ |
|
66 |
+ |
public void selectAll() { |
76 |
67 |
|
mTable.selectAll(); |
77 |
68 |
|
} |
78 |
69 |
|
|
79 |
|
- |
public boolean selectRow( T pPossibleRowValue ) |
80 |
|
- |
{ |
|
70 |
+ |
public boolean selectRow( T pPossibleRowValue ) { |
81 |
71 |
|
return mTable.selectRow( pPossibleRowValue ); |
82 |
72 |
|
} |
83 |
73 |
|
|
84 |
|
- |
public Set<T> getSelectedValues() |
85 |
|
- |
{ |
|
74 |
+ |
public Set<T> getSelectedValues() { |
86 |
75 |
|
return mTable.getSelectedValues(); |
87 |
76 |
|
} |
88 |
77 |
|
|
89 |
78 |
|
@Override |
90 |
|
- |
public HandlerRegistration addSelectionHandler( SelectionHandler<T> pHandler ) |
91 |
|
- |
{ |
|
79 |
+ |
public HandlerRegistration addSelectionHandler( SelectionHandler<T> pHandler ) { |
92 |
80 |
|
return addHandler( pHandler, SelectionEvent.getType() ); |
93 |
81 |
|
} |
94 |
82 |
|
|
95 |
|
- |
public boolean isScrollVertically() |
96 |
|
- |
{ |
|
83 |
+ |
public boolean isScrollVertically() { |
97 |
84 |
|
return mTable.isScrollVertically(); |
98 |
85 |
|
} |
99 |
86 |
|
|
100 |
|
- |
public void setScrollVertically( boolean pScrollVertically ) |
101 |
|
- |
{ |
|
87 |
+ |
public void setScrollVertically( boolean pScrollVertically ) { |
102 |
88 |
|
mTable.setScrollVertically( pScrollVertically ); |
103 |
89 |
|
} |
104 |
90 |
|
|
105 |
|
- |
public TableRowCountCallback getRowCountCallback() |
106 |
|
- |
{ |
|
91 |
+ |
public TableRowCountCallback getRowCountCallback() { |
107 |
92 |
|
return mTable.getRowCountCallback(); |
108 |
93 |
|
} |
109 |
94 |
|
|
110 |
|
- |
public void setRowCountCallback( TableRowCountCallback pRowCountCallback ) |
111 |
|
- |
{ |
|
95 |
+ |
public void setRowCountCallback( TableRowCountCallback pRowCountCallback ) { |
112 |
96 |
|
mTable.setRowCountCallback( pRowCountCallback ); |
113 |
97 |
|
} |
114 |
98 |
|
|
115 |
|
- |
public boolean isHeaderVisible() |
116 |
|
- |
{ |
|
99 |
+ |
public boolean isHeaderVisible() { |
117 |
100 |
|
return mTable.isHeaderVisible(); |
118 |
101 |
|
} |
119 |
102 |
|
|
120 |
|
- |
public void setHeaderVisible( boolean pVisible ) |
121 |
|
- |
{ |
|
103 |
+ |
public void setHeaderVisible( boolean pVisible ) { |
122 |
104 |
|
mTable.setHeaderVisible( pVisible ); |
123 |
105 |
|
} |
124 |
106 |
|
|
125 |
|
- |
public Widget getEmptyTableWidget() |
126 |
|
- |
{ |
|
107 |
+ |
public Widget getEmptyTableWidget() { |
127 |
108 |
|
return mTable.getEmptyTableWidget(); |
128 |
109 |
|
} |
129 |
110 |
|
|
130 |
|
- |
public void setEmptyTableWidget( Widget pEmptyTableWidget ) |
131 |
|
- |
{ |
|
111 |
+ |
public void setEmptyTableWidget( Widget pEmptyTableWidget ) { |
132 |
112 |
|
mTable.setEmptyTableWidget( pEmptyTableWidget ); |
133 |
113 |
|
} |
134 |
114 |
|
|
135 |
115 |
|
@Override |
136 |
|
- |
public void loadData() |
137 |
|
- |
{ |
|
116 |
+ |
public void loadData() { |
138 |
117 |
|
mTable.loadData(); |
139 |
118 |
|
} |
140 |
119 |
|
} |