diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-08-11 15:27:27 +0300 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-08-11 15:27:27 +0300 |
commit | bda7e54cb6eadddf07fb19d88479c642c4831a66 (patch) | |
tree | 4b88c87dd70733cf1c309630c8c2e0e8ca2ad15b /server | |
parent | 9a491b040d5c9d11e227acfdecfa867e5d7cf7d2 (diff) | |
download | vaadin-framework-bda7e54cb6eadddf07fb19d88479c642c4831a66.tar.gz vaadin-framework-bda7e54cb6eadddf07fb19d88479c642c4831a66.zip |
Provide API for setting row heights in Grid for different sections (#9810)
Fixes #9425
Diffstat (limited to 'server')
-rw-r--r-- | server/src/main/java/com/vaadin/ui/Grid.java | 98 |
1 files changed, 92 insertions, 6 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java index 70e947ccd8..1aca35d3ec 100644 --- a/server/src/main/java/com/vaadin/ui/Grid.java +++ b/server/src/main/java/com/vaadin/ui/Grid.java @@ -3012,27 +3012,113 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, } /** - * Sets the height of a row. If -1 (default), the row height is calculated - * based on the theme for an empty row before the Grid is displayed. + * Sets the height of body, header and footer rows. If -1 (default), the row + * height is calculated based on the theme for an empty row before the Grid + * is displayed. * <p> * Note that all header, body and footer rows get the same height if * explicitly set. In automatic mode, each section is calculated separately * based on an empty row of that type. + * + * @see #setBodyRowHeight(double) + * @see #setHeaderRowHeight(double) + * @see #setFooterRowHeight(double) * * @param rowHeight * The height of a row in pixels or -1 for automatic calculation */ public void setRowHeight(double rowHeight) { - getState().rowHeight = rowHeight; + setBodyRowHeight(rowHeight); + setHeaderRowHeight(rowHeight); + setFooterRowHeight(rowHeight); + } + + /** + * Sets the height of a body row. If -1 (default), the row height is + * calculated based on the theme for an empty row before the Grid is + * displayed. + * + * @param rowHeight + * The height of a row in pixels or -1 for automatic calculation + * @since 8.1.2 + */ + public void setBodyRowHeight(double rowHeight) { + getState().bodyRowHeight = rowHeight; + } + + /** + * Sets the height of a header row. If -1 (default), the row height is + * calculated based on the theme for an empty row before the Grid is + * displayed. + * + * @param rowHeight + * The height of a row in pixels or -1 for automatic calculation + * @since 8.1.2 + */ + public void setHeaderRowHeight(double rowHeight) { + getState().headerRowHeight = rowHeight; } /** - * Returns the currently explicitly set row height or -1 if automatic. + * Sets the height of a footer row. If -1 (default), the row height is + * calculated based on the theme for an empty row before the Grid is + * displayed. * - * @return explicitly set row height in pixels or -1 if in automatic mode + * @param rowHeight + * The height of a row in pixels or -1 for automatic calculation + * @since 8.1.2 */ + public void setFooterRowHeight(double rowHeight) { + getState().footerRowHeight = rowHeight; + } + + /** + * Returns the current body row height.-1 if row height is in automatic + * calculation mode. + * + * @see #getBodyRowHeight() + * @see #getHeaderRowHeight() + * @see #getFooterRowHeight() + * + * @return body row height + * @deprecated replaced by three separate row height controls + */ + @Deprecated public double getRowHeight() { - return getState(false).rowHeight; + return getBodyRowHeight(); + } + + /** + * Returns the current body row height. -1 if row height is in automatic + * calculation mode. + * + * @return body row height + * @since 8.1.2 + */ + public double getBodyRowHeight() { + return getState(false).bodyRowHeight; + } + + /** + * Returns the current header row height. -1 if row height is in automatic + * calculation mode. + * + * @return header row height + * @since 8.1.2 + */ + public double getHeaderRowHeight() { + return getState(false).headerRowHeight; + } + + /** + * Returns the current footer row height. -1 if row height is in automatic + * calculation mode. + * + * @return footer row height + * @since 8.1.2 + */ + public double getFooterRowHeight() { + return getState(false).footerRowHeight; } /** |