diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/src/main/java/com/vaadin/ui/Component.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Component.java b/server/src/main/java/com/vaadin/ui/Component.java index 28cb7be95e..41e51ff63f 100644 --- a/server/src/main/java/com/vaadin/ui/Component.java +++ b/server/src/main/java/com/vaadin/ui/Component.java @@ -172,6 +172,21 @@ public interface Component extends ClientConnector, Sizeable, Serializable { */ public void addStyleName(String style); + + /** + * Adds one or more style names to this component by using one or multiple parameters. + * @param styles + * the style name or style names to be added to the component + * @see #addStyleName(String) + * @see #setStyleName(String) + * @see #removeStyleName(String) + */ + public default void addStyleNames(String ... styles) { + for (String style : styles) { + addStyleName(style); + } + } + /** * Removes one or more style names from component. Multiple styles can be * specified as a space-separated list of style names. @@ -192,6 +207,21 @@ public interface Component extends ClientConnector, Sizeable, Serializable { public void removeStyleName(String style); /** + * Removes one or more style names from component. Multiple styles can be + * specified by using multiple parameters. + * @param styles + * the style name or style names to be removed + * @see #removeStyleName(String) + * @see #setStyleName(String) + * @see #addStyleName(String) + */ + public default void removeStyleNames(String ... styles) { + for (String style : styles) { + removeStyleName(style); + } + } + + /** * Gets the primary style name of the component. See * {@link Component#setPrimaryStyleName(String)} for a better description of * the primary stylename. |