aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/Slider.java
diff options
context:
space:
mode:
authorHenrik Paul <henrik@vaadin.com>2015-03-31 14:44:23 +0300
committerHenrik Paul <henrik@vaadin.com>2015-03-31 14:44:23 +0300
commit844b2c6c41d57d4db1238eb6096f225c9fdb8314 (patch)
treeffdd57cd35da2df500fbfae5981de381439d1f5c /server/src/com/vaadin/ui/Slider.java
parent2080f86e03552c56d52f488e4dcd72282cd64f62 (diff)
parent3ab82ace45827365e87f9540fad3dffaed0679b5 (diff)
downloadvaadin-framework-844b2c6c41d57d4db1238eb6096f225c9fdb8314.tar.gz
vaadin-framework-844b2c6c41d57d4db1238eb6096f225c9fdb8314.zip
Merge remote-tracking branch 'origin/master' into grid-7.5
Change-Id: Ife8c6d2a5f6c134a6e28e862f524b6e687199cc8
Diffstat (limited to 'server/src/com/vaadin/ui/Slider.java')
-rw-r--r--server/src/com/vaadin/ui/Slider.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/Slider.java b/server/src/com/vaadin/ui/Slider.java
index 99e1e8d5e9..40a4047d53 100644
--- a/server/src/com/vaadin/ui/Slider.java
+++ b/server/src/com/vaadin/ui/Slider.java
@@ -16,9 +16,16 @@
package com.vaadin.ui;
+import java.util.Collection;
+
+import org.jsoup.nodes.Attributes;
+import org.jsoup.nodes.Element;
+
import com.vaadin.shared.ui.slider.SliderOrientation;
import com.vaadin.shared.ui.slider.SliderServerRpc;
import com.vaadin.shared.ui.slider.SliderState;
+import com.vaadin.ui.declarative.DesignAttributeHandler;
+import com.vaadin.ui.declarative.DesignContext;
/**
* A component for selecting a numerical value within a range.
@@ -353,4 +360,35 @@ public class Slider extends AbstractField<Double> {
// Slider is never really "empty"
return false;
}
+
+ @Override
+ public void readDesign(Element design, DesignContext context) {
+ super.readDesign(design, context);
+ Attributes attr = design.attributes();
+ if (attr.hasKey("vertical")) {
+ setOrientation(SliderOrientation.VERTICAL);
+ }
+ if (!attr.get("value").isEmpty()) {
+ setValue(DesignAttributeHandler.readAttribute("value", attr,
+ Double.class));
+ }
+ }
+
+ @Override
+ public void writeDesign(Element design, DesignContext context) {
+ super.writeDesign(design, context);
+ if (getOrientation() == SliderOrientation.VERTICAL) {
+ design.attr("vertical", "");
+ }
+ Slider defaultSlider = context.getDefaultInstance(this);
+ DesignAttributeHandler.writeAttribute(this, "value",
+ design.attributes(), defaultSlider);
+ }
+
+ @Override
+ protected Collection<String> getCustomAttributes() {
+ Collection<String> result = super.getCustomAttributes();
+ result.add("orientation");
+ return result;
+ }
}