diff options
author | Denis <denis@vaadin.com> | 2017-02-08 14:55:11 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-02-08 14:55:11 +0200 |
commit | 40ab6dc0397f697001c3e05820863680fcac2e73 (patch) | |
tree | b581899128d4a3361de93bfde27ab3a5755549ca /server | |
parent | 0f97714b635174e4eabfbb5a708ffb366bfcadb4 (diff) | |
download | vaadin-framework-40ab6dc0397f697001c3e05820863680fcac2e73.tar.gz vaadin-framework-40ab6dc0397f697001c3e05820863680fcac2e73.zip |
Provide a way to set styles for Header/Footer Cells and Rows in a Grid (#8499)
Fixes #8422
Diffstat (limited to 'server')
5 files changed, 100 insertions, 0 deletions
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/FooterCell.java b/server/src/main/java/com/vaadin/ui/components/grid/FooterCell.java index 092637c891..d9777cbb77 100644 --- a/server/src/main/java/com/vaadin/ui/components/grid/FooterCell.java +++ b/server/src/main/java/com/vaadin/ui/components/grid/FooterCell.java @@ -87,4 +87,19 @@ public interface FooterCell extends Serializable { * @return column id for this cell */ public String getColumnId(); + + /** + * Returns the custom style name for this cell. + * + * @return the style name or null if no style name has been set + */ + public String getStyleName(); + + /** + * Sets a custom style name for this cell. + * + * @param styleName + * the style name to set or null to not use any style name + */ + public void setStyleName(String styleName); } diff --git a/server/src/main/java/com/vaadin/ui/components/grid/FooterRow.java b/server/src/main/java/com/vaadin/ui/components/grid/FooterRow.java index 1234c270e3..42e4650471 100644 --- a/server/src/main/java/com/vaadin/ui/components/grid/FooterRow.java +++ b/server/src/main/java/com/vaadin/ui/components/grid/FooterRow.java @@ -115,4 +115,19 @@ public interface FooterRow extends Serializable { * @see Column#setId(String) */ FooterCell join(String... columnIdsToMerge); + + /** + * Returns the custom style name for this row. + * + * @return the style name or null if no style name has been set + */ + public String getStyleName(); + + /** + * Sets a custom style name for this row. + * + * @param styleName + * the style name to set or null to not use any style name + */ + public void setStyleName(String styleName); } diff --git a/server/src/main/java/com/vaadin/ui/components/grid/HeaderCell.java b/server/src/main/java/com/vaadin/ui/components/grid/HeaderCell.java index 741ea96617..6801622740 100644 --- a/server/src/main/java/com/vaadin/ui/components/grid/HeaderCell.java +++ b/server/src/main/java/com/vaadin/ui/components/grid/HeaderCell.java @@ -87,4 +87,19 @@ public interface HeaderCell extends Serializable { * @return column id for this cell */ public String getColumnId(); + + /** + * Returns the custom style name for this cell. + * + * @return the style name or null if no style name has been set + */ + public String getStyleName(); + + /** + * Sets a custom style name for this cell. + * + * @param styleName + * the style name to set or null to not use any style name + */ + public void setStyleName(String styleName); } diff --git a/server/src/main/java/com/vaadin/ui/components/grid/HeaderRow.java b/server/src/main/java/com/vaadin/ui/components/grid/HeaderRow.java index a25d6f2595..f11843e147 100644 --- a/server/src/main/java/com/vaadin/ui/components/grid/HeaderRow.java +++ b/server/src/main/java/com/vaadin/ui/components/grid/HeaderRow.java @@ -115,4 +115,19 @@ public interface HeaderRow extends Serializable { * @see Column#setId(String) */ HeaderCell join(String... columnIdsToMerge); + + /** + * Returns the custom style name for this row. + * + * @return the style name or null if no style name has been set + */ + public String getStyleName(); + + /** + * Sets a custom style name for this row. + * + * @param styleName + * the style name to set or null to not use any style name + */ + public void setStyleName(String styleName); } diff --git a/server/src/main/java/com/vaadin/ui/components/grid/StaticSection.java b/server/src/main/java/com/vaadin/ui/components/grid/StaticSection.java index b621f09ad0..c53cc9c976 100644 --- a/server/src/main/java/com/vaadin/ui/components/grid/StaticSection.java +++ b/server/src/main/java/com/vaadin/ui/components/grid/StaticSection.java @@ -205,6 +205,25 @@ public abstract class StaticSection<ROW extends StaticSection.StaticRow<?>> } /** + * Returns the custom style name for this row. + * + * @return the style name or null if no style name has been set + */ + public String getStyleName() { + return getRowState().styleName; + } + + /** + * Sets a custom style name for this row. + * + * @param styleName + * the style name to set or null to not use any style name + */ + public void setStyleName(String styleName) { + getRowState().styleName = styleName; + } + + /** * Returns the cell in this section that corresponds to the given * internal column id. * @@ -515,6 +534,27 @@ public abstract class StaticSection<ROW extends StaticSection.StaticRow<?>> public GridStaticCellType getCellType() { return cellState.type; } + + /** + * Returns the custom style name for this cell. + * + * @return the style name or null if no style name has been set + */ + public String getStyleName() { + return cellState.styleName; + } + + /** + * Sets a custom style name for this cell. + * + * @param styleName + * the style name to set or null to not use any style + * name + */ + public void setStyleName(String styleName) { + cellState.styleName = styleName; + row.section.markAsDirty(); + } /** * Reads the declarative design from the given table cell element. |