Skip to content

Commit

Permalink
Setup column captions when reading grid from a design file
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur- committed Mar 7, 2017
1 parent b83d037 commit 1f80aaf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 10 additions & 0 deletions server/src/main/java/com/vaadin/ui/Grid.java
Original file line number Diff line number Diff line change
Expand Up @@ -3708,6 +3708,16 @@ private void readStructure(Element design, DesignContext context) {
getFooter().readDesign(child, context);
}
}

// Sync default header captions to column captions
if (getDefaultHeaderRow() != null) {
for (Column<T, ?> c : getColumns()) {
HeaderCell headerCell = getDefaultHeaderRow().getCell(c);
if (headerCell.getCellType() == GridStaticCellType.TEXT) {
c.setCaption(headerCell.getText());
}
}
}
}

private void readData(Element body,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -806,11 +806,9 @@ private void assertColumns(int expectedCount,

// Property mapping
Assert.assertEquals(expectedColumn.getId(), column.getId());
// Not tested because of
// https://github.com/vaadin/framework/issues/8752
// Header caption
// Assert.assertEquals(expectedColumn.getCaption(),
// column.getCaption());
Assert.assertEquals(expectedColumn.getCaption(),
column.getCaption());

// Value providers are not stored in the declarative file
// so this only works for bean properties
Expand Down

0 comments on commit 1f80aaf

Please sign in to comment.