summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Lange <lange.fabian@gmail.com>2014-07-01 13:31:08 +0200
committerSauli Tähkäpää <sauli@vaadin.com>2014-07-01 15:48:30 +0300
commit0ceccae58fb7fbeac867b79766e3bf8296d9e075 (patch)
tree0f403aabc9890d0ffcff231067ea94b6c5a9c7a2
parent264e617c58d537d12a03b5f3fb73f5129fcadc09 (diff)
downloadvaadin-framework-0ceccae58fb7fbeac867b79766e3bf8296d9e075.tar.gz
vaadin-framework-0ceccae58fb7fbeac867b79766e3bf8296d9e075.zip
Reading properties of components should not set state to dirty (#14060).
Fixed issue with SplitPanels which were not marking sets as dirty. Change-Id: I23bb8bfca87a825aef132f249e05871cf7b36a34
-rw-r--r--server/src/com/vaadin/ui/AbstractSplitPanel.java20
-rw-r--r--uitest/src/com/vaadin/tests/components/window/WindowMoveListenerTest.java26
2 files changed, 28 insertions, 18 deletions
diff --git a/server/src/com/vaadin/ui/AbstractSplitPanel.java b/server/src/com/vaadin/ui/AbstractSplitPanel.java
index 1c69ebf87e..09f881cf46 100644
--- a/server/src/com/vaadin/ui/AbstractSplitPanel.java
+++ b/server/src/com/vaadin/ui/AbstractSplitPanel.java
@@ -335,7 +335,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer {
* @return position of the splitter
*/
public float getSplitPosition() {
- return getSplitterState().position;
+ return getSplitterState(false).position;
}
/**
@@ -358,7 +358,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer {
* Allowed units are UNITS_PERCENTAGE and UNITS_PIXELS
*/
public void setMinSplitPosition(float pos, Unit unit) {
- setSplitPositionLimits(pos, unit, getSplitterState().maxPosition,
+ setSplitPositionLimits(pos, unit, getSplitterState(false).maxPosition,
posMaxUnit);
}
@@ -369,7 +369,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer {
* @return the minimum position of the splitter
*/
public float getMinSplitPosition() {
- return getSplitterState().minPosition;
+ return getSplitterState(false).minPosition;
}
/**
@@ -392,8 +392,8 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer {
* Allowed units are UNITS_PERCENTAGE and UNITS_PIXELS
*/
public void setMaxSplitPosition(float pos, Unit unit) {
- setSplitPositionLimits(getSplitterState().minPosition, posMinUnit, pos,
- unit);
+ setSplitPositionLimits(getSplitterState(false).minPosition, posMinUnit,
+ pos, unit);
}
/**
@@ -403,7 +403,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer {
* @return the maximum position of the splitter
*/
public float getMaxSplitPosition() {
- return getSplitterState().maxPosition;
+ return getSplitterState(false).maxPosition;
}
/**
@@ -467,7 +467,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer {
* @return <code>true</code> if locked, <code>false</code> otherwise.
*/
public boolean isLocked() {
- return getSplitterState().locked;
+ return getSplitterState(false).locked;
}
/**
@@ -540,6 +540,10 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer {
}
private SplitterState getSplitterState() {
- return getState(false).splitterState;
+ return ((AbstractSplitPanelState) super.getState()).splitterState;
+ }
+
+ private SplitterState getSplitterState(boolean markAsDirty) {
+ return ((AbstractSplitPanelState) super.getState(markAsDirty)).splitterState;
}
}
diff --git a/uitest/src/com/vaadin/tests/components/window/WindowMoveListenerTest.java b/uitest/src/com/vaadin/tests/components/window/WindowMoveListenerTest.java
index 5502bf0495..a2b5e0f139 100644
--- a/uitest/src/com/vaadin/tests/components/window/WindowMoveListenerTest.java
+++ b/uitest/src/com/vaadin/tests/components/window/WindowMoveListenerTest.java
@@ -1,16 +1,16 @@
package com.vaadin.tests.components.window;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-
+import com.vaadin.tests.tb3.MultiBrowserTest;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Point;
+import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.support.ui.ExpectedCondition;
-import com.vaadin.tests.tb3.MultiBrowserTest;
+import static org.junit.Assert.assertNotEquals;
public class WindowMoveListenerTest extends MultiBrowserTest {
@@ -18,7 +18,7 @@ public class WindowMoveListenerTest extends MultiBrowserTest {
public void testWindowRepositioning() throws Exception {
openTestURL();
- WebElement window = getDriver().findElement(By.id("testwindow"));
+ final WebElement window = getDriver().findElement(By.id("testwindow"));
WebElement button = getDriver().findElement(By.id("testbutton"));
// I'd loved to use the header, but that doesn't work. Footer works
@@ -26,7 +26,7 @@ public class WindowMoveListenerTest extends MultiBrowserTest {
WebElement windowHeader = getDriver().findElement(
By.className("v-window-footer"));
- Point winPos = window.getLocation();
+ final Point winPos = window.getLocation();
// move window
Action a = new Actions(driver).clickAndHold(windowHeader)
@@ -41,10 +41,16 @@ public class WindowMoveListenerTest extends MultiBrowserTest {
// re-set window
button.click();
- assertEquals("Window was not re-positioned correctly.", winPos.x,
- window.getLocation().x);
- assertEquals("Window was not re-positioned correctly.", winPos.y,
- window.getLocation().y);
+ waitUntilWindowHasReseted(window, winPos);
+ }
+ private void waitUntilWindowHasReseted(final WebElement window, final Point winPos) {
+ waitUntil(new ExpectedCondition<Boolean>() {
+ @Override
+ public Boolean apply(WebDriver input) {
+ return winPos.x == window.getLocation().x &&
+ winPos.y == window.getLocation().y;
+ }
+ }, 5);
}
}