diff options
author | Martin Vysny <martin@vysny.me> | 2019-06-13 15:03:00 +0300 |
---|---|---|
committer | Zhe Sun <31067185+ZheSun88@users.noreply.github.com> | 2019-06-13 15:02:59 +0300 |
commit | d18f8ddbaab2d192dacf7d7485d87b51fe1e7cb9 (patch) | |
tree | aa78b0bfe5a059c6ebca31616020c77b1880a3f6 /uitest/src/main/java/com | |
parent | 4665d366472055c2eeb74dc444346b99b3729ecf (diff) | |
download | vaadin-framework-d18f8ddbaab2d192dacf7d7485d87b51fe1e7cb9.tar.gz vaadin-framework-d18f8ddbaab2d192dacf7d7485d87b51fe1e7cb9.zip |
Improved fix for #11614 (#11618)
* #11614: Added test which demonstrates that the fix is incomplete
* #11614: UI.doRefresh() only calls navigator when the navigation state actually changes
* Added javadoc to Navigator.getCurrentNavigationState()
* Minor: Removed accidental star imports
Diffstat (limited to 'uitest/src/main/java/com')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/components/ui/RefreshUI.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/ui/RefreshUI.java b/uitest/src/main/java/com/vaadin/tests/components/ui/RefreshUI.java index 135a6880f9..997d33ff65 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/ui/RefreshUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/ui/RefreshUI.java @@ -5,7 +5,9 @@ import com.vaadin.navigator.Navigator; import com.vaadin.navigator.View; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; import com.vaadin.ui.Label; +import com.vaadin.ui.UI; import com.vaadin.ui.VerticalLayout; @PreserveOnRefresh @@ -15,7 +17,10 @@ public class RefreshUI extends AbstractTestUI { protected void setup(VaadinRequest request) { final Navigator navigator = new Navigator(this, this); navigator.addView("", MyView.class); + navigator.addView("otherview", OtherView.class); setNavigator(navigator); + MyView.instanceNumber = 0; + OtherView.instanceNumber = 0; } public static class MyView extends VerticalLayout implements View { @@ -24,6 +29,18 @@ public class RefreshUI extends AbstractTestUI { public MyView() { instanceNumber++; addComponent(new Label("This is instance no " + instanceNumber)); + addComponent(new Button("Navigate to otherview", e -> UI + .getCurrent().getNavigator().navigateTo("otherview"))); + } + } + + public static class OtherView extends VerticalLayout implements View { + private static int instanceNumber = 0; + + public OtherView() { + instanceNumber++; + addComponent(new Label( + "This is otherview instance no " + instanceNumber)); } } } |