summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/src/com/vaadin/navigator/Navigator.java6
-rw-r--r--server/tests/src/com/vaadin/tests/server/navigator/NavigatorTest.java19
2 files changed, 22 insertions, 3 deletions
diff --git a/server/src/com/vaadin/navigator/Navigator.java b/server/src/com/vaadin/navigator/Navigator.java
index 4b2474a0f2..811a09fcfb 100644
--- a/server/src/com/vaadin/navigator/Navigator.java
+++ b/server/src/com/vaadin/navigator/Navigator.java
@@ -497,13 +497,13 @@ public class Navigator implements Serializable {
}
}
- view.enter(event);
- currentView = view;
-
if (display != null) {
display.showView(view);
}
+ view.enter(event);
+ currentView = view;
+
fireAfterViewChange(event);
}
diff --git a/server/tests/src/com/vaadin/tests/server/navigator/NavigatorTest.java b/server/tests/src/com/vaadin/tests/server/navigator/NavigatorTest.java
index 218791e454..b090bc5e35 100644
--- a/server/tests/src/com/vaadin/tests/server/navigator/NavigatorTest.java
+++ b/server/tests/src/com/vaadin/tests/server/navigator/NavigatorTest.java
@@ -691,6 +691,25 @@ public class NavigatorTest extends TestCase {
navigator.setErrorProvider(errorProvider);
navigator.navigateTo("doesnotexist2");
+ }
+
+ public void testShowViewEnterOrder() {
+ IMocksControl control = EasyMock.createStrictControl();
+
+ View view = control.createMock(View.class);
+ ViewDisplay display = control.createMock(ViewDisplay.class);
+
+ display.showView(view);
+ view.enter(EasyMock.anyObject(ViewChangeEvent.class));
+
+ control.replay();
+
+ NavigationStateManager manager = EasyMock
+ .createNiceMock(NavigationStateManager.class);
+ EasyMock.replay(manager);
+ Navigator navigator = new Navigator(createMockUI(), manager, display);
+ navigator.addView("view", view);
+ navigator.navigateTo("view");
}
}