]> source.dussan.org Git - vaadin-framework.git/commitdiff
Call ViewDisplay.showView before View.enter in Navigator.navigateTo (#10132) 42/242/1
authorJohannes Dahlström <johannesd@vaadin.com>
Mon, 12 Nov 2012 10:52:17 +0000 (12:52 +0200)
committerJohannes Dahlström <johannesd@vaadin.com>
Mon, 12 Nov 2012 10:52:17 +0000 (12:52 +0200)
Change-Id: I48ecb305166557f1671bdd635c25f17b8f490297

server/src/com/vaadin/navigator/Navigator.java
server/tests/src/com/vaadin/tests/server/navigator/NavigatorTest.java

index 4b2474a0f28c50a3872c3b07d3a2c4d865cb14ed..811a09fcfbfa5ac776ee45f4835ea507632e2533 100644 (file)
@@ -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);
     }
 
index 218791e4540191a28af3b98098ccdbd5e24fa77a..b090bc5e35aaea8a8063b5d0e608ff10a537297f 100644 (file)
@@ -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");
     }
 }