Revision 157460f4
Added by Andreas Kohlbecker about 7 years ago
src/main/java/com/vaadin/devday/ui/navigation/NavigationManagerBean.java | ||
---|---|---|
5 | 5 |
|
6 | 6 |
import org.springframework.beans.factory.annotation.Autowired; |
7 | 7 |
import org.springframework.context.ApplicationEventPublisher; |
8 |
import org.springframework.context.annotation.Lazy; |
|
8 | 9 |
import org.springframework.context.event.EventListener; |
9 | 10 |
|
10 | 11 |
import com.vaadin.devday.ui.NavigationManager; |
... | ... | |
13 | 14 |
import com.vaadin.devday.ui.view.PopupView; |
14 | 15 |
import com.vaadin.navigator.ViewChangeListener; |
15 | 16 |
import com.vaadin.navigator.ViewDisplay; |
16 |
import com.vaadin.spring.annotation.SpringComponent; |
|
17 | 17 |
import com.vaadin.spring.annotation.UIScope; |
18 | 18 |
import com.vaadin.spring.navigator.SpringNavigator; |
19 | 19 |
import com.vaadin.spring.navigator.SpringViewProvider; |
20 | 20 |
import com.vaadin.ui.UI; |
21 | 21 |
import com.vaadin.ui.Window; |
22 | 22 |
|
23 |
@SpringComponent |
|
24 | 23 |
@UIScope |
25 |
class NavigationManagerBean extends SpringNavigator implements NavigationManager { |
|
24 |
public class NavigationManagerBean extends SpringNavigator implements NavigationManager {
|
|
26 | 25 |
|
27 | 26 |
private static final long serialVersionUID = 6599898650948333853L; |
28 | 27 |
|
... | ... | |
44 | 43 |
//@Autowired |
45 | 44 |
private Map<String, PopupView> popupViews = null; |
46 | 45 |
|
47 |
@Autowired |
|
46 |
/* |
|
47 |
* Why UriFragmentManager must be initialized lazily: |
|
48 |
* |
|
49 |
* when the SpringVaadinServlet usually is being instantiated the ServletUIInitHandler(UIInitHandler).getBrowserDetailsUI(VaadinRequest, VaadinSession) method is called which will |
|
50 |
* first cause the WebapplicationContext being created. Once this is done the initialization of the UI classes is completed. This means that the UI classes are not readily available |
|
51 |
* via Page.getCurrent() which is used in the UriFragmentManager constructor. The NavigationManagerBean is initialized with the WebapplicationContext, that is when the current ui is |
|
52 |
* not yet available, therefore the UriFragmentManager must be initialized lazily. |
|
53 |
*/ |
|
54 |
@Autowired |
|
55 |
@Lazy |
|
48 | 56 |
private UriFragmentManager uriFragmentManager; |
49 | 57 |
|
58 |
|
|
59 |
// public void setUriFragmentManager(UriFragmentManager uriFragmentManager) { |
|
60 |
// this.uriFragmentManager = uriFragmentManager; |
|
61 |
// } |
|
62 |
|
|
50 | 63 |
@Autowired |
51 | 64 |
ApplicationEventPublisher eventBus; |
52 | 65 |
|
Also available in: Unified diff
working NavigationManagerBean, easier VaadinSpringNavigatorConfiguration, disabling MenuBeanDiscoveryBean