Revision be4a9789
Added by Andreas Kohlbecker about 6 years ago
pom.xml | ||
---|---|---|
11 | 11 |
<vaadin.version>7.7.10</vaadin.version> |
12 | 12 |
<vaadin-spring.version>1.2.0</vaadin-spring.version> |
13 | 13 |
<vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version> |
14 |
<vaadin-spring-addon-eventbus.version>2.0.0.RELEASE</vaadin-spring-addon-eventbus.version> |
|
14 | 15 |
<cdmlib.version>4.14.0-SNAPSHOT</cdmlib.version> |
15 | 16 |
<unitils.version>3.4.2</unitils.version> |
16 | 17 |
<!-- |
... | ... | |
410 | 411 |
<artifactId>vaadin-spring</artifactId> |
411 | 412 |
<version>${vaadin-spring.version}</version> |
412 | 413 |
</dependency> |
414 |
<dependency> |
|
415 |
<groupId>org.vaadin.spring.addons</groupId> |
|
416 |
<artifactId>vaadin-spring-addon-eventbus</artifactId> |
|
417 |
<version>${vaadin-spring-addon-eventbus.version}</version> |
|
418 |
</dependency> |
|
413 | 419 |
<dependency> |
414 | 420 |
<groupId>com.vaadin</groupId> |
415 | 421 |
<artifactId>vaadin-server</artifactId> |
src/main/java/eu/etaxonomy/cdm/addon/config/CdmVaadinConfiguration.java | ||
---|---|---|
31 | 31 |
import org.springframework.context.annotation.FilterType; |
32 | 32 |
import org.springframework.core.env.Environment; |
33 | 33 |
import org.springframework.security.authentication.AuthenticationProvider; |
34 |
import org.vaadin.spring.events.annotation.EnableEventBus; |
|
34 | 35 |
|
35 | 36 |
import com.vaadin.spring.annotation.EnableVaadin; |
36 | 37 |
import com.vaadin.spring.annotation.SpringUI; |
... | ... | |
77 | 78 |
@EnableVaadin // this imports VaadinConfiguration |
78 | 79 |
@EnableVaadinSpringNavigation // activate the NavigationManagerBean |
79 | 80 |
@EnableAnnotationBasedAccessControl // enable annotation based per view access control |
81 |
@EnableEventBus // enable the vaadin spring event bus |
|
80 | 82 |
public class CdmVaadinConfiguration implements ApplicationContextAware { |
81 | 83 |
|
82 | 84 |
|
src/main/java/eu/etaxonomy/cdm/vaadin/component/DistributionToolbar.java | ||
---|---|---|
6 | 6 |
|
7 | 7 |
import org.springframework.beans.factory.annotation.Autowired; |
8 | 8 |
import org.springframework.beans.factory.annotation.Qualifier; |
9 |
import org.springframework.context.ApplicationEventPublisher;
|
|
10 |
import org.springframework.context.event.EventListener;
|
|
9 |
import org.vaadin.spring.events.EventBus;
|
|
10 |
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
|
11 | 11 |
|
12 | 12 |
import com.vaadin.server.FontAwesome; |
13 | 13 |
import com.vaadin.server.ThemeResource; |
... | ... | |
33 | 33 |
*/ |
34 | 34 |
private static final long serialVersionUID = 5344340511582993289L; |
35 | 35 |
|
36 |
private EventBus.UIEventBus uiEventBus; |
|
37 |
|
|
36 | 38 |
@Autowired |
37 |
protected ApplicationEventPublisher eventBus; |
|
39 |
private final void setViewEventBus(EventBus.UIEventBus viewEventBus){ |
|
40 |
this.uiEventBus = viewEventBus; |
|
41 |
viewEventBus.subscribe(AuthenticationSuccessEvent.class); |
|
42 |
} |
|
38 | 43 |
|
39 | 44 |
@Autowired |
40 | 45 |
@Qualifier("cdmRepository") |
... | ... | |
101 | 106 |
updateAuthenticationButtons(); |
102 | 107 |
} |
103 | 108 |
|
104 |
@EventListener
|
|
105 |
public void onAuthenticationSuccessEvent(AuthenticationSuccessEvent event){
|
|
109 |
@EventBusListenerMethod
|
|
110 |
public void onAuthenticationSuccessEvent(org.vaadin.spring.events.Event<AuthenticationSuccessEvent> event){
|
|
106 | 111 |
boolean isInitialized = userButton != null; |
107 | 112 |
// The RegistrationToolbar is being initialize even if not needed only because it is a EventListener |
108 | 113 |
// which causes Spring to initialize it. |
... | ... | |
143 | 148 |
* @return |
144 | 149 |
*/ |
145 | 150 |
private void performLogin() { |
146 |
eventBus.publishEvent(new NavigationEvent("login", navigationManager.getCurrentViewName())); //$NON-NLS-1$
|
|
151 |
uiEventBus.publish(this, new NavigationEvent("login", navigationManager.getCurrentViewName())); //$NON-NLS-1$
|
|
147 | 152 |
} |
148 | 153 |
|
149 | 154 |
|
... | ... | |
172 | 177 |
public Button getDetailButton() { |
173 | 178 |
return detailButton; |
174 | 179 |
} |
180 |
|
|
175 | 181 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/RegistrationItem.java | ||
---|---|---|
15 | 15 |
|
16 | 16 |
import org.joda.time.DateTime; |
17 | 17 |
import org.joda.time.format.ISODateTimeFormat; |
18 |
import org.vaadin.spring.events.EventScope; |
|
18 | 19 |
|
19 | 20 |
import com.vaadin.server.ExternalResource; |
20 | 21 |
import com.vaadin.server.FontAwesome; |
... | ... | |
296 | 297 |
|
297 | 298 |
|
298 | 299 |
private void publishEvent(Object event) { |
299 |
parentView.getEventBus().publishEvent(event); |
|
300 |
if(event instanceof NavigationEvent){ |
|
301 |
parentView.getViewEventBus().publish(EventScope.UI, this, event); |
|
302 |
} else { |
|
303 |
parentView.getViewEventBus().publish(this, event); |
|
304 |
} |
|
300 | 305 |
} |
301 | 306 |
|
302 | 307 |
/* ====== RegistrationItemDesign Getters ====== */ |
src/main/java/eu/etaxonomy/cdm/vaadin/debug/EntityCacheDebugger.java | ||
---|---|---|
14 | 14 |
|
15 | 15 |
import org.apache.log4j.Logger; |
16 | 16 |
import org.springframework.context.annotation.Profile; |
17 |
import org.springframework.context.event.EventListener; |
|
18 | 17 |
import org.springframework.stereotype.Component; |
18 |
import org.vaadin.spring.events.Event; |
|
19 |
import org.vaadin.spring.events.EventBus; |
|
20 |
import org.vaadin.spring.events.EventBus.ViewEventBus; |
|
21 |
import org.vaadin.spring.events.EventBusListener; |
|
19 | 22 |
|
20 | 23 |
import com.vaadin.event.ShortcutAction; |
21 | 24 |
import com.vaadin.event.ShortcutListener; |
... | ... | |
29 | 32 |
import eu.etaxonomy.vaadin.mvp.AbstractPresenter; |
30 | 33 |
import eu.etaxonomy.vaadin.mvp.AbstractView; |
31 | 34 |
import eu.etaxonomy.vaadin.ui.view.PopEditorOpenedEvent; |
35 |
import eu.etaxonomy.vaadin.ui.view.PopupView; |
|
32 | 36 |
|
33 | 37 |
/** |
34 | 38 |
* @author a.kohlbecker |
... | ... | |
37 | 41 |
*/ |
38 | 42 |
@Component |
39 | 43 |
@Profile("debug") |
40 |
public class EntityCacheDebugger implements ViewChangeListener { |
|
44 |
public class EntityCacheDebugger implements ViewChangeListener, EventBusListener<PopEditorOpenedEvent> {
|
|
41 | 45 |
|
42 | 46 |
Logger logger = Logger.getLogger(EntityCacheDebugger.class); |
47 |
private ViewEventBus viewEventBus; |
|
48 |
|
|
49 |
|
|
50 |
// @Autowired // FIXME autowiring fails, need to put in UI Scope? |
|
51 |
protected final void setViewEventBus(EventBus.ViewEventBus viewEventBus){ |
|
52 |
this.viewEventBus = viewEventBus; |
|
53 |
viewEventBus.subscribe(this); |
|
54 |
} |
|
43 | 55 |
|
44 | 56 |
EntityCacheDebuggerShortcutListener shortcutListener; |
45 | 57 |
|
... | ... | |
119 | 131 |
} |
120 | 132 |
} |
121 | 133 |
|
122 |
@EventListener |
|
123 |
public void onPopEditorOpenedEvent(PopEditorOpenedEvent event){ |
|
124 |
if(event.getPopupView() != null && event.getPopupView() instanceof AbstractCdmPopupEditor){ |
|
125 |
findWindow(((AbstractCdmPopupEditor)event.getPopupView())).addShortcutListener(shortcutListener); |
|
134 |
@Override |
|
135 |
public void onEvent(Event<PopEditorOpenedEvent> event){ |
|
136 |
PopupView popupView = event.getPayload().getPopupView(); |
|
137 |
if(popupView != null && popupView instanceof AbstractCdmPopupEditor){ |
|
138 |
findWindow(((AbstractCdmPopupEditor)popupView)).addShortcutListener(shortcutListener); |
|
126 | 139 |
} |
127 | 140 |
|
128 | 141 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/event/EditorActionTypeFilter.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2018 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.cdm.vaadin.event; |
|
10 |
|
|
11 |
import org.vaadin.spring.events.Event; |
|
12 |
import org.vaadin.spring.events.EventBusListenerMethodFilter; |
|
13 |
|
|
14 |
import eu.etaxonomy.vaadin.event.EditorActionType; |
|
15 |
|
|
16 |
/** |
|
17 |
* @author a.kohlbecker |
|
18 |
* @since Jan 31, 2018 |
|
19 |
* |
|
20 |
*/ |
|
21 |
public class EditorActionTypeFilter implements EventBusListenerMethodFilter { |
|
22 |
|
|
23 |
EditorActionType action; |
|
24 |
|
|
25 |
private EditorActionTypeFilter(EditorActionType action) { |
|
26 |
this.action = action; |
|
27 |
} |
|
28 |
|
|
29 |
/** |
|
30 |
* {@inheritDoc} |
|
31 |
*/ |
|
32 |
@Override |
|
33 |
public boolean filter(Event<?> event) { |
|
34 |
if (event.getPayload() instanceof AbstractEditorAction) { |
|
35 |
AbstractEditorAction editorAction = (AbstractEditorAction) event.getPayload(); |
|
36 |
return this.action.equals(editorAction.type); |
|
37 |
} |
|
38 |
return false; |
|
39 |
} |
|
40 |
|
|
41 |
public static class Add extends EditorActionTypeFilter { |
|
42 |
|
|
43 |
public Add() { |
|
44 |
super(EditorActionType.ADD); |
|
45 |
} |
|
46 |
|
|
47 |
} |
|
48 |
|
|
49 |
public static class Edit extends EditorActionTypeFilter { |
|
50 |
|
|
51 |
public Edit() { |
|
52 |
super(EditorActionType.EDIT); |
|
53 |
} |
|
54 |
|
|
55 |
} |
|
56 |
|
|
57 |
public static class Remove extends EditorActionTypeFilter { |
|
58 |
|
|
59 |
public Remove() { |
|
60 |
super(EditorActionType.REMOVE); |
|
61 |
} |
|
62 |
|
|
63 |
} |
|
64 |
|
|
65 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/event/EntityChangeEventFilter.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2018 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.cdm.vaadin.event; |
|
10 |
|
|
11 |
import java.util.Optional; |
|
12 |
|
|
13 |
import org.vaadin.spring.events.Event; |
|
14 |
import org.vaadin.spring.events.EventBusListenerMethodFilter; |
|
15 |
|
|
16 |
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent.Type; |
|
17 |
|
|
18 |
/** |
|
19 |
* @author a.kohlbecker |
|
20 |
* @since Jan 31, 2018 |
|
21 |
* |
|
22 |
*/ |
|
23 |
public class EntityChangeEventFilter implements EventBusListenerMethodFilter { |
|
24 |
|
|
25 |
|
|
26 |
private Optional<Class<?>> entityType = null; |
|
27 |
|
|
28 |
private Optional<Type> eventType = null; |
|
29 |
|
|
30 |
private EntityChangeEventFilter(Class<?> entityType, Type eventType){ |
|
31 |
this.entityType = Optional.of(entityType); |
|
32 |
this.eventType = Optional.of(eventType); |
|
33 |
} |
|
34 |
|
|
35 |
private EntityChangeEventFilter(Type eventType){ |
|
36 |
this.eventType = Optional.of(eventType); |
|
37 |
} |
|
38 |
|
|
39 |
private EntityChangeEventFilter(Class<?> entityType){ |
|
40 |
this.entityType = Optional.of(entityType); |
|
41 |
} |
|
42 |
|
|
43 |
/** |
|
44 |
* {@inheritDoc} |
|
45 |
*/ |
|
46 |
@Override |
|
47 |
public boolean filter(Event<?> event) { |
|
48 |
if(event.getPayload() instanceof EntityChangeEvent){ |
|
49 |
EntityChangeEvent testEvent = (EntityChangeEvent)event.getPayload(); |
|
50 |
boolean match = true; |
|
51 |
if(this.entityType != null){ |
|
52 |
match &= this.entityType.get().equals(testEvent.getEntityType()); |
|
53 |
} |
|
54 |
if(this.eventType != null){ |
|
55 |
match &= this.eventType.get().equals(testEvent.getType()); |
|
56 |
} |
|
57 |
return match; |
|
58 |
} |
|
59 |
return false; |
|
60 |
} |
|
61 |
|
|
62 |
|
|
63 |
public static class OccurrenceCollectionFilter extends EntityChangeEventFilter{ |
|
64 |
|
|
65 |
OccurrenceCollectionFilter(){ |
|
66 |
super(eu.etaxonomy.cdm.model.occurrence.Collection.class); |
|
67 |
} |
|
68 |
} |
|
69 |
|
|
70 |
public static class ReferenceFilter extends EntityChangeEventFilter { |
|
71 |
|
|
72 |
public ReferenceFilter() { |
|
73 |
super(eu.etaxonomy.cdm.model.reference.Reference.class); |
|
74 |
} |
|
75 |
} |
|
76 |
|
|
77 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/event/ShowDetailsEventEntityTypeFilter.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2018 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.cdm.vaadin.event; |
|
10 |
|
|
11 |
import org.vaadin.spring.events.Event; |
|
12 |
import org.vaadin.spring.events.EventBusListenerMethodFilter; |
|
13 |
|
|
14 |
/** |
|
15 |
* @author a.kohlbecker |
|
16 |
* @since Jan 31, 2018 |
|
17 |
* |
|
18 |
*/ |
|
19 |
public class ShowDetailsEventEntityTypeFilter implements EventBusListenerMethodFilter { |
|
20 |
|
|
21 |
|
|
22 |
Class entityType; |
|
23 |
|
|
24 |
private ShowDetailsEventEntityTypeFilter(Class entityType){ |
|
25 |
this.entityType = entityType; |
|
26 |
} |
|
27 |
|
|
28 |
/** |
|
29 |
* {@inheritDoc} |
|
30 |
*/ |
|
31 |
@Override |
|
32 |
public boolean filter(Event<?> event) { |
|
33 |
|
|
34 |
if(event.getPayload() instanceof ShowDetailsEvent){ |
|
35 |
ShowDetailsEvent detailsEvent = (ShowDetailsEvent)event.getPayload(); |
|
36 |
return this.entityType.equals(detailsEvent.getEntityType()); |
|
37 |
} |
|
38 |
return false; |
|
39 |
} |
|
40 |
|
|
41 |
public static class RegistrationWorkingSet extends ShowDetailsEventEntityTypeFilter{ |
|
42 |
|
|
43 |
public RegistrationWorkingSet(){ |
|
44 |
super(RegistrationWorkingSet.class); |
|
45 |
} |
|
46 |
} |
|
47 |
|
|
48 |
public static class RegistrationDTO extends ShowDetailsEventEntityTypeFilter{ |
|
49 |
|
|
50 |
public RegistrationDTO(){ |
|
51 |
super(RegistrationDTO.class); |
|
52 |
} |
|
53 |
} |
|
54 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/toolbar/RegistrationToolbar.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
import org.springframework.beans.factory.annotation.Autowired; |
12 | 12 |
import org.springframework.beans.factory.annotation.Qualifier; |
13 |
import org.springframework.context.ApplicationEventPublisher; |
|
14 |
import org.springframework.context.event.EventListener; |
|
13 |
import org.vaadin.spring.events.EventBus; |
|
14 |
import org.vaadin.spring.events.EventBus.UIEventBus; |
|
15 |
import org.vaadin.spring.events.EventBusListener; |
|
15 | 16 |
|
16 | 17 |
import com.vaadin.server.FontAwesome; |
17 | 18 |
import com.vaadin.spring.annotation.SpringComponent; |
... | ... | |
36 | 37 |
*/ |
37 | 38 |
@SpringComponent("registrationToolbar") |
38 | 39 |
@UIScope |
39 |
public class RegistrationToolbar extends HorizontalLayout implements Toolbar { |
|
40 |
public class RegistrationToolbar extends HorizontalLayout implements Toolbar, EventBusListener<AuthenticationSuccessEvent> {
|
|
40 | 41 |
|
41 | 42 |
private static final long serialVersionUID = 2594781255088231474L; |
42 | 43 |
|
43 |
@Autowired |
|
44 |
protected ApplicationEventPublisher eventBus; |
|
45 |
|
|
46 | 44 |
@Autowired |
47 | 45 |
@Qualifier("cdmRepository") |
48 | 46 |
private CdmRepository repo; |
49 | 47 |
|
48 |
private UIEventBus uiEventBus; |
|
49 |
|
|
50 |
@Autowired |
|
51 |
protected final void setUIEventBus(EventBus.UIEventBus uiEventBus){ |
|
52 |
this.uiEventBus = uiEventBus; |
|
53 |
uiEventBus.subscribe(this); |
|
54 |
} |
|
55 |
|
|
50 | 56 |
@Autowired |
51 | 57 |
protected NavigationManager navigationManager; |
52 | 58 |
|
... | ... | |
85 | 91 |
} |
86 | 92 |
|
87 | 93 |
|
88 |
@EventListener |
|
89 |
public void onAuthenticationSuccessEvent(AuthenticationSuccessEvent event){ |
|
90 |
boolean isInitialized = userButton != null; |
|
91 |
// The RegistrationToolbar is being initialize even if not needed only because it is a EventListener |
|
92 |
// which causes Spring to initialize it. |
|
93 |
// TODO After switching to an other event bus this check can be removed |
|
94 |
if(isInitialized){ |
|
95 |
updateAuthenticationButtons(); |
|
96 |
} |
|
94 |
@Override |
|
95 |
public void onEvent(org.vaadin.spring.events.Event<AuthenticationSuccessEvent> event) { |
|
96 |
updateAuthenticationButtons(); |
|
97 | 97 |
} |
98 | 98 |
|
99 | 99 |
/** |
... | ... | |
121 | 121 |
* @return |
122 | 122 |
*/ |
123 | 123 |
private void performLogin() { |
124 |
eventBus.publishEvent(new NavigationEvent("login", navigationManager.getCurrentViewName()));
|
|
124 |
uiEventBus.publish(this, new NavigationEvent("login", navigationManager.getCurrentViewName()));
|
|
125 | 125 |
} |
126 | 126 |
|
127 | 127 |
|
src/main/java/eu/etaxonomy/cdm/vaadin/ui/DistributionStatusUI.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import org.apache.log4j.Logger; |
4 | 4 |
import org.springframework.beans.factory.annotation.Autowired; |
5 |
import org.springframework.context.ApplicationEventPublisher;
|
|
5 |
import org.vaadin.spring.events.EventBus.UIEventBus;
|
|
6 | 6 |
|
7 | 7 |
import com.vaadin.annotations.Theme; |
8 | 8 |
import com.vaadin.annotations.Title; |
... | ... | |
66 | 66 |
// private Toolbar toolbar; |
67 | 67 |
|
68 | 68 |
@Autowired |
69 |
ApplicationEventPublisher eventBus;
|
|
69 |
UIEventBus uiEventBus;
|
|
70 | 70 |
|
71 | 71 |
public DistributionStatusUI() { |
72 | 72 |
|
... | ... | |
97 | 97 |
// ((ToolbarDisplay)viewDisplay).setToolbar(toolbar); |
98 | 98 |
// } |
99 | 99 |
|
100 |
eventBus.publishEvent(new UIInitializedEvent());
|
|
100 |
uiEventBus.publish(this, new UIInitializedEvent());
|
|
101 | 101 |
|
102 | 102 |
navigator.setDefaultViewName(INITIAL_VIEW); |
103 | 103 |
|
src/main/java/eu/etaxonomy/cdm/vaadin/ui/RegistrationUI.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
import org.springframework.beans.factory.annotation.Autowired; |
12 | 12 |
import org.springframework.beans.factory.annotation.Qualifier; |
13 |
import org.springframework.context.ApplicationEventPublisher;
|
|
13 |
import org.vaadin.spring.events.EventBus.UIEventBus;
|
|
14 | 14 |
|
15 | 15 |
import com.flowingcode.vaadin.addons.errorwindow.WindowErrorHandler; |
16 | 16 |
import com.vaadin.annotations.Theme; |
... | ... | |
73 | 73 |
@Autowired(required = false) |
74 | 74 |
EntityCacheDebugger entityCacheDebugger = null; |
75 | 75 |
|
76 |
@Autowired |
|
77 |
UIEventBus uiEventBus; |
|
78 |
|
|
79 |
/* |
|
80 |
* this HACKY solution forces the bean to be instantiated, TODO do it properly |
|
81 |
*/ |
|
82 |
// @Autowired |
|
83 |
// MenuBeanDiscoveryBean bean; |
|
84 |
|
|
85 |
@Autowired |
|
86 |
private MainMenu mainMenu; |
|
87 |
|
|
88 |
/* |
|
89 |
* this HACKY solution forces the bean to be instantiated, TODO do it properly |
|
90 |
*/ |
|
91 |
// @Autowired |
|
92 |
// MenuBeanDiscoveryBean bean; |
|
93 |
|
|
94 |
@Autowired |
|
95 |
@Qualifier("registrationToolbar") |
|
96 |
private Toolbar toolbar; |
|
97 |
|
|
98 |
//--------------------------------------------- |
|
99 |
|
|
100 |
public static final String INITIAL_VIEW = DashBoardView.NAME; |
|
101 |
|
|
76 | 102 |
protected void configureAccessDeniedView() { |
77 | 103 |
viewProvider.setAccessDeniedViewClass(RedirectToLoginView.class); |
78 | 104 |
} |
... | ... | |
92 | 118 |
|
93 | 119 |
//--------------------------------------------- |
94 | 120 |
|
95 |
public static final String INITIAL_VIEW = DashBoardView.NAME; |
|
121 |
|
|
96 | 122 |
|
97 | 123 |
|
98 | 124 |
/* |
... | ... | |
101 | 127 |
// @Autowired |
102 | 128 |
// MenuBeanDiscoveryBean bean; |
103 | 129 |
|
104 |
@Autowired |
|
105 |
private MainMenu mainMenu; |
|
106 |
|
|
107 |
@Autowired |
|
108 |
@Qualifier("registrationToolbar") |
|
109 |
private Toolbar toolbar; |
|
110 |
|
|
111 |
@Autowired |
|
112 |
ApplicationEventPublisher eventBus; |
|
113 |
|
|
114 | 130 |
public RegistrationUI() { |
115 | 131 |
|
116 | 132 |
} |
... | ... | |
143 | 159 |
} |
144 | 160 |
|
145 | 161 |
|
146 |
eventBus.publishEvent(new UIInitializedEvent());
|
|
162 |
uiEventBus.publish(this, new UIInitializedEvent());
|
|
147 | 163 |
|
148 | 164 |
String brand = "phycobank"; |
149 | 165 |
//TODO create annotation: |
src/main/java/eu/etaxonomy/cdm/vaadin/view/LoginPresenter.java | ||
---|---|---|
13 | 13 |
import org.apache.commons.lang.StringUtils; |
14 | 14 |
import org.apache.log4j.Logger; |
15 | 15 |
import org.springframework.beans.factory.annotation.Autowired; |
16 |
import org.springframework.context.ApplicationEventPublisher; |
|
17 |
import org.springframework.context.event.EventListener; |
|
18 | 16 |
import org.springframework.security.authentication.AuthenticationManager; |
19 | 17 |
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
20 | 18 |
import org.springframework.security.core.Authentication; |
21 | 19 |
import org.springframework.security.core.AuthenticationException; |
20 |
import org.vaadin.spring.events.Event; |
|
21 |
import org.vaadin.spring.events.EventBus; |
|
22 |
import org.vaadin.spring.events.EventBus.ViewEventBus; |
|
23 |
import org.vaadin.spring.events.EventBusListener; |
|
22 | 24 |
|
23 | 25 |
import com.vaadin.spring.annotation.SpringComponent; |
24 | 26 |
import com.vaadin.spring.annotation.ViewScope; |
... | ... | |
47 | 49 |
*/ |
48 | 50 |
@SpringComponent |
49 | 51 |
@ViewScope |
50 |
public class LoginPresenter extends AbstractPresenter<LoginView> { |
|
52 |
public class LoginPresenter extends AbstractPresenter<LoginView> implements EventBusListener<AuthenticationAttemptEvent> {
|
|
51 | 53 |
|
52 | 54 |
private static final long serialVersionUID = 4020699735656994791L; |
53 | 55 |
|
... | ... | |
57 | 59 |
|
58 | 60 |
private final static String PROPNAME_PASSWORD = "cdm-vaadin.login.pwd"; |
59 | 61 |
|
60 |
@Autowired |
|
61 |
protected ApplicationEventPublisher eventBus; |
|
62 |
|
|
63 | 62 |
private String redirectToState; |
64 | 63 |
|
64 |
protected EventBus.UIEventBus uiEventBus; |
|
65 |
|
|
66 |
/** |
|
67 |
* {@inheritDoc} |
|
68 |
*/ |
|
69 |
@Override |
|
70 |
protected void eventViewBusSubscription(ViewEventBus viewEventBus) { |
|
71 |
// not listening to view scope events |
|
72 |
} |
|
73 |
|
|
74 |
@Autowired |
|
75 |
protected void setUIEventBus(EventBus.UIEventBus uiEventBus){ |
|
76 |
this.uiEventBus = uiEventBus; |
|
77 |
uiEventBus.subscribe(this); |
|
78 |
} |
|
79 |
|
|
65 | 80 |
public boolean authenticate(String userName, String password) { |
66 | 81 |
|
67 | 82 |
getView().clearMessage(); |
... | ... | |
74 | 89 |
log.debug("user '" + userName + "' authenticated"); |
75 | 90 |
currentSecurityContext().setAuthentication(authentication); |
76 | 91 |
if(NavigationManager.class.isAssignableFrom(getNavigationManager().getClass())){ |
77 |
eventBus.publishEvent(new AuthenticationSuccessEvent(userName));
|
|
92 |
uiEventBus.publish(this, new AuthenticationSuccessEvent(userName));
|
|
78 | 93 |
log.debug("redirecting to " + redirectToState); |
79 |
eventBus.publishEvent(new NavigationEvent(redirectToState));
|
|
94 |
uiEventBus.publish(this, new NavigationEvent(redirectToState));
|
|
80 | 95 |
} |
81 | 96 |
} |
82 | 97 |
} catch (AuthenticationException e){ |
... | ... | |
113 | 128 |
} |
114 | 129 |
} |
115 | 130 |
|
116 |
@EventListener
|
|
117 |
protected void onLoginEvent(AuthenticationAttemptEvent e){
|
|
118 |
authenticate(e.getUserName(), getView().getLoginDialog().getPassword().getValue()); |
|
131 |
@Override
|
|
132 |
public void onEvent(Event<AuthenticationAttemptEvent> event) {
|
|
133 |
authenticate(event.getPayload().getUserName(), getView().getLoginDialog().getPassword().getValue());
|
|
119 | 134 |
} |
120 | 135 |
|
121 | 136 |
|
122 |
|
|
123 | 137 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/LoginViewBean.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.cdm.vaadin.view; |
10 | 10 |
|
11 |
import org.vaadin.spring.events.EventScope; |
|
12 |
|
|
11 | 13 |
import com.vaadin.navigator.View; |
12 | 14 |
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; |
13 | 15 |
import com.vaadin.spring.annotation.SpringView; |
... | ... | |
51 | 53 |
setCompositionRoot(root); |
52 | 54 |
|
53 | 55 |
loginDialog.getLoginButton().addClickListener(e -> handleLoginClick(e)); |
54 |
loginDialog.getRegisterButton().addClickListener(e -> eventBus.publishEvent(new RegisterNewUserEvent(e)));
|
|
55 |
loginDialog.getSendOnetimeLogin().addClickListener(e -> eventBus.publishEvent(new PasswordRevoveryEvent(e)));
|
|
56 |
loginDialog.getRegisterButton().addClickListener(e -> getViewEventBus().publish(EventScope.UI, this, new RegisterNewUserEvent(e)));
|
|
57 |
loginDialog.getSendOnetimeLogin().addClickListener(e -> getViewEventBus().publish(EventScope.UI, this, new PasswordRevoveryEvent(e)));
|
|
56 | 58 |
// NOTE: null viewName will be replaced by the default view name in NavigationManagerBean |
57 |
loginDialog.getCancelLoginButton().addClickListener(e -> eventBus.publishEvent(new NavigationEvent(null)));
|
|
58 |
loginDialog.getCancelRegistrationButton().addClickListener(e -> eventBus.publishEvent(new NavigationEvent(null)));
|
|
59 |
loginDialog.getCancelLoginButton().addClickListener(e -> getViewEventBus().publish(EventScope.UI, this, new NavigationEvent(null)));
|
|
60 |
loginDialog.getCancelRegistrationButton().addClickListener(e -> getViewEventBus().publish(EventScope.UI, this, new NavigationEvent(null)));
|
|
59 | 61 |
} |
60 | 62 |
|
61 | 63 |
/** |
62 | 64 |
* @param e |
63 | 65 |
*/ |
64 | 66 |
private void handleLoginClick(ClickEvent e) { |
65 |
eventBus.publishEvent(new AuthenticationAttemptEvent(e, loginDialog.getUserName().getValue()));
|
|
67 |
getViewEventBus().publish(this, new AuthenticationAttemptEvent(e, loginDialog.getUserName().getValue()));
|
|
66 | 68 |
} |
67 | 69 |
|
68 | 70 |
@Override |
src/main/java/eu/etaxonomy/cdm/vaadin/view/RedirectToLoginView.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
import org.springframework.beans.factory.annotation.Autowired; |
12 | 12 |
import org.springframework.beans.factory.config.ConfigurableBeanFactory; |
13 |
import org.springframework.context.ApplicationEventPublisher; |
|
14 | 13 |
import org.springframework.context.annotation.Scope; |
14 |
import org.vaadin.spring.events.EventBus; |
|
15 | 15 |
|
16 | 16 |
import com.vaadin.navigator.Navigator; |
17 | 17 |
import com.vaadin.navigator.View; |
... | ... | |
49 | 49 |
NavigationManager navigationManager; |
50 | 50 |
|
51 | 51 |
@Autowired |
52 |
protected ApplicationEventPublisher eventBus;
|
|
52 |
protected EventBus.UIEventBus uiEventBus;
|
|
53 | 53 |
|
54 | 54 |
public RedirectToLoginView() { |
55 | 55 |
|
... | ... | |
70 | 70 |
|
71 | 71 |
String currentState = ((Navigator)navigationManager).getState(); |
72 | 72 |
// redirect to the login view and pass over the current state |
73 |
eventBus.publishEvent(new NavigationEvent(LoginViewBean.NAME, currentState));
|
|
73 |
uiEventBus.publish(this, new NavigationEvent(LoginViewBean.NAME, currentState));
|
|
74 | 74 |
} |
75 | 75 |
|
76 | 76 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/distributionStatus/DistributionTablePresenter.java | ||
---|---|---|
26 | 26 |
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer; |
27 | 27 |
import org.vaadin.addons.lazyquerycontainer.QueryDefinition; |
28 | 28 |
import org.vaadin.addons.lazyquerycontainer.QueryFactory; |
29 |
import org.vaadin.spring.events.EventBus.ViewEventBus; |
|
29 | 30 |
|
30 | 31 |
import com.vaadin.server.VaadinSession; |
31 | 32 |
import com.vaadin.spring.annotation.SpringComponent; |
... | ... | |
76 | 77 |
|
77 | 78 |
@Autowired |
78 | 79 |
@Qualifier("cdmRepository") |
79 |
private CdmRepository repo; |
|
80 |
private CdmRepository repo; // TODO remove, since this is already in the super class
|
|
80 | 81 |
|
81 |
public int updateDistributionField(String distributionAreaString, Object comboValue, Taxon taxon) { |
|
82 |
/** |
|
83 |
* {@inheritDoc} |
|
84 |
*/ |
|
85 |
@Override |
|
86 |
protected void eventViewBusSubscription(ViewEventBus viewEventBus) { |
|
87 |
// no point subscribing |
|
88 |
} |
|
89 |
|
|
90 |
public int updateDistributionField(String distributionAreaString, Object comboValue, Taxon taxon) { |
|
82 | 91 |
TransactionStatus tx = repo.startTransaction(); |
83 | 92 |
taxon = (Taxon)repo.getTaxonService().find(taxon.getUuid()); |
84 | 93 |
Set<DefinedTermBase> chosenTerms = getChosenTerms(); |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/NameTypeDesignationPopupEditor.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.cdm.vaadin.view.name; |
10 | 10 |
|
11 |
import org.springframework.context.annotation.Scope; |
|
12 |
|
|
13 |
import com.vaadin.spring.annotation.SpringComponent; |
|
11 | 14 |
import com.vaadin.ui.Alignment; |
12 | 15 |
import com.vaadin.ui.CheckBox; |
13 | 16 |
import com.vaadin.ui.GridLayout; |
... | ... | |
27 | 30 |
* @since Jan 26, 2018 |
28 | 31 |
* |
29 | 32 |
*/ |
33 |
@SpringComponent |
|
34 |
@Scope("prototype") |
|
30 | 35 |
public class NameTypeDesignationPopupEditor extends AbstractCdmPopupEditor<NameTypeDesignation, NameTypeDesignationPresenter> |
31 | 36 |
implements NameTypeDesignationEditorView { |
32 | 37 |
|
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/NameTypeDesignationPresenter.java | ||
---|---|---|
13 | 13 |
import java.util.List; |
14 | 14 |
|
15 | 15 |
import org.springframework.beans.factory.annotation.Autowired; |
16 |
import org.springframework.context.annotation.Scope; |
|
17 |
|
|
18 |
import com.vaadin.spring.annotation.SpringComponent; |
|
16 | 19 |
|
17 | 20 |
import eu.etaxonomy.cdm.api.service.IService; |
18 | 21 |
import eu.etaxonomy.cdm.model.name.NameTypeDesignation; |
... | ... | |
35 | 38 |
* @since Jan 26, 2018 |
36 | 39 |
* |
37 | 40 |
*/ |
41 |
@SpringComponent |
|
42 |
@Scope("prototype") |
|
38 | 43 |
public class NameTypeDesignationPresenter |
39 | 44 |
extends AbstractCdmEditorPresenter<NameTypeDesignation, NameTypeDesignationEditorView> { |
40 | 45 |
|
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationWorkingsetEditorPresenter.java | ||
---|---|---|
14 | 14 |
import java.util.Set; |
15 | 15 |
|
16 | 16 |
import org.springframework.beans.factory.annotation.Autowired; |
17 |
import org.springframework.context.event.EventListener; |
|
17 |
import org.springframework.context.annotation.Scope; |
|
18 |
import org.vaadin.spring.events.annotation.EventBusListenerMethod; |
|
18 | 19 |
import org.vaadin.viritin.fields.AbstractElementCollection; |
19 | 20 |
|
21 |
import com.vaadin.spring.annotation.SpringComponent; |
|
22 |
|
|
20 | 23 |
import eu.etaxonomy.cdm.api.service.IRegistrationService; |
21 | 24 |
import eu.etaxonomy.cdm.cache.CdmTransientEntityCacher; |
22 | 25 |
import eu.etaxonomy.cdm.model.ICdmCacher; |
... | ... | |
36 | 39 |
import eu.etaxonomy.cdm.vaadin.component.CdmBeanItemContainerFactory; |
37 | 40 |
import eu.etaxonomy.cdm.vaadin.component.CollectionRowItemCollection; |
38 | 41 |
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent; |
42 |
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEventFilter; |
|
39 | 43 |
import eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityButtonUpdater; |
40 | 44 |
import eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityReloader; |
41 | 45 |
import eu.etaxonomy.cdm.vaadin.model.registration.RegistrationTermLists; |
... | ... | |
56 | 60 |
* @since Jun 13, 2017 |
57 | 61 |
* |
58 | 62 |
*/ |
63 |
@SpringComponent |
|
64 |
@Scope("prototype") |
|
59 | 65 |
public class SpecimenTypeDesignationWorkingsetEditorPresenter |
60 | 66 |
extends AbstractEditorPresenter<SpecimenTypeDesignationWorkingSetDTO , SpecimenTypeDesignationWorkingsetPopupEditorView> |
61 | 67 |
implements CachingPresenter { |
... | ... | |
99 | 105 |
return store; |
100 | 106 |
} |
101 | 107 |
|
102 |
|
|
103 | 108 |
/** |
104 | 109 |
* Loads an existing working set from the database. This process actually involves |
105 | 110 |
* loading the Registration specified by the <code>RegistrationAndWorkingsetId.registrationId</code> and in |
... | ... | |
316 | 321 |
collectionPopupEditor.loadInEditor(collectionId); |
317 | 322 |
} |
318 | 323 |
|
319 |
@EventListener(condition = "#event.entityType == T(eu.etaxonomy.cdm.model.occurrence.Collection)") |
|
324 |
|
|
325 |
@EventBusListenerMethod(filter = EntityChangeEventFilter.OccurrenceCollectionFilter.class) |
|
320 | 326 |
public void onCollectionEvent(EntityChangeEvent event){ |
321 | 327 |
|
322 |
Collection newCollection = getRepo().getCollectionService().load(event.getEntityId(), Arrays.asList(new String[]{"$.institute"})); |
|
328 |
Collection newCollection = getRepo().getCollectionService().load( |
|
329 |
event.getEntityId(), Arrays.asList(new String[]{"$.institute"}) |
|
330 |
); |
|
323 | 331 |
cache.load(newCollection); |
324 | 332 |
|
325 | 333 |
for( CollectionRowItemCollection row : collectionPopuEditorSourceRows) { |
... | ... | |
347 | 355 |
referencePopupEditor.loadInEditor(referenceId); |
348 | 356 |
} |
349 | 357 |
|
350 |
@EventListener(condition = "#event.entityType == T(eu.etaxonomy.cdm.model.reference.Reference)")
|
|
358 |
@EventBusListenerMethod(filter = EntityChangeEventFilter.ReferenceFilter.class)
|
|
351 | 359 |
public void onReferenceEvent(EntityChangeEvent event){ |
352 | 360 |
|
353 | 361 |
Reference newRef = getRepo().getReferenceService().load(event.getEntityId(), Arrays.asList(new String[]{"$"})); |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationWorkingsetPopupEditor.java | ||
---|---|---|
11 | 11 |
import java.util.Collection; |
12 | 12 |
import java.util.EnumSet; |
13 | 13 |
|
14 |
import org.springframework.context.annotation.Scope; |
|
14 | 15 |
import org.springframework.security.core.GrantedAuthority; |
15 | 16 |
import org.vaadin.viritin.fields.ElementCollectionField; |
16 | 17 |
|
17 | 18 |
import com.vaadin.data.validator.DoubleRangeValidator; |
19 |
import com.vaadin.spring.annotation.SpringComponent; |
|
18 | 20 |
import com.vaadin.ui.AbstractSelect.ItemCaptionMode; |
19 | 21 |
import com.vaadin.ui.Component; |
20 | 22 |
import com.vaadin.ui.GridLayout; |
... | ... | |
39 | 41 |
* @since May 15, 2017 |
40 | 42 |
* |
41 | 43 |
*/ |
44 |
@SpringComponent |
|
45 |
@Scope("prototype") |
|
42 | 46 |
public class SpecimenTypeDesignationWorkingsetPopupEditor |
43 | 47 |
extends AbstractPopupEditor<SpecimenTypeDesignationWorkingSetDTO, SpecimenTypeDesignationWorkingsetEditorPresenter> |
44 | 48 |
implements SpecimenTypeDesignationWorkingsetPopupEditorView, AccessRestrictedView, PerEntityAuthorityGrantingEditor { |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNameEditorPresenter.java | ||
---|---|---|
16 | 16 |
|
17 | 17 |
import org.apache.log4j.Logger; |
18 | 18 |
import org.hibernate.criterion.Restrictions; |
19 |
import org.springframework.context.event.EventListener; |
|
19 |
import org.springframework.context.annotation.Scope; |
|
20 |
import org.vaadin.spring.events.annotation.EventBusListenerMethod; |
|
20 | 21 |
|
22 |
import com.vaadin.spring.annotation.SpringComponent; |
|
21 | 23 |
import com.vaadin.ui.AbstractField; |
22 | 24 |
|
23 | 25 |
import eu.etaxonomy.cdm.api.service.INameService; |
... | ... | |
35 | 37 |
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD; |
36 | 38 |
import eu.etaxonomy.cdm.service.CdmFilterablePagingProvider; |
37 | 39 |
import eu.etaxonomy.cdm.vaadin.component.CdmBeanItemContainerFactory; |
40 |
import eu.etaxonomy.cdm.vaadin.event.EditorActionTypeFilter; |
|
38 | 41 |
import eu.etaxonomy.cdm.vaadin.event.ReferenceEditorAction; |
39 | 42 |
import eu.etaxonomy.cdm.vaadin.event.TaxonNameEditorAction; |
40 | 43 |
import eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityButtonUpdater; |
... | ... | |
53 | 56 |
* @since May 22, 2017 |
54 | 57 |
* |
55 | 58 |
*/ |
59 |
@SpringComponent |
|
60 |
@Scope("prototype") |
|
56 | 61 |
public class TaxonNameEditorPresenter extends AbstractCdmEditorPresenter<TaxonName, TaxonNamePopupEditorView> { |
57 | 62 |
|
58 | 63 |
/** |
... | ... | |
271 | 276 |
return getRepo().getNameService(); |
272 | 277 |
} |
273 | 278 |
|
274 |
@EventListener(condition = "#event.type == T(eu.etaxonomy.vaadin.event.EditorActionType).ADD")
|
|
279 |
@EventBusListenerMethod(filter = EditorActionTypeFilter.Add.class)
|
|
275 | 280 |
public void onReferenceEditorActionAdd(ReferenceEditorAction event) { |
276 | 281 |
|
277 | 282 |
if(getView() == null || event.getSourceView() != getView() ){ |
278 | 283 |
return; |
279 | 284 |
} |
285 |
|
|
280 | 286 |
referenceEditorPopup = getNavigationManager().showInPopup(ReferencePopupEditor.class); |
281 | 287 |
|
282 | 288 |
referenceEditorPopup.grantToCurrentUser(EnumSet.of(CRUD.UPDATE, CRUD.DELETE)); |
... | ... | |
291 | 297 |
} |
292 | 298 |
} |
293 | 299 |
|
294 |
@EventListener(condition = "#event.type == T(eu.etaxonomy.vaadin.event.EditorActionType).EDIT")
|
|
300 |
@EventBusListenerMethod(filter = EditorActionTypeFilter.Edit.class)
|
|
295 | 301 |
public void onReferenceEditorActionEdit(ReferenceEditorAction event) { |
296 | 302 |
|
303 |
|
|
297 | 304 |
if(getView() == null || event.getSourceView() != getView() ){ |
298 | 305 |
return; |
299 | 306 |
} |
... | ... | |
311 | 318 |
} |
312 | 319 |
} |
313 | 320 |
|
314 |
@EventListener
|
|
321 |
@EventBusListenerMethod
|
|
315 | 322 |
public void onDoneWithPopupEvent(DoneWithPopupEvent event){ |
316 | 323 |
|
317 | 324 |
if(event.getPopup() == referenceEditorPopup){ |
... | ... | |
347 | 354 |
} |
348 | 355 |
} |
349 | 356 |
|
350 |
@EventListener(condition = "#event.type == T(eu.etaxonomy.vaadin.event.EditorActionType).EDIT")
|
|
357 |
@EventBusListenerMethod(filter = EditorActionTypeFilter.Edit.class)
|
|
351 | 358 |
public void onTaxonNameEditorActionEdit(TaxonNameEditorAction event) { |
352 | 359 |
|
353 | 360 |
if(getView() == null || event.getSourceView() != getView() ){ |
354 | 361 |
return; |
355 | 362 |
} |
363 |
|
|
356 | 364 |
basionymSourceField = (AbstractField<TaxonName>)event.getSourceComponent(); |
357 | 365 |
|
358 | 366 |
basionymNamePopup = getNavigationManager().showInPopup(TaxonNamePopupEditor.class); |
... | ... | |
364 | 372 |
|
365 | 373 |
} |
366 | 374 |
|
367 |
@EventListener(condition = "#event.type == T(eu.etaxonomy.vaadin.event.EditorActionType).ADD")
|
|
375 |
@EventBusListenerMethod(filter = EditorActionTypeFilter.Add.class)
|
|
368 | 376 |
public void onReferenceEditorActionAdd(TaxonNameEditorAction event) { |
369 | 377 |
|
370 | 378 |
if(getView() == null || event.getSourceView() != getView() ){ |
371 | 379 |
return; |
372 | 380 |
} |
381 |
|
|
373 | 382 |
basionymSourceField = (AbstractField<TaxonName>)event.getSourceComponent(); |
374 | 383 |
|
375 | 384 |
basionymNamePopup = getNavigationManager().showInPopup(TaxonNamePopupEditor.class); |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNamePopupEditor.java | ||
---|---|---|
12 | 12 |
import java.util.EnumSet; |
13 | 13 |
|
14 | 14 |
import org.apache.commons.lang3.BooleanUtils; |
15 |
import org.springframework.context.annotation.Scope; |
|
15 | 16 |
import org.springframework.security.core.GrantedAuthority; |
16 | 17 |
|
17 | 18 |
import com.vaadin.shared.ui.label.ContentMode; |
19 |
import com.vaadin.spring.annotation.SpringComponent; |
|
18 | 20 |
import com.vaadin.ui.Alignment; |
19 | 21 |
import com.vaadin.ui.CheckBox; |
20 | 22 |
import com.vaadin.ui.GridLayout; |
... | ... | |
45 | 47 |
* @since May 22, 2017 |
46 | 48 |
* |
47 | 49 |
*/ |
50 |
@SpringComponent |
|
51 |
@Scope("prototype") |
|
48 | 52 |
public class TaxonNamePopupEditor extends AbstractCdmPopupEditor<TaxonName, TaxonNameEditorPresenter> implements TaxonNamePopupEditorView, AccessRestrictedView { |
49 | 53 |
|
50 | 54 |
private static final long serialVersionUID = -7037436241474466359L; |
... | ... | |
253 | 257 |
|
254 | 258 |
row++; |
255 | 259 |
nomReferenceCombobox = new ToOneRelatedEntityCombobox<Reference>("Nomenclatural reference", Reference.class); |
256 |
nomReferenceCombobox.addClickListenerAddEntity(e -> getEventBus().publishEvent(
|
|
260 |
nomReferenceCombobox.addClickListenerAddEntity(e -> getViewEventBus().publish(this,
|
|
257 | 261 |
new ReferenceEditorAction(EditorActionType.ADD, null, nomReferenceCombobox, this) |
258 | 262 |
)); |
259 | 263 |
nomReferenceCombobox.addClickListenerEditEntity(e -> { |
260 | 264 |
if(nomReferenceCombobox.getValue() != null){ |
261 |
getEventBus().publishEvent(
|
|
265 |
getViewEventBus().publish(this,
|
|
262 | 266 |
new ReferenceEditorAction( |
263 | 267 |
EditorActionType.EDIT, |
264 | 268 |
nomReferenceCombobox.getValue().getId(), |
... | ... | |
300 | 304 |
beanId = ((CdmBase)fieldValue).getId(); |
301 | 305 |
|
302 | 306 |
} |
303 |
eventBus.publishEvent(new TaxonNameEditorAction(e.getAction(), beanId, e.getSource(), this));
|
|
307 |
getViewEventBus().publish(this, new TaxonNameEditorAction(e.getAction(), beanId, e.getSource(), this));
|
|
304 | 308 |
}); |
305 | 309 |
grid.setComponentAlignment(basionymsComboboxSelect, Alignment.TOP_RIGHT); |
306 | 310 |
row++; |
src/main/java/eu/etaxonomy/cdm/vaadin/view/occurrence/CollectionEditorPresenter.java | ||
---|---|---|
11 | 11 |
import java.util.Arrays; |
12 | 12 |
import java.util.List; |
13 | 13 |
|
14 |
import org.springframework.context.event.EventListener; |
|
14 |
import org.springframework.context.annotation.Scope; |
|
15 |
import org.vaadin.spring.events.annotation.EventBusListenerMethod; |
|
16 |
|
|
17 |
import com.vaadin.spring.annotation.SpringComponent; |
|
15 | 18 |
|
16 | 19 |
import eu.etaxonomy.cdm.api.service.IService; |
17 | 20 |
import eu.etaxonomy.cdm.model.occurrence.Collection; |
18 | 21 |
import eu.etaxonomy.cdm.service.CdmFilterablePagingProvider; |
19 | 22 |
import eu.etaxonomy.cdm.vaadin.event.CollectionEditorAction; |
23 |
import eu.etaxonomy.cdm.vaadin.event.EditorActionTypeFilter; |
|
20 | 24 |
import eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityReloader; |
21 | 25 |
import eu.etaxonomy.cdm.vaadin.security.UserHelper; |
22 | 26 |
import eu.etaxonomy.vaadin.mvp.AbstractCdmEditorPresenter; |
... | ... | |
28 | 32 |
* @since Dec 21, 2017 |
29 | 33 |
* |
30 | 34 |
*/ |
35 |
@SpringComponent |
|
36 |
@Scope("prototype") |
|
31 | 37 |
public class CollectionEditorPresenter extends AbstractCdmEditorPresenter<Collection, CollectionPopupEditorView> { |
32 | 38 |
|
33 | 39 |
private static final long serialVersionUID = -1996365248431425021L; |
34 | 40 |
private CollectionPopupEditor collectionPopuEditor; |
35 | 41 |
|
42 |
|
|
36 | 43 |
/** |
37 | 44 |
* {@inheritDoc} |
38 | 45 |
*/ |
... | ... | |
99 | 106 |
getView().getSuperCollectionCombobox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<Collection>(getView().getSuperCollectionCombobox(),this)); |
100 | 107 |
} |
101 | 108 |
|
102 |
@EventListener(condition = "#event.type == T(eu.etaxonomy.vaadin.event.EditorActionType).ADD")
|
|
109 |
@EventBusListenerMethod(filter = EditorActionTypeFilter.Add.class)
|
|
103 | 110 |
public void onCollectionEditorActionAdd(CollectionEditorAction event) { |
104 | 111 |
|
105 | 112 |
if(!checkFromOwnView(event)){ |
... | ... | |
113 | 120 |
collectionPopuEditor.loadInEditor(null); |
114 | 121 |
} |
115 | 122 |
|
116 |
@EventListener(condition = "#event.type == T(eu.etaxonomy.vaadin.event.EditorActionType).EDIT")
|
|
123 |
@EventBusListenerMethod(filter = EditorActionTypeFilter.Edit.class)
|
|
117 | 124 |
public void onCollectionEditorActionEdit(CollectionEditorAction event) { |
118 | 125 |
|
119 | 126 |
if(!checkFromOwnView(event)){ |
... | ... | |
127 | 134 |
collectionPopuEditor.loadInEditor(event.getEntityId()); |
128 | 135 |
} |
129 | 136 |
|
137 |
@EventBusListenerMethod() |
|
130 | 138 |
public void onDoneWithPopupEvent(DoneWithPopupEvent event){ |
131 | 139 |
if(event.getPopup() == collectionPopuEditor){ |
132 | 140 |
if(event.getReason() == Reason.SAVE){ |
src/main/java/eu/etaxonomy/cdm/vaadin/view/occurrence/CollectionPopupEditor.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.cdm.vaadin.view.occurrence; |
10 | 10 |
|
11 |
import org.springframework.context.annotation.Scope; |
|
11 | 12 |
import org.springframework.security.core.GrantedAuthority; |
12 | 13 |
|
14 |
import com.vaadin.spring.annotation.SpringComponent; |
|
13 | 15 |
import com.vaadin.ui.GridLayout; |
14 | 16 |
import com.vaadin.ui.TextField; |
15 | 17 |
|
... | ... | |
27 | 29 |
* @since Dec 21, 2017 |
28 | 30 |
* |
29 | 31 |
*/ |
32 |
@SpringComponent |
|
33 |
@Scope("prototype") |
|
30 | 34 |
public class CollectionPopupEditor extends AbstractCdmPopupEditor<Collection, CollectionEditorPresenter> implements CollectionPopupEditorView, AccessRestrictedView { |
31 | 35 |
|
32 | 36 |
private static final long serialVersionUID = 2019724189877425882L; |
... | ... | |
133 | 137 |
row++; |
134 | 138 |
|
135 | 139 |
superCollectionCombobox = new ToOneRelatedEntityCombobox<Collection>("Super-collection", Collection.class); |
136 |
superCollectionCombobox.addClickListenerAddEntity(e -> getEventBus().publishEvent(
|
|
140 |
superCollectionCombobox.addClickListenerAddEntity(e -> getViewEventBus().publish(this,
|
|
137 | 141 |
new CollectionEditorAction(EditorActionType.ADD, null, superCollectionCombobox, this) |
138 | 142 |
)); |
139 | 143 |
superCollectionCombobox.addClickListenerEditEntity(e -> { |
140 | 144 |
if(superCollectionCombobox.getValue() != null){ |
141 |
getEventBus().publishEvent(
|
|
145 |
getViewEventBus().publish(this,
|
|
142 | 146 |
new CollectionEditorAction( |
143 | 147 |
EditorActionType.EDIT, |
144 | 148 |
superCollectionCombobox.getValue().getId(), |
... | ... | |
157 | 161 |
new ToOneRelatedEntityButtonUpdater<Collection>(superCollectionCombobox) |
158 | 162 |
); |
159 | 163 |
|
160 |
superCollectionCombobox.addClickListenerAddEntity( e -> getEventBus().publishEvent(
|
|
164 |
superCollectionCombobox.addClickListenerAddEntity( e -> getViewEventBus().publish(this,
|
|
161 | 165 |
new CollectionEditorAction( |
162 | 166 |
EditorActionType.ADD, |
163 | 167 |
null, |
... | ... | |
166 | 170 |
)); |
167 | 171 |
superCollectionCombobox.addClickListenerEditEntity(e -> { |
168 | 172 |
if(superCollectionCombobox.getValue() != null){ |
169 |
getEventBus().publishEvent(
|
|
173 |
getViewEventBus().publish(this,
|
|
170 | 174 |
new CollectionEditorAction( |
171 | 175 |
EditorActionType.EDIT, |
172 | 176 |
superCollectionCombobox.getValue().getId(), |
src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferenceEditorPresenter.java | ||
---|---|---|
12 | 12 |
import java.util.List; |
13 | 13 |
|
14 | 14 |
import org.apache.log4j.Logger; |
15 |
import org.springframework.context.event.EventListener; |
|
15 |
import org.springframework.context.annotation.Scope; |
|
16 |
import org.vaadin.spring.events.annotation.EventBusListenerMethod; |
|
16 | 17 |
import org.vaadin.viritin.fields.CaptionGenerator; |
17 | 18 |
|
19 |
import com.vaadin.spring.annotation.SpringComponent; |
|
20 |
|
|
18 | 21 |
import eu.etaxonomy.cdm.api.service.IService; |
19 | 22 |
import eu.etaxonomy.cdm.model.agent.AgentBase; |
20 | 23 |
import eu.etaxonomy.cdm.model.agent.Person; |
... | ... | |
36 | 39 |
* @since Apr 5, 2017 |
37 | 40 |
* |
38 | 41 |
*/ |
42 |
@SpringComponent |
|
43 |
@Scope("prototype") |
|
39 | 44 |
public class ReferenceEditorPresenter extends AbstractCdmEditorPresenter<Reference, ReferencePopupEditorView> { |
40 | 45 |
|
41 | 46 |
private static final long serialVersionUID = -7926116447719010837L; |
... | ... | |
48 | 53 |
|
49 | 54 |
} |
50 | 55 |
|
56 |
|
|
51 | 57 |
/** |
52 | 58 |
* {@inheritDoc} |
53 | 59 |
*/ |
... | ... | |
134 | 140 |
* @param editorAction |
135 | 141 |
* @throws EditorEntityBeanException |
136 | 142 |
*/ |
137 |
@EventListener(condition = "#editorAction.sourceComponent != null")
|
|
143 |
@EventBusListenerMethod
|
|
138 | 144 |
public void onReferenceEditorAction(ReferenceEditorAction editorAction) { |
139 |
if(!isFromOwnView(editorAction)){ |
|
145 |
|
|
146 |
if(!isFromOwnView(editorAction) || editorAction.getSourceComponent() == null){ |
|
140 | 147 |
return; |
141 | 148 |
} |
149 |
|
|
142 | 150 |
if(ToOneRelatedEntityField.class.isAssignableFrom(editorAction.getSourceComponent().getClass())){ |
143 | 151 |
if(editorAction.isAddAction()){ |
144 | 152 |
inReferencePopup = getNavigationManager().showInPopup(ReferencePopupEditor.class); |
... | ... | |
152 | 160 |
} |
153 | 161 |
} |
154 | 162 |
|
155 |
@EventListener
|
|
163 |
@EventBusListenerMethod
|
|
156 | 164 |
public void doDoneWithPopupEvent(DoneWithPopupEvent event){ |
157 | 165 |
|
158 | 166 |
if(event.getPopup().equals(inReferencePopup)){ |
src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferencePopupEditor.java | ||
---|---|---|
11 | 11 |
import java.util.Collection; |
12 | 12 |
import java.util.EnumSet; |
13 | 13 |
|
14 |
import org.springframework.context.annotation.Scope; |
|
14 | 15 |
import org.springframework.security.core.GrantedAuthority; |
15 | 16 |
|
17 |
import com.vaadin.spring.annotation.SpringComponent; |
|
16 | 18 |
import com.vaadin.ui.Alignment; |
17 | 19 |
import com.vaadin.ui.GridLayout; |
18 | 20 |
import com.vaadin.ui.ListSelect; |
... | ... | |
37 | 39 |
* @since Apr 4, 2017 |
38 | 40 |
* |
39 | 41 |
*/ |
42 |
@SpringComponent |
|
43 |
@Scope("prototype") |
|
40 | 44 |
public class ReferencePopupEditor extends AbstractCdmPopupEditor<Reference, ReferenceEditorPresenter> implements ReferencePopupEditorView, AccessRestrictedView { |
41 | 45 |
|
42 | 46 |
private static final long serialVersionUID = -4347633563800758815L; |
... | ... | |
127 | 131 |
|
128 | 132 |
inReferenceCombobox = new ToOneRelatedEntityCombobox<Reference>("In-reference", Reference.class); |
129 | 133 |
inReferenceCombobox.setWidth(100, Unit.PERCENTAGE); |
130 |
inReferenceCombobox.addClickListenerAddEntity(e -> getEventBus().publishEvent(
|
|
134 |
inReferenceCombobox.addClickListenerAddEntity(e -> getViewEventBus().publish(this,
|
|
131 | 135 |
new ReferenceEditorAction(EditorActionType.ADD, null, inReferenceCombobox, this) |
132 | 136 |
)); |
133 | 137 |
inReferenceCombobox.addClickListenerEditEntity(e -> { |
134 | 138 |
if(inReferenceCombobox.getValue() != null){ |
135 |
getEventBus().publishEvent(
|
|
139 |
getViewEventBus().publish(this,
|
|
136 | 140 |
new ReferenceEditorAction( |
137 | 141 |
EditorActionType.EDIT, |
138 | 142 |
inReferenceCombobox.getValue().getId(), |
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/DashBoardView.java | ||
---|---|---|
9 | 9 |
package eu.etaxonomy.cdm.vaadin.view.registration; |
10 | 10 |
|
11 | 11 |
import org.springframework.beans.factory.annotation.Autowired; |
12 |
import org.springframework.context.ApplicationEventPublisher;
|
|
12 |
import org.vaadin.spring.events.EventBus;
|
|
13 | 13 |
|
14 | 14 |
import com.vaadin.navigator.View; |
15 | 15 |
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; |
... | ... | |
32 | 32 |
private static final long serialVersionUID = -6172448806905158782L; |
33 | 33 |
|
34 | 34 |
@Autowired |
35 |
ApplicationEventPublisher eventBus;
|
|
35 |
protected EventBus.UIEventBus uiEventBus;
|
|
36 | 36 |
|
37 | 37 |
public DashBoardView() { |
38 | 38 |
Responsive.makeResponsive(dashboard); |
39 |
buttonNew.addClickListener(e -> eventBus.publishEvent(new NavigationEvent(StartRegistrationViewBean.NAME)));
|
|
40 |
buttonContinue.addClickListener(e -> eventBus.publishEvent(new NavigationEvent(ListViewBean.NAME + "/" + ListView.Mode.inProgress.name())));
|
|
41 |
buttonList.addClickListener(e -> eventBus.publishEvent(new NavigationEvent(ListViewBean.NAME + "/" + ListViewBean.Mode.all.name())));
|
|
39 |
buttonNew.addClickListener(e -> uiEventBus.publish(this, new NavigationEvent(StartRegistrationViewBean.NAME)));
|
|
40 |
buttonContinue.addClickListener(e -> uiEventBus.publish(this, new NavigationEvent(ListViewBean.NAME + "/" + ListView.Mode.inProgress.name())));
|
|
41 |
buttonList.addClickListener(e -> uiEventBus.publish(this, new NavigationEvent(ListViewBean.NAME + "/" + ListViewBean.Mode.all.name())));
|
|
42 | 42 |
} |
43 | 43 |
|
44 | 44 |
/** |
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/ListPresenter.java | ||
---|---|---|
12 | 12 |
|
13 | 13 |
import org.apache.commons.lang3.StringUtils; |
14 | 14 |
import org.springframework.beans.factory.annotation.Autowired; |
15 |
import org.springframework.context.event.EventListener; |
|
16 | 15 |
import org.springframework.security.core.Authentication; |
16 |
import org.vaadin.spring.events.annotation.EventBusListenerMethod; |
|
17 | 17 |
|
18 | 18 |
import com.vaadin.spring.annotation.SpringComponent; |
19 | 19 |
import com.vaadin.spring.annotation.ViewScope; |
... | ... | |
58 | 58 |
return workingSetService; |
59 | 59 |
} |
60 | 60 |
|
61 |
|
|
61 | 62 |
@Override |
62 | 63 |
public void handleViewEntered() { |
63 | 64 |
|
... | ... | |
129 | 130 |
return dtoPager; |
130 | 131 |
} |
131 | 132 |
|
132 |
@EventListener(classes=ShowDetailsEvent.class, condition = "#event.type == T(eu.etaxonomy.cdm.vaadin.view.registration.RegistrationDTO)") |
|
133 |
public void onShowDetailsEvent(ShowDetailsEvent<?,?> event) { // WARNING don't use more specific generic type arguments |
|
134 |
RegistrationDTO regDto = getWorkingSetService().loadDtoById((Integer)event.getIdentifier()); |
|
135 |
if(event.getProperty().equals("messages")){ |
|
136 |
if(getView() != null){ |
|
137 |
getView().openDetailsPopup("Messages", regDto.getMessages()); |
|
133 |
@EventBusListenerMethod |
|
134 |
public void onShowDetailsEvent(ShowDetailsEvent<?,?> event) { |
|
135 |
|
|
136 |
if(event.getEntityType().equals(RegistrationDTO.class)){ |
|
137 |
RegistrationDTO regDto = getWorkingSetService().loadDtoById((Integer)event.getIdentifier()); |
|
138 |
if(event.getProperty().equals("messages")){ |
|
139 |
if(getView() != null){ |
|
140 |
getView().openDetailsPopup("Messages", regDto.getMessages()); |
|
141 |
} |
|
138 | 142 |
} |
139 | 143 |
} |
140 | 144 |
} |
141 | 145 |
|
142 |
@EventListener
|
|
146 |
@EventBusListenerMethod
|
|
143 | 147 |
public void onEntityChangeEvent(EntityChangeEvent event){ |
144 | 148 |
if(event.getEntityType().isAssignableFrom(Reference.class)){ |
145 | 149 |
// TODO update component showing the according reference, is there a Vaadin event supporting this? |
146 | 150 |
} |
147 | 151 |
} |
148 | 152 |
|
149 |
@EventListener
|
|
153 |
@EventBusListenerMethod
|
|
150 | 154 |
public void onUpdateResultsEvent(UpdateResultsEvent event){ |
151 | 155 |
getView().populate(pageRegistrations(event.getField(), event.getNewText())); |
152 | 156 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/ListViewBean.java | ||
---|---|---|
119 | 119 |
* @return |
120 | 120 |
*/ |
121 | 121 |
private void updateResults(TextField field, String newText) { |
122 |
eventBus.publishEvent(new UpdateResultsEvent(field, newText, this));
|
|
122 |
getViewEventBus().publish(this, new UpdateResultsEvent(field, newText, this));
|
|
123 | 123 |
} |
124 | 124 |
|
125 | 125 |
@Override |
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationEditorPresenter.java | ||
---|---|---|
11 | 11 |
import java.util.Arrays; |
12 | 12 |
import java.util.List; |
13 | 13 |
|
14 |
import org.springframework.context.annotation.Scope; |
|
15 |
|
|
16 |
import com.vaadin.spring.annotation.SpringComponent; |
|
17 |
|
|
14 | 18 |
import eu.etaxonomy.cdm.api.service.IRegistrationService; |
15 | 19 |
import eu.etaxonomy.cdm.model.agent.Institution; |
16 | 20 |
import eu.etaxonomy.cdm.model.common.User; |
... | ... | |
24 | 28 |
* @since May 15, 2017 |
25 | 29 |
* |
26 | 30 |
*/ |
31 |
@SpringComponent |
|
32 |
@Scope("prototype") |
|
27 | 33 |
public class RegistrationEditorPresenter extends AbstractCdmEditorPresenter<Registration, RegistrationPopEditorView> { |
28 | 34 |
|
29 | 35 |
private static final long serialVersionUID = 6930557602995331944L; |
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationPopupEditor.java | ||
---|---|---|
11 | 11 |
import java.util.Arrays; |
12 | 12 |
import java.util.Collection; |
13 | 13 |
|
14 |
import org.springframework.context.annotation.Scope; |
|
14 | 15 |
import org.springframework.security.core.GrantedAuthority; |
15 | 16 |
|
17 |
import com.vaadin.spring.annotation.SpringComponent; |
|
16 | 18 |
import com.vaadin.ui.DateField; |
17 | 19 |
import com.vaadin.ui.FormLayout; |
18 | 20 |
import com.vaadin.ui.ListSelect; |
... | ... | |
30 | 32 |
* @since May 15, 2017 |
31 | 33 |
* |
32 | 34 |
*/ |
35 |
@SpringComponent |
|
36 |
@Scope("prototype") |
|
33 | 37 |
public class RegistrationPopupEditor extends AbstractCdmPopupEditor<Registration, RegistrationEditorPresenter> |
34 | 38 |
implements RegistrationPopEditorView, AccessRestrictedView { |
35 | 39 |
|
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationWorkingsetPresenter.java | ||
---|---|---|
17 | 17 |
import org.hibernate.Session; |
18 | 18 |
import org.hibernate.Transaction; |
19 | 19 |
import org.springframework.beans.factory.annotation.Autowired; |
20 |
import org.springframework.context.event.EventListener; |
|
21 | 20 |
import org.springframework.security.core.Authentication; |
22 | 21 |
import org.springframework.transaction.TransactionStatus; |
22 |
import org.vaadin.spring.events.annotation.EventBusListenerMethod; |
|
23 | 23 |
|
24 | 24 |
import com.vaadin.spring.annotation.SpringComponent; |
25 | 25 |
import com.vaadin.spring.annotation.ViewScope; |
... | ... | |
46 | 46 |
import eu.etaxonomy.cdm.service.CdmFilterablePagingProvider; |
47 | 47 |
import eu.etaxonomy.cdm.service.CdmStore; |
48 | 48 |
import eu.etaxonomy.cdm.service.IRegistrationWorkingSetService; |
49 |
import eu.etaxonomy.cdm.vaadin.event.EditorActionTypeFilter; |
|
49 | 50 |
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent; |
50 | 51 |
import eu.etaxonomy.cdm.vaadin.event.ReferenceEditorAction; |
51 | 52 |
import eu.etaxonomy.cdm.vaadin.event.RegistrationEditorAction; |
52 | 53 |
import eu.etaxonomy.cdm.vaadin.event.ShowDetailsEvent; |
54 |
import eu.etaxonomy.cdm.vaadin.event.ShowDetailsEventEntityTypeFilter; |
|
53 | 55 |
import eu.etaxonomy.cdm.vaadin.event.TaxonNameEditorAction; |
54 | 56 |
import eu.etaxonomy.cdm.vaadin.event.TypeDesignationWorkingsetEditorAction; |
55 | 57 |
import eu.etaxonomy.cdm.vaadin.event.registration.RegistrationWorkingsetAction; |
... | ... | |
109 | 111 |
public RegistrationWorkingsetPresenter() { |
110 | 112 |
} |
111 | 113 |
|
112 |
|
|
113 | 114 |
/** |
114 | 115 |
* Always create a new Store |
115 | 116 |
* |
... | ... | |
214 | 215 |
} |
215 | 216 |
} |
216 | 217 |
|
217 |
@EventListener(condition = "#event.type == T(eu.etaxonomy.vaadin.event.EditorActionType).ADD") |
|
218 |
|
|
219 |
@EventBusListenerMethod(filter = EditorActionTypeFilter.Add.class) |
|
218 | 220 |
public void onReferenceEditorActionAdd(ReferenceEditorAction event) { |
219 | 221 |
|
220 | 222 |
if(!checkFromOwnView(event)){ |
... | ... | |
226 | 228 |
popup.loadInEditor(null); |
227 | 229 |
} |
228 | 230 |
|
229 |
@EventListener(condition = "#event.type == T(eu.etaxonomy.vaadin.event.EditorActionType).EDIT")
|
|
231 |
@EventBusListenerMethod(filter = EditorActionTypeFilter.Edit.class)
|
|
230 | 232 |
public void onReferenceEditorActionEdit(ReferenceEditorAction event) { |
231 | 233 |
|
232 | 234 |
if(!checkFromOwnView(event)){ |
... | ... | |
238 | 240 |
popup.loadInEditor(event.getEntityId()); |
239 | 241 |
} |
240 | 242 |
|
241 |
@EventListener
|
|
243 |
@EventBusListenerMethod
|
|
242 | 244 |
public void onDoneWithReferencePopupEditor(DoneWithPopupEvent event) throws RegistrationValidationException{ |
243 | 245 |
if(event.getPopup() instanceof ReferencePopupEditor){ |
244 | 246 |
if(event.getReason().equals(Reason.SAVE)){ |
... | ... | |
247 | 249 |
} |
248 | 250 |
} |
249 | 251 |
|
250 |
@EventListener |
|
252 |
@EventBusListenerMethod |
Also available in: Unified diff
fix #7231 replacing SpringApplicationEventBus by scoped Vaadin4Spring Event Bus