Project

General

Profile

« Previous | Next » 

Revision 000bee0d

Added by Andreas Kohlbecker over 6 years ago

default view configurable in NavigationManagerBean & login cancel buttons navigate to default view

View differences:

src/main/java/eu/etaxonomy/vaadin/ui/navigation/NavigationManagerBean.java
74 74

  
75 75
	private Map<PopupView, Window> popupMap;
76 76

  
77
	public NavigationManagerBean() {
78
		popupMap = new HashMap<>();
79
	}
80

  
81

  
82
    private <P extends PopupView> PopupView findPopupView(Class<P> popupViewClass){
83
        return popupEditorFactory.newPopupView(popupViewClass);
84
    }
77
	private String defaultViewName = null;
85 78

  
86 79
    /*
87 80
     * Why UriFragmentManager must be initialized lazily:
......
103 96
	@Autowired
104 97
	ApplicationEventPublisher eventBus;
105 98

  
99

  
100
	public NavigationManagerBean() {
101
	    popupMap = new HashMap<>();
102
	}
103

  
104

  
105
	private <P extends PopupView> PopupView findPopupView(Class<P> popupViewClass){
106
	    return popupEditorFactory.newPopupView(popupViewClass);
107
	}
108

  
106 109
	@EventListener
107 110
	protected void onUIInitialized(UIInitializedEvent e) {
108 111
		init(UI.getCurrent(), uriFragmentManager, viewDisplay);
......
110 113
	}
111 114

  
112 115
	public void navigateTo(String navigationState, boolean fireNavigationEvent) {
116
	    if(navigationState == null){
117
            navigationState = defaultViewName;
118
        }
113 119
		if (fireNavigationEvent) {
114 120
			navigateTo(navigationState);
115 121
		} else {
......
119 125

  
120 126
	@Override
121 127
	public void navigateTo(String navigationState) {
128
	    if(navigationState == null){
129
	        navigationState = defaultViewName;
130
	    }
122 131
		super.navigateTo(navigationState);
123 132
		//eventBus.publishEvent(new NavigationEvent(navigationState));
124 133
	}
......
198 207
     */
199 208
    @Override
200 209
    public String getCurrentViewName() {
201
        SpringView springViewAnnotation = getCurrentView().getClass().getAnnotation(SpringView.class);
202
        if(springViewAnnotation != null){
203
            return springViewAnnotation.name();
210
        if(getCurrentView() != null){
211
            SpringView springViewAnnotation = getCurrentView().getClass().getAnnotation(SpringView.class);
212
            if(springViewAnnotation != null){
213
                return springViewAnnotation.name();
214
            }
204 215
        }
205 216
        return null;
206 217
    }
......
224 235
        // TODO Auto-generated method stub
225 236
        return null;
226 237
    }
238

  
239

  
240
    /**
241
     * @return the defaultViewName
242
     */
243
    public String getDefaultViewName() {
244
        return defaultViewName;
245
    }
246

  
247

  
248
    /**
249
     * @param defaultViewName the defaultViewName to set
250
     */
251
    public void setDefaultViewName(String defaultViewName) {
252
        this.defaultViewName = defaultViewName;
253
    }
227 254
}

Also available in: Unified diff