|
@@ -1,58 +1,58 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.client.widgets.datatables; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.core.util.*; |
5 |
|
- |
|
6 |
|
- |
import com.google.gwt.event.logical.shared.*; |
7 |
|
- |
import com.google.gwt.user.client.*; |
8 |
|
- |
|
9 |
|
- |
public class JoinedTablePair<T> implements TableDataReloadable { |
10 |
|
- |
private final JoinedTableTop<T> mTopTable; |
11 |
|
- |
private final JoinedTableBottom<T> mBottomTable; |
12 |
|
- |
|
13 |
|
- |
/** |
14 |
|
- |
* @param pModel the data source |
15 |
|
- |
* @param pDefinition the column definition |
16 |
|
- |
*/ |
17 |
|
- |
public JoinedTablePair( ListTableModel<T> pModel, TableDefinitionPlus<T> pDefinition, SelectionHandler<T> pSelectionHandler ) { |
18 |
|
- |
this( pModel, pDefinition, pSelectionHandler, null ); |
19 |
|
- |
} |
20 |
|
- |
|
21 |
|
- |
/** |
22 |
|
- |
* @param pModel the data source |
23 |
|
- |
* @param pDefinition the column definition |
24 |
|
- |
* @param pClickCommand {@link Command} to execute upon clicking a row, or <code>null</code> |
25 |
|
- |
*/ |
26 |
|
- |
public JoinedTablePair( ListTableModel<T> pModel, TableDefinitionPlus<T> pDefinition, SelectionHandler<T> pSelectionHandler, |
27 |
|
- |
TableClickCommand<T> pClickCommand ) { |
28 |
|
- |
mTopTable = new JoinedTableTop<T>( pDefinition ); |
29 |
|
- |
mBottomTable = new JoinedTableBottom<T>( pModel, pDefinition, pClickCommand ) { |
30 |
|
- |
@Override |
31 |
|
- |
protected void onLoad() { |
32 |
|
- |
super.onLoad(); |
33 |
|
- |
loadData(); |
34 |
|
- |
} |
35 |
|
- |
}; |
36 |
|
- |
new JoinedTableController<T>( mTopTable, mBottomTable ); |
37 |
|
- |
if ( pSelectionHandler != null ) { |
38 |
|
- |
mBottomTable.addSelectionHandler( pSelectionHandler ); |
39 |
|
- |
} |
40 |
|
- |
} |
41 |
|
- |
|
42 |
|
- |
public JoinedTableTop<T> getTopTable() { |
43 |
|
- |
return mTopTable; |
44 |
|
- |
} |
45 |
|
- |
|
46 |
|
- |
public JoinedTableBottom<T> getBottomTable() { |
47 |
|
- |
return mBottomTable; |
48 |
|
- |
} |
49 |
|
- |
|
50 |
|
- |
@Override |
51 |
|
- |
public void loadData() { |
52 |
|
- |
mBottomTable.loadData(); |
53 |
|
- |
} |
54 |
|
- |
|
55 |
|
- |
public ImmutableArrayList<T> getAllRows() { |
56 |
|
- |
return mBottomTable.getAllRows(); |
57 |
|
- |
} |
58 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.client.widgets.datatables; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.core.util.*; |
|
5 |
+ |
|
|
6 |
+ |
import com.google.gwt.event.logical.shared.*; |
|
7 |
+ |
import com.google.gwt.user.client.*; |
|
8 |
+ |
|
|
9 |
+ |
public class JoinedTablePair<T> implements TableDataReloadable { |
|
10 |
+ |
private final JoinedTableTop<T> mTopTable; |
|
11 |
+ |
private final JoinedTableBottom<T> mBottomTable; |
|
12 |
+ |
|
|
13 |
+ |
/** |
|
14 |
+ |
* @param pModel the data source |
|
15 |
+ |
* @param pDefinition the column definition |
|
16 |
+ |
*/ |
|
17 |
+ |
public JoinedTablePair( ListTableModel<T> pModel, TableDefinitionPlus<T> pDefinition, SelectionHandler<T> pSelectionHandler ) { |
|
18 |
+ |
this( pModel, pDefinition, pSelectionHandler, null ); |
|
19 |
+ |
} |
|
20 |
+ |
|
|
21 |
+ |
/** |
|
22 |
+ |
* @param pModel the data source |
|
23 |
+ |
* @param pDefinition the column definition |
|
24 |
+ |
* @param pClickCommand {@link Command} to execute upon clicking a row, or <code>null</code> |
|
25 |
+ |
*/ |
|
26 |
+ |
public JoinedTablePair( ListTableModel<T> pModel, TableDefinitionPlus<T> pDefinition, SelectionHandler<T> pSelectionHandler, |
|
27 |
+ |
TableClickCommand<T> pClickCommand ) { |
|
28 |
+ |
mTopTable = new JoinedTableTop<T>( pDefinition ); |
|
29 |
+ |
mBottomTable = new JoinedTableBottom<T>( pModel, pDefinition, pClickCommand ) { |
|
30 |
+ |
@Override |
|
31 |
+ |
protected void onLoad() { |
|
32 |
+ |
super.onLoad(); |
|
33 |
+ |
loadData(); |
|
34 |
+ |
} |
|
35 |
+ |
}; |
|
36 |
+ |
new JoinedTableController<T>( mTopTable, mBottomTable ); |
|
37 |
+ |
if ( pSelectionHandler != null ) { |
|
38 |
+ |
mBottomTable.addSelectionHandler( pSelectionHandler ); |
|
39 |
+ |
} |
|
40 |
+ |
} |
|
41 |
+ |
|
|
42 |
+ |
public JoinedTableTop<T> getTopTable() { |
|
43 |
+ |
return mTopTable; |
|
44 |
+ |
} |
|
45 |
+ |
|
|
46 |
+ |
public JoinedTableBottom<T> getBottomTable() { |
|
47 |
+ |
return mBottomTable; |
|
48 |
+ |
} |
|
49 |
+ |
|
|
50 |
+ |
@Override |
|
51 |
+ |
public void loadData() { |
|
52 |
+ |
mBottomTable.loadData(); |
|
53 |
+ |
} |
|
54 |
+ |
|
|
55 |
+ |
public ImmutableArrayList<T> getAllRows() { |
|
56 |
+ |
return mBottomTable.getAllRows(); |
|
57 |
+ |
} |
|
58 |
+ |
} |