summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorappreciated <goebeljohannes@gmx.net>2017-06-29 09:37:06 +0200
committerIlia Motornyi <elmot@vaadin.com>2017-06-29 10:37:06 +0300
commit415bdf9e697249653382fd4a2f77aedb133db6a1 (patch)
tree196ebb100f2ab9a8af53256e476e88a443e735f4 /server
parent9c3868e897541c014e19341f3d58066734f8a6c0 (diff)
downloadvaadin-framework-415bdf9e697249653382fd4a2f77aedb133db6a1.tar.gz
vaadin-framework-415bdf9e697249653382fd4a2f77aedb133db6a1.zip
Add multiple styles handling to Component
Fixes #9357
Diffstat (limited to 'server')
-rw-r--r--server/src/main/java/com/vaadin/ui/Component.java30
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.