Revision 7e488d1b
Added by Andreas Kohlbecker over 6 years ago
- ID 7e488d1bb2f09a0bc4c282c8694b3c1e54bd04ba
- Parent 475ec4ee
src/main/java/eu/etaxonomy/cdm/vaadin/ui/DistributionStatusUI.java | ||
---|---|---|
1 | 1 |
package eu.etaxonomy.cdm.vaadin.ui; |
2 | 2 |
|
3 | 3 |
import org.apache.log4j.Logger; |
4 |
import org.springframework.beans.factory.DisposableBean; |
|
4 | 5 |
import org.springframework.beans.factory.annotation.Autowired; |
5 | 6 |
import org.springframework.context.ApplicationEventPublisher; |
6 | 7 |
|
... | ... | |
8 | 9 |
import com.vaadin.annotations.Title; |
9 | 10 |
import com.vaadin.annotations.Widgetset; |
10 | 11 |
import com.vaadin.navigator.Navigator; |
11 |
import com.vaadin.navigator.View; |
|
12 | 12 |
import com.vaadin.navigator.ViewDisplay; |
13 | 13 |
import com.vaadin.server.Page; |
14 | 14 |
import com.vaadin.server.Responsive; |
... | ... | |
17 | 17 |
import com.vaadin.spring.navigator.SpringViewProvider; |
18 | 18 |
import com.vaadin.ui.UI; |
19 | 19 |
|
20 |
import eu.etaxonomy.cdm.vaadin.security.ReleasableResourcesView; |
|
21 | 20 |
import eu.etaxonomy.cdm.vaadin.view.RedirectToLoginView; |
22 | 21 |
import eu.etaxonomy.cdm.vaadin.view.distributionStatus.DistributionTableViewBean; |
23 | 22 |
import eu.etaxonomy.vaadin.ui.UIInitializedEvent; |
... | ... | |
28 | 27 |
@SpringUI(path="distribution") |
29 | 28 |
@Widgetset("eu.etaxonomy.cdm.vaadin.AppWidgetSet") |
30 | 29 |
@SuppressWarnings("serial") |
31 |
public class DistributionStatusUI extends UI{ |
|
30 |
public class DistributionStatusUI extends UI implements DisposableBean {
|
|
32 | 31 |
|
33 | 32 |
private final static Logger logger = Logger.getLogger(DistributionStatusUI.class); |
34 | 33 |
|
... | ... | |
75 | 74 |
@Override |
76 | 75 |
protected void init(VaadinRequest request) { |
77 | 76 |
|
78 |
addDetachListener(e -> { |
|
79 |
for(String viewName : viewProvider.getViewNamesForCurrentUI()){ |
|
80 |
View view = viewProvider.getView(viewName); |
|
81 |
if(view != null && view instanceof ReleasableResourcesView) { |
|
82 |
((ReleasableResourcesView)view).releaseResourcesOnAccessDenied(); |
|
83 |
} |
|
84 |
} |
|
85 |
|
|
86 |
}); |
|
87 |
|
|
88 | 77 |
configureAccessDeniedView(); |
89 | 78 |
|
90 | 79 |
Responsive.makeResponsive(this); |
... | ... | |
102 | 91 |
navigator.setDefaultViewName(INITIAL_VIEW); |
103 | 92 |
|
104 | 93 |
} |
94 |
|
|
95 |
/** |
|
96 |
* {@inheritDoc} |
|
97 |
*/ |
|
98 |
@Override |
|
99 |
public void destroy() throws Exception { |
|
100 |
navigator.setDefaultViewName(null); |
|
101 |
viewDisplay = null; |
|
102 |
} |
|
105 | 103 |
} |
Also available in: Unified diff
ref #7036 disposing resources in mvp beans