|
@@ -20,62 +20,65 @@ |
20 |
20 |
|
* <p> |
21 |
21 |
|
* Must use the {@link Grid} in the overrides package. |
22 |
22 |
|
* </p> |
23 |
|
- |
* |
|
23 |
+ |
* |
24 |
24 |
|
* @param <RowType> the data type of the row values |
25 |
25 |
|
*/ |
26 |
|
- |
public class GridBulkRenderer<RowType> extends TableBulkRenderer<RowType> { |
27 |
|
- |
/** |
28 |
|
- |
* Construct a new {@link GridBulkRenderer}. |
29 |
|
- |
* |
30 |
|
- |
* @param grid {@link Grid} to be be bulk rendered |
31 |
|
- |
* @param tableDef the table definition that should be used during rendering |
32 |
|
- |
*/ |
33 |
|
- |
public GridBulkRenderer(Grid grid, TableDefinition<RowType> tableDef) { |
34 |
|
- |
super(grid, tableDef); |
35 |
|
- |
init(grid); |
36 |
|
- |
} |
37 |
|
- |
|
38 |
|
- |
/** |
39 |
|
- |
* Construct a new {@link GridBulkRenderer}. |
40 |
|
- |
* |
41 |
|
- |
* @param grid {@link Grid} to be be bulk rendered |
42 |
|
- |
* @param sourceTableDef the external source of the table definition |
43 |
|
- |
*/ |
44 |
|
- |
public GridBulkRenderer(Grid grid, HasTableDefinition<RowType> sourceTableDef) { |
45 |
|
- |
super(grid, sourceTableDef); |
46 |
|
- |
init(grid); |
47 |
|
- |
} |
48 |
|
- |
|
49 |
|
- |
@Override |
50 |
|
- |
protected void renderRows(String rawHTMLTable) { |
51 |
|
- |
super.renderRows(rawHTMLTable); |
52 |
|
- |
setGridDimensions((Grid) getTable()); |
53 |
|
- |
} |
|
26 |
+ |
public class GridBulkRenderer<RowType> extends TableBulkRenderer<RowType> |
|
27 |
+ |
{ |
|
28 |
+ |
/** |
|
29 |
+ |
* Construct a new {@link GridBulkRenderer}. |
|
30 |
+ |
* |
|
31 |
+ |
* @param grid {@link Grid} to be be bulk rendered |
|
32 |
+ |
* @param tableDef the table definition that should be used during rendering |
|
33 |
+ |
*/ |
|
34 |
+ |
public GridBulkRenderer( Grid grid, TableDefinition<RowType> tableDef ) |
|
35 |
+ |
{ |
|
36 |
+ |
super( grid, tableDef ); |
|
37 |
+ |
init( grid ); |
|
38 |
+ |
} |
54 |
39 |
|
|
55 |
|
- |
/** |
56 |
|
- |
* Short term hack to set protected row and columns. |
57 |
|
- |
*/ |
58 |
|
- |
native void setGridDimensions(Grid table) /*-{ |
59 |
|
- |
var numRows = table.@com.google.gwt.gen2.table.client.HTMLTable::getDOMRowCount()(); |
60 |
|
- |
table.@com.google.gwt.gen2.table.client.Grid::numRows = numRows; |
61 |
|
- |
var cellCount = 0; |
62 |
|
- |
if (numRows > 0) { |
63 |
|
- |
cellCount = |
64 |
|
- |
table.@com.google.gwt.gen2.table.client.HTMLTable::getDOMCellCount(I)(0); |
|
40 |
+ |
/** |
|
41 |
+ |
* Construct a new {@link GridBulkRenderer}. |
|
42 |
+ |
* |
|
43 |
+ |
* @param grid {@link Grid} to be be bulk rendered |
|
44 |
+ |
* @param sourceTableDef the external source of the table definition |
|
45 |
+ |
*/ |
|
46 |
+ |
public GridBulkRenderer( Grid grid, HasTableDefinition<RowType> sourceTableDef ) |
|
47 |
+ |
{ |
|
48 |
+ |
super( grid, sourceTableDef ); |
|
49 |
+ |
init( grid ); |
65 |
50 |
|
} |
66 |
|
- |
table.@com.google.gwt.gen2.table.client.Grid::numColumns = cellCount; |
67 |
|
- |
}-*/; |
68 |
51 |
|
|
69 |
|
- |
private void init(Grid grid) { |
70 |
|
- |
if (grid instanceof FixedWidthGrid |
71 |
|
- |
&& (!(this instanceof FixedWidthGridBulkRenderer))) { |
72 |
|
- |
throw new UnsupportedOperationException( |
73 |
|
- |
"Must use a FixedWidthGridBulkLoader to bulk load a fixed grid"); |
|
52 |
+ |
@Override |
|
53 |
+ |
protected void renderRows( String rawHTMLTable ) |
|
54 |
+ |
{ |
|
55 |
+ |
super.renderRows( rawHTMLTable ); |
|
56 |
+ |
setGridDimensions( (Grid) getTable() ); |
74 |
57 |
|
} |
75 |
|
- |
if (grid instanceof SelectionGrid |
76 |
|
- |
&& (!(this instanceof SelectionGridBulkRenderer))) { |
77 |
|
- |
throw new UnsupportedOperationException( |
78 |
|
- |
"Must use a SelectionGridBulkLoader to bulk load a selection grid"); |
|
58 |
+ |
|
|
59 |
+ |
/** |
|
60 |
+ |
* Short term hack to set protected row and columns. |
|
61 |
+ |
*/ |
|
62 |
+ |
native void setGridDimensions( Grid table ) /*-{ |
|
63 |
+ |
var numRows = table.@com.google.gwt.gen2.table.client.HTMLTable::getDOMRowCount()(); |
|
64 |
+ |
table.@com.google.gwt.gen2.table.client.Grid::numRows = numRows; |
|
65 |
+ |
var cellCount = 0; |
|
66 |
+ |
if ( numRows > 0 ) |
|
67 |
+ |
{ |
|
68 |
+ |
cellCount = table.@com.google.gwt.gen2.table.client.HTMLTable::getDOMCellCount(I)( 0 ); |
|
69 |
+ |
} |
|
70 |
+ |
table.@com.google.gwt.gen2.table.client.Grid::numColumns = cellCount; |
|
71 |
+ |
}-*/; |
|
72 |
+ |
|
|
73 |
+ |
private void init( Grid grid ) |
|
74 |
+ |
{ |
|
75 |
+ |
if ( grid instanceof FixedWidthGrid && (!(this instanceof FixedWidthGridBulkRenderer)) ) |
|
76 |
+ |
{ |
|
77 |
+ |
throw new UnsupportedOperationException( "Must use a FixedWidthGridBulkLoader to bulk load a fixed grid" ); |
|
78 |
+ |
} |
|
79 |
+ |
if ( grid instanceof SelectionGrid && (!(this instanceof SelectionGridBulkRenderer)) ) |
|
80 |
+ |
{ |
|
81 |
+ |
throw new UnsupportedOperationException( "Must use a SelectionGridBulkLoader to bulk load a selection grid" ); |
|
82 |
+ |
} |
79 |
83 |
|
} |
80 |
|
- |
} |
81 |
84 |
|
} |