]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed styles that were left lingering while changing the orientation of a slider...
authorTapio Aali <tapio@vaadin.com>
Wed, 23 May 2012 09:01:22 +0000 (09:01 +0000)
committerTapio Aali <tapio@vaadin.com>
Wed, 23 May 2012 09:01:22 +0000 (09:01 +0000)
svn changeset:23813/svn branch:6.8

src/com/vaadin/terminal/gwt/client/ui/VSlider.java
tests/testbench/com/vaadin/tests/components/slider/SliderOrientation.html [new file with mode: 0644]

index 4a463466138411df12b9b226a9711f5afdcdd69b..e605c6fe1272f9ccf9576e8b0d83f3b3e875785a 100644 (file)
@@ -200,8 +200,12 @@ public class VSlider extends SimpleFocusablePanel implements Paintable, Field,
 
     private void buildBase() {
         final String styleAttribute = vertical ? "height" : "width";
+        final String oppositeStyleAttribute = vertical ? "width" : "height";
         final String domProperty = vertical ? "offsetHeight" : "offsetWidth";
 
+        // clear unnecessary opposite style attribute
+        DOM.setStyleAttribute(base, oppositeStyleAttribute, "");
+
         final Element p = DOM.getParent(getElement());
         if (DOM.getElementPropertyInt(p, domProperty) > 50) {
             if (vertical) {
@@ -235,10 +239,15 @@ public class VSlider extends SimpleFocusablePanel implements Paintable, Field,
     private void buildHandle() {
         final String styleAttribute = vertical ? "height" : "width";
         final String handleAttribute = vertical ? "marginTop" : "marginLeft";
+        final String oppositeHandleAttribute = vertical ? "marginLeft"
+                : "marginTop";
         final String domProperty = vertical ? "offsetHeight" : "offsetWidth";
 
         DOM.setStyleAttribute(handle, handleAttribute, "0");
 
+        // clear unnecessary opposite handle attribute
+        DOM.setStyleAttribute(handle, oppositeHandleAttribute, "");
+
         if (scrollbarStyle) {
             // Only stretch the handle if scrollbar style is set.
             int s = (int) (Double.parseDouble(DOM.getElementProperty(base,
@@ -356,7 +365,7 @@ public class VSlider extends SimpleFocusablePanel implements Paintable, Field,
         } else if (DOM.eventGetType(event) == Event.ONMOUSEDOWN) {
             feedbackPopup.show();
         }
-        if(Util.isTouchEvent(event)) {
+        if (Util.isTouchEvent(event)) {
             event.preventDefault(); // avoid simulated events
             event.stopPropagation();
         }
diff --git a/tests/testbench/com/vaadin/tests/components/slider/SliderOrientation.html b/tests/testbench/com/vaadin/tests/components/slider/SliderOrientation.html
new file mode 100644 (file)
index 0000000..174ddca
--- /dev/null
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>SliderOrientation</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">SliderOrientation</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.components.slider.SliderTest?restartApplication</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssliderSliderTest::PID_Smenu#item0</td>
+       <td>5,6</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssliderSliderTest::Root/VOverlay[0]/VMenuBar[0]#item4</td>
+       <td>41,7</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssliderSliderTest::Root/VOverlay[1]/VMenuBar[0]#item3</td>
+       <td>37,3</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssliderSliderTest::Root/VOverlay[2]/VMenuBar[0]#item1</td>
+       <td>19,7</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td>change-orientation-to-vertical</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssliderSliderTest::PID_Smenu#item0</td>
+       <td>33,1</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssliderSliderTest::Root/VOverlay[0]/VMenuBar[0]#item4</td>
+       <td>63,11</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssliderSliderTest::Root/VOverlay[1]/VMenuBar[0]#item3</td>
+       <td>30,1</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentssliderSliderTest::Root/VOverlay[2]/VMenuBar[0]#item0</td>
+       <td>10,10</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td>change-orientation-to-horizontal</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>