summaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2016-11-16 11:19:09 +0200
committerVaadin Code Review <review@vaadin.com>2016-11-18 12:28:58 +0000
commit848feaaf30762204cb4d9c7bf8b76fbb8bb675da (patch)
tree510e6c209096d85257f2be388fe44094ab59726a /client/src
parent9d6baef98851d0cd5092581f954f9b3ee6908003 (diff)
downloadvaadin-framework-848feaaf30762204cb4d9c7bf8b76fbb8bb675da.tar.gz
vaadin-framework-848feaaf30762204cb4d9c7bf8b76fbb8bb675da.zip
Add HTML/Component support to Grid Footers
Change-Id: Iaffe3214163f66c0617a5bea4b79f4ae39d0bc08
Diffstat (limited to 'client/src')
-rw-r--r--client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java30
1 files changed, 29 insertions, 1 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 f5d95dfa80..b7b2fb957d 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
@@ -52,6 +52,7 @@ import com.vaadin.client.widget.grid.sort.SortEvent;
import com.vaadin.client.widget.grid.sort.SortOrder;
import com.vaadin.client.widgets.Grid;
import com.vaadin.client.widgets.Grid.Column;
+import com.vaadin.client.widgets.Grid.FooterCell;
import com.vaadin.client.widgets.Grid.FooterRow;
import com.vaadin.client.widgets.Grid.HeaderCell;
import com.vaadin.client.widgets.Grid.HeaderRow;
@@ -279,11 +280,38 @@ public class GridConnector extends AbstractListingConnector
FooterRow row = grid.appendFooterRow();
rowState.cells.forEach((columnId, cellState) -> {
- row.getCell(getColumn(columnId)).setText(cellState.text);
+ updateFooterCellFromState(row.getCell(getColumn(columnId)),
+ cellState);
});
}
}
+ 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);