aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2018-05-03 15:05:06 +0300
committerIlia Motornyi <elmot@vaadin.com>2018-05-03 15:05:06 +0300
commit3a0512694e402c0056d2899e0865a4a9eeb2d807 (patch)
tree8e2ab1a265147d1f7f59b8c01ec223d77f5000c4
parente2031dc4a9d304ce5aa0c5f75cbd1edd362c2c41 (diff)
downloadvaadin-framework-3a0512694e402c0056d2899e0865a4a9eeb2d807.tar.gz
vaadin-framework-3a0512694e402c0056d2899e0865a4a9eeb2d807.zip
Promote AbstractComponent setStyleName method to Component (#10873)
-rw-r--r--server/src/main/java/com/vaadin/ui/AbstractComponent.java28
-rw-r--r--server/src/main/java/com/vaadin/ui/Component.java28
2 files changed, 28 insertions, 28 deletions
diff --git a/server/src/main/java/com/vaadin/ui/AbstractComponent.java b/server/src/main/java/com/vaadin/ui/AbstractComponent.java
index b86fef894f..d900f34872 100644
--- a/server/src/main/java/com/vaadin/ui/AbstractComponent.java
+++ b/server/src/main/java/com/vaadin/ui/AbstractComponent.java
@@ -255,34 +255,6 @@ public abstract class AbstractComponent extends AbstractClientConnector
}
}
- /**
- * Adds or removes a style name. Multiple styles can be specified as a
- * space-separated list of style names.
- *
- * If the {@code add} parameter is true, the style name is added to the
- * component. If the {@code add} parameter is false, the style name is
- * removed from the component.
- * <p>
- * Functionally this is equivalent to using {@link #addStyleName(String)} or
- * {@link #removeStyleName(String)}
- *
- * @since 7.5
- * @param style
- * the style name to be added or removed
- * @param add
- * <code>true</code> to add the given style, <code>false</code>
- * to remove it
- * @see #addStyleName(String)
- * @see #removeStyleName(String)
- */
- public void setStyleName(String style, boolean add) {
- if (add) {
- addStyleName(style);
- } else {
- removeStyleName(style);
- }
- }
-
/*
* Get's the component's caption. Don't add a JavaDoc comment here, we use
* the default documentation from implemented interface.
diff --git a/server/src/main/java/com/vaadin/ui/Component.java b/server/src/main/java/com/vaadin/ui/Component.java
index acd14886fb..3264ac5070 100644
--- a/server/src/main/java/com/vaadin/ui/Component.java
+++ b/server/src/main/java/com/vaadin/ui/Component.java
@@ -134,6 +134,34 @@ public interface Component extends ClientConnector, Sizeable {
public void setStyleName(String style);
/**
+ * Adds or removes a style name. Multiple styles can be specified as a
+ * space-separated list of style names.
+ *
+ * If the {@code add} parameter is true, the style name is added to the
+ * component. If the {@code add} parameter is false, the style name is
+ * removed from the component.
+ * <p>
+ * Functionally this is equivalent to using {@link #addStyleName(String)} or
+ * {@link #removeStyleName(String)}
+ *
+ * @since 8.5
+ * @param style
+ * the style name to be added or removed
+ * @param add
+ * <code>true</code> to add the given style, <code>false</code>
+ * to remove it
+ * @see #addStyleName(String)
+ * @see #removeStyleName(String)
+ */
+ public default void setStyleName(String style, boolean add) {
+ if (add) {
+ addStyleName(style);
+ } else {
+ removeStyleName(style);
+ }
+ }
+
+ /**
* Adds one or more style names to this component. Multiple styles can be
* specified as a space-separated list of style names. The style name will
* be rendered as a HTML class name, which can be used in a CSS definition.