diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-01-07 15:54:00 +0200 |
---|---|---|
committer | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-01-07 15:54:00 +0200 |
commit | ab6cb8ed35a1b5f1d301d359e75e9e0e4f758f24 (patch) | |
tree | 0b35954e9ef3d6469bfa97cfac83f61502100f10 | |
parent | 2e4677b67a63980fd71955d4325c4e329a95f5e8 (diff) | |
download | vaadin-framework-ab6cb8ed35a1b5f1d301d359e75e9e0e4f758f24.tar.gz vaadin-framework-ab6cb8ed35a1b5f1d301d359e75e9e0e4f758f24.zip |
Fix header texts to captions in Grid client side (#15511)
Change-Id: Ibd6ceae1148820a6644271986e5ea3aab36b08fa
-rw-r--r-- | client/src/com/vaadin/client/widgets/Grid.java | 49 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesWidget.java | 14 |
2 files changed, 31 insertions, 32 deletions
diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java index a32dccd391..c95e8e4a53 100644 --- a/client/src/com/vaadin/client/widgets/Grid.java +++ b/client/src/com/vaadin/client/widgets/Grid.java @@ -2552,7 +2552,7 @@ public class Grid<T> extends ResizeComposite implements private boolean sortable = false; - private String headerText = ""; + private String headerCaption = ""; private double minimumWidthPx = GridColumnState.DEFAULT_MIN_WIDTH; private double maximumWidthPx = GridColumnState.DEFAULT_MAX_WIDTH; @@ -2568,15 +2568,15 @@ public class Grid<T> extends ResizeComposite implements /** * Constructs a new column with a simple TextRenderer. * - * @param headerText - * The header text for this column + * @param caption + * The header caption for this column * * @throws IllegalArgumentException - * if given header text is null + * if given header caption is null */ - public Column(String headerText) throws IllegalArgumentException { + public Column(String caption) throws IllegalArgumentException { this(); - setHeaderText(headerText); + setHeaderCaption(caption); } /** @@ -2598,16 +2598,16 @@ public class Grid<T> extends ResizeComposite implements * * @param renderer * The renderer to use for rendering the cells - * @param headerText - * The header text for this column + * @param caption + * The header caption for this column * * @throws IllegalArgumentException - * if given Renderer or header text is null + * if given Renderer or header caption is null */ - public Column(String headerText, Renderer<? super C> renderer) + public Column(String caption, Renderer<? super C> renderer) throws IllegalArgumentException { this(renderer); - setHeaderText(headerText); + setHeaderCaption(caption); } /** @@ -2634,23 +2634,22 @@ public class Grid<T> extends ResizeComposite implements } /** - * Sets a header text for this column. + * Sets a header caption for this column. * - * @param headerText - * The header text for this column + * @param caption + * The header caption for this column * @return the column itself * * @throws IllegalArgumentException - * if given header text is null + * if given caption text is null */ - public Column<C, T> setHeaderText(String headerText) { - if (headerText == null) { - throw new IllegalArgumentException( - "Header text cannot be null."); + public Column<C, T> setHeaderCaption(String caption) { + if (caption == null) { + throw new IllegalArgumentException("Caption cannot be null."); } - if (!this.headerText.equals(headerText)) { - this.headerText = headerText; + if (!this.headerCaption.equals(caption)) { + this.headerCaption = caption; if (grid != null) { updateHeader(); } @@ -2662,7 +2661,7 @@ public class Grid<T> extends ResizeComposite implements private void updateHeader() { HeaderRow row = grid.getHeader().getDefaultRow(); if (row != null) { - row.getCell(this).setText(headerText); + row.getCell(this).setText(headerCaption); } } @@ -2810,8 +2809,8 @@ public class Grid<T> extends ResizeComposite implements public String toString() { String details = ""; - if (headerText != null && !headerText.isEmpty()) { - details += "header:\"" + headerText + "\" "; + if (headerCaption != null && !headerCaption.isEmpty()) { + details += "header:\"" + headerCaption + "\" "; } else { details += "header:empty "; } @@ -3819,7 +3818,7 @@ public class Grid<T> extends ResizeComposite implements /** * Returns the current default row of the header section. The default row is * a special header row providing a user interface for sorting columns. - * Setting a header text for column updates cells in the default header. + * Setting a header caption for column updates cells in the default header. * * @return the default row or null if no default row set */ diff --git a/uitest/src/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesWidget.java b/uitest/src/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesWidget.java index 73f604d2bc..b5b416eeb1 100644 --- a/uitest/src/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesWidget.java +++ b/uitest/src/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesWidget.java @@ -273,7 +273,7 @@ public class GridBasicClientFeaturesWidget extends }; column.setWidth(50 + c * 25); - column.setHeaderText("Header (0," + c + ")"); + column.setHeaderCaption("Header (0," + c + ")"); grid.addColumn(column); } @@ -289,7 +289,7 @@ public class GridBasicClientFeaturesWidget extends } }; grid.addColumn(column); - column.setHeaderText("Header (0," + c + ")"); + column.setHeaderCaption("Header (0," + c + ")"); } // Some date @@ -303,7 +303,7 @@ public class GridBasicClientFeaturesWidget extends } }; grid.addColumn(column); - column.setHeaderText("Header (0," + c + ")"); + column.setHeaderCaption("Header (0," + c + ")"); } // Row number as a HTML string @@ -317,7 +317,7 @@ public class GridBasicClientFeaturesWidget extends } }; grid.addColumn(column); - column.setHeaderText("Header (0," + c + ")"); + column.setHeaderCaption("Header (0," + c + ")"); } // Random integer value @@ -331,7 +331,7 @@ public class GridBasicClientFeaturesWidget extends } }; grid.addColumn(column); - column.setHeaderText("Header (0," + c + ")"); + column.setHeaderCaption("Header (0," + c + ")"); } // Random integer value between 0 and 5 @@ -345,7 +345,7 @@ public class GridBasicClientFeaturesWidget extends } }; grid.addColumn(column); - column.setHeaderText("Header (0," + c + ")"); + column.setHeaderCaption("Header (0," + c + ")"); } HeaderRow row = grid.getDefaultHeaderRow(); @@ -643,7 +643,7 @@ public class GridBasicClientFeaturesWidget extends addMenuCommand("Text Header", new ScheduledCommand() { @Override public void execute() { - column.setHeaderText("Text Header"); + column.setHeaderCaption("Text Header"); } }, "Component", "Columns", "Column " + i, "Header Type"); addMenuCommand("HTML Header", new ScheduledCommand() { |