aboutsummaryrefslogtreecommitdiffstats
path: root/client/src/main
diff options
context:
space:
mode:
authorAnastasia Smirnova <anasmi@utu.fi>2018-04-13 17:48:27 +0300
committerIlia Motornyi <elmot@vaadin.com>2018-04-13 17:48:27 +0300
commit1719e35ae9377075f26f0daab6e7e2c789186ac0 (patch)
treeb51fb5af27997c0d996d04cf73ce70261c681a4b /client/src/main
parentda8f5adcae46ba7533578b4d8a9e5e1ac5dfe536 (diff)
downloadvaadin-framework-1719e35ae9377075f26f0daab6e7e2c789186ac0.tar.gz
vaadin-framework-1719e35ae9377075f26f0daab6e7e2c789186ac0.zip
Fix incorrect color value handling in ColorPicker (#10812)
Diffstat (limited to 'client/src/main')
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VColorPicker.java10
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VColorPickerArea.java11
-rw-r--r--client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerConnector.java1
-rw-r--r--client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGradient.java5
4 files changed, 26 insertions, 1 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VColorPicker.java b/client/src/main/java/com/vaadin/client/ui/VColorPicker.java
index ddae5bdc72..c525eaabab 100644
--- a/client/src/main/java/com/vaadin/client/ui/VColorPicker.java
+++ b/client/src/main/java/com/vaadin/client/ui/VColorPicker.java
@@ -48,6 +48,16 @@ public class VColorPicker extends VButton {
}
/**
+ * Gets the color.
+ *
+ * @since
+ * @return the color
+ */
+ public String getColor() {
+ return color;
+ }
+
+ /**
* Mark the popup opened/closed.
*
* @param open
diff --git a/client/src/main/java/com/vaadin/client/ui/VColorPickerArea.java b/client/src/main/java/com/vaadin/client/ui/VColorPickerArea.java
index e10f49d00c..a1b6a8de34 100644
--- a/client/src/main/java/com/vaadin/client/ui/VColorPickerArea.java
+++ b/client/src/main/java/com/vaadin/client/ui/VColorPickerArea.java
@@ -77,6 +77,7 @@ public class VColorPickerArea extends Widget
@Override
public void onClick(ClickEvent event) {
setOpen(!isOpen);
+ refreshColor();
}
@Override
@@ -164,6 +165,16 @@ public class VColorPickerArea extends Widget
}
/**
+ * Gets the color.
+ *
+ * @since
+ * @return the color
+ */
+ public String getColor() {
+ return color;
+ }
+
+ /**
* Update the color area with the currently set color.
*/
public void refreshColor() {
diff --git a/client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerConnector.java b/client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerConnector.java
index 9a25e5da2d..6b3f21111e 100644
--- a/client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerConnector.java
+++ b/client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerConnector.java
@@ -66,6 +66,7 @@ public class ColorPickerConnector extends AbstractColorPickerConnector {
@Override
protected void refreshColor() {
getWidget().refreshColor();
+ rpc.changeColor(getWidget().getColor());
}
@Override
diff --git a/client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGradient.java b/client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGradient.java
index 3113849e10..d3d0e84e93 100644
--- a/client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGradient.java
+++ b/client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGradient.java
@@ -176,8 +176,9 @@ public class VColorPickerGradient extends FocusPanel implements
}
if (y >= 0) {
lowercross.getElement().getStyle().setHeight(height - y, Unit.PX);
+ } else {
+ lowercross.getElement().getStyle().setHeight(Math.abs(y), Unit.PX);
}
-
if (x >= 0) {
highercross.getElement().getStyle().setWidth(width - x, Unit.PX);
}
@@ -186,6 +187,8 @@ public class VColorPickerGradient extends FocusPanel implements
}
if (y >= 0) {
highercross.getElement().getStyle().setHeight(y, Unit.PX);
+ } else {
+ highercross.getElement().getStyle().setHeight(height + y, Unit.PX);
}
}