summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java61
1 files changed, 18 insertions, 43 deletions
diff --git a/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java b/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java
index 617a0480ba..bcae476cf3 100644
--- a/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java
+++ b/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java
@@ -232,22 +232,26 @@ public class GridConnector extends AbstractListingConnector
grid.setDefaultHeaderRow(row);
}
- rowState.cells.forEach((columnId, cellState) -> {
- updateHeaderCellFromState(row.getCell(getColumn(columnId)),
- cellState);
- });
- for (Map.Entry<CellState, Set<String>> cellGroupEntry : rowState.cellGroups.entrySet()) {
- Set<String> group = cellGroupEntry.getValue();
-
- Grid.Column<?, ?>[] columns =
- group.stream().map(idToColumn::get).toArray(size->new Grid.Column<?, ?>[size]);
- // Set state to be the same as first in group.
- updateHeaderCellFromState(row.join(columns), cellGroupEntry.getKey());
- }
+ updateStaticRow(rowState, row);
+ }
+ }
+
+ private void updateStaticRow(RowState rowState, Grid.StaticSection.StaticRow row) {
+ rowState.cells.forEach((columnId, cellState) -> {
+ updateStaticCellFromState(row.getCell(getColumn(columnId)),
+ cellState);
+ });
+ for (Map.Entry<CellState, Set<String>> cellGroupEntry : rowState.cellGroups.entrySet()) {
+ Set<String> group = cellGroupEntry.getValue();
+
+ Grid.Column<?, ?>[] columns =
+ group.stream().map(idToColumn::get).toArray(size->new Grid.Column<?, ?>[size]);
+ // Set state to be the same as first in group.
+ updateStaticCellFromState(row.join(columns), cellGroupEntry.getKey());
}
}
- private void updateHeaderCellFromState(HeaderCell cell,
+ private void updateStaticCellFromState(Grid.StaticSection.StaticCell cell,
CellState cellState) {
switch (cellState.type) {
case TEXT:
@@ -288,39 +292,10 @@ public class GridConnector extends AbstractListingConnector
for (RowState rowState : state.rows) {
FooterRow row = grid.appendFooterRow();
- rowState.cells.forEach((columnId, cellState) -> {
- updateFooterCellFromState(row.getCell(getColumn(columnId)),
- cellState);
- });
+ updateStaticRow(rowState, row);
}
}
- private void updateFooterCellFromState(FooterCell cell,
- CellState cellState) {
- switch (cellState.type) {
- case TEXT:
- cell.setText(cellState.text);
- break;
- case HTML:
- cell.setHtml(cellState.html);
- break;
- case WIDGET:
- ComponentConnector connector = (ComponentConnector) cellState.connector;
- if (connector != null) {
- cell.setWidget(connector.getWidget());
- } else {
- // This happens if you do setVisible(false) on the component on
- // the server side
- cell.setWidget(null);
- }
- break;
- default:
- throw new IllegalStateException(
- "unexpected cell type: " + cellState.type);
- }
- cell.setStyleName(cellState.styleName);
- }
-
@Override
public void setDataSource(DataSource<JsonObject> dataSource) {
super.setDataSource(dataSource);