Revision 154f5e57
Added by Andreas Kohlbecker almost 7 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/RegistrationItem.java | ||
---|---|---|
26 | 26 |
import com.vaadin.ui.themes.ValoTheme; |
27 | 27 |
|
28 | 28 |
import eu.etaxonomy.cdm.model.common.TimePeriod; |
29 |
import eu.etaxonomy.cdm.vaadin.event.EntityEventType;
|
|
30 |
import eu.etaxonomy.cdm.vaadin.event.ReferenceEvent;
|
|
29 |
import eu.etaxonomy.cdm.vaadin.event.EditorActionType;
|
|
30 |
import eu.etaxonomy.cdm.vaadin.event.ReferenceEditorAction;
|
|
31 | 31 |
import eu.etaxonomy.cdm.vaadin.event.ShowDetailsEvent; |
32 | 32 |
import eu.etaxonomy.cdm.vaadin.model.registration.RegistrationWorkingSet; |
33 | 33 |
import eu.etaxonomy.cdm.vaadin.util.formatter.DateTimeFormat; |
... | ... | |
166 | 166 |
|
167 | 167 |
public void setWorkingSet(RegistrationWorkingSet workingSet, AbstractView<?> parentView){ |
168 | 168 |
this.parentView = parentView; |
169 |
ReferenceEvent openButtonEvent;
|
|
169 |
ReferenceEditorAction openButtonEvent;
|
|
170 | 170 |
if(workingSet.getCitationId() != null){ |
171 |
openButtonEvent = new ReferenceEvent(EntityEventType.EDIT, workingSet.getCitationId());
|
|
171 |
openButtonEvent = new ReferenceEditorAction(EditorActionType.EDIT, workingSet.getCitationId());
|
|
172 | 172 |
} else { |
173 |
openButtonEvent = new ReferenceEvent(EntityEventType.ADD);
|
|
173 |
openButtonEvent = new ReferenceEditorAction(EditorActionType.ADD);
|
|
174 | 174 |
} |
175 | 175 |
TimePeriod datePublished = workingSet.getRegistrationDTOs().get(0).getDatePublished(); |
176 | 176 |
updateUI(workingSet.getCitation(), workingSet.getCreated(), datePublished, workingSet.messagesCount(), |
src/main/java/eu/etaxonomy/cdm/vaadin/event/AbstractEditorAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 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 |
/** |
|
12 |
* @author a.kohlbecker |
|
13 |
* @since Mar 22, 2017 |
|
14 |
* |
|
15 |
*/ |
|
16 |
public abstract class AbstractEditorAction { |
|
17 |
|
|
18 |
|
|
19 |
private EditorActionType actionType; |
|
20 |
|
|
21 |
private Integer entityId = null; |
|
22 |
|
|
23 |
public AbstractEditorAction(EditorActionType eventType, Integer entityId) { |
|
24 |
this.actionType = eventType; |
|
25 |
if(eventType == null){ |
|
26 |
throw new NullPointerException(); |
|
27 |
} |
|
28 |
this.setEntityId(entityId); |
|
29 |
} |
|
30 |
|
|
31 |
public AbstractEditorAction(EditorActionType actionType) { |
|
32 |
this(actionType, null); |
|
33 |
} |
|
34 |
|
|
35 |
public EditorActionType getActionType() { |
|
36 |
return actionType; |
|
37 |
} |
|
38 |
|
|
39 |
public boolean isAddAction() { |
|
40 |
return actionType.equals(EditorActionType.ADD); |
|
41 |
} |
|
42 |
public boolean isEditAction() { |
|
43 |
return actionType.equals(EditorActionType.EDIT); |
|
44 |
} |
|
45 |
public boolean isRemoveAction() { |
|
46 |
return actionType.equals(EditorActionType.REMOVE); |
|
47 |
} |
|
48 |
|
|
49 |
/** |
|
50 |
* @return the entityId |
|
51 |
*/ |
|
52 |
public Integer getEntityId() { |
|
53 |
return entityId; |
|
54 |
} |
|
55 |
|
|
56 |
/** |
|
57 |
* @param entityId the entityId to set |
|
58 |
*/ |
|
59 |
private void setEntityId(Integer entityId) { |
|
60 |
this.entityId = entityId; |
|
61 |
} |
|
62 |
|
|
63 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/event/AbstractEntityEvent.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 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 |
/** |
|
12 |
* @author a.kohlbecker |
|
13 |
* @since Mar 22, 2017 |
|
14 |
* |
|
15 |
*/ |
|
16 |
public abstract class AbstractEntityEvent { |
|
17 |
|
|
18 |
|
|
19 |
private EntityEventType eventType; |
|
20 |
|
|
21 |
private Integer entityId = null; |
|
22 |
|
|
23 |
public AbstractEntityEvent(EntityEventType eventType, Integer entityId) { |
|
24 |
this.eventType = eventType; |
|
25 |
if(eventType == null){ |
|
26 |
throw new NullPointerException(); |
|
27 |
} |
|
28 |
this.setEntityId(entityId); |
|
29 |
} |
|
30 |
|
|
31 |
public AbstractEntityEvent(EntityEventType eventType) { |
|
32 |
this(eventType, null); |
|
33 |
} |
|
34 |
|
|
35 |
public EntityEventType getEventType() { |
|
36 |
return eventType; |
|
37 |
} |
|
38 |
|
|
39 |
public boolean isAddEvent() { |
|
40 |
return eventType.equals(EntityEventType.ADD); |
|
41 |
} |
|
42 |
public boolean isEditEvent() { |
|
43 |
return eventType.equals(EntityEventType.EDIT); |
|
44 |
} |
|
45 |
public boolean isRemoveEvent() { |
|
46 |
return eventType.equals(EntityEventType.REMOVE); |
|
47 |
} |
|
48 |
|
|
49 |
/** |
|
50 |
* @return the entityId |
|
51 |
*/ |
|
52 |
public Integer getEntityId() { |
|
53 |
return entityId; |
|
54 |
} |
|
55 |
|
|
56 |
/** |
|
57 |
* @param entityId the entityId to set |
|
58 |
*/ |
|
59 |
private void setEntityId(Integer entityId) { |
|
60 |
this.entityId = entityId; |
|
61 |
} |
|
62 |
|
|
63 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/event/EditorActionType.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 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 |
/** |
|
12 |
* @author a.kohlbecker |
|
13 |
* @since Mar 22, 2017 |
|
14 |
* |
|
15 |
*/ |
|
16 |
public enum EditorActionType { |
|
17 |
|
|
18 |
ADD, |
|
19 |
EDIT, |
|
20 |
REMOVE; |
|
21 |
|
|
22 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/event/EntityEventType.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 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 |
/** |
|
12 |
* @author a.kohlbecker |
|
13 |
* @since Mar 22, 2017 |
|
14 |
* |
|
15 |
*/ |
|
16 |
public enum EntityEventType { |
|
17 |
|
|
18 |
ADD, |
|
19 |
EDIT, |
|
20 |
REMOVE; |
|
21 |
|
|
22 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/event/ReferenceEditorAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 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 |
/** |
|
12 |
* @author a.kohlbecker |
|
13 |
* @since Mar 22, 2017 |
|
14 |
* |
|
15 |
*/ |
|
16 |
public class ReferenceEditorAction extends AbstractEditorAction { |
|
17 |
|
|
18 |
/** |
|
19 |
* @param eventType |
|
20 |
*/ |
|
21 |
public ReferenceEditorAction(EditorActionType eventType) { |
|
22 |
super(eventType); |
|
23 |
} |
|
24 |
|
|
25 |
/** |
|
26 |
* @param eventType |
|
27 |
* @param entityId |
|
28 |
*/ |
|
29 |
public ReferenceEditorAction(EditorActionType eventType, Integer entityId) { |
|
30 |
super(eventType, entityId); |
|
31 |
} |
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/event/ReferenceEvent.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 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 |
/** |
|
12 |
* @author a.kohlbecker |
|
13 |
* @since Mar 22, 2017 |
|
14 |
* |
|
15 |
*/ |
|
16 |
public class ReferenceEvent extends AbstractEntityEvent { |
|
17 |
|
|
18 |
/** |
|
19 |
* @param eventType |
|
20 |
*/ |
|
21 |
public ReferenceEvent(EntityEventType eventType) { |
|
22 |
super(eventType); |
|
23 |
} |
|
24 |
|
|
25 |
/** |
|
26 |
* @param eventType |
|
27 |
* @param entityId |
|
28 |
*/ |
|
29 |
public ReferenceEvent(EntityEventType eventType, Integer entityId) { |
|
30 |
super(eventType, entityId); |
|
31 |
} |
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/event/TaxonNameEditorAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 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 |
/** |
|
12 |
* @author a.kohlbecker |
|
13 |
* @since Mar 22, 2017 |
|
14 |
* |
|
15 |
*/ |
|
16 |
public class TaxonNameEditorAction extends AbstractEditorAction { |
|
17 |
|
|
18 |
|
|
19 |
public TaxonNameEditorAction(EditorActionType eventType) { |
|
20 |
super(eventType); |
|
21 |
} |
|
22 |
|
|
23 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/event/TaxonNameEvent.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 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 |
/** |
|
12 |
* @author a.kohlbecker |
|
13 |
* @since Mar 22, 2017 |
|
14 |
* |
|
15 |
*/ |
|
16 |
public class TaxonNameEvent extends AbstractEntityEvent { |
|
17 |
|
|
18 |
|
|
19 |
public TaxonNameEvent(EntityEventType eventType) { |
|
20 |
super(eventType); |
|
21 |
} |
|
22 |
|
|
23 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/event/TypeDesignationEditorAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 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 |
/** |
|
12 |
* @author a.kohlbecker |
|
13 |
* @since Mar 22, 2017 |
|
14 |
* |
|
15 |
*/ |
|
16 |
public class TypeDesignationEditorAction extends AbstractEditorAction { |
|
17 |
|
|
18 |
|
|
19 |
public TypeDesignationEditorAction(EditorActionType eventType) { |
|
20 |
super(eventType); |
|
21 |
} |
|
22 |
|
|
23 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/event/TypeDesignationEvent.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 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 |
/** |
|
12 |
* @author a.kohlbecker |
|
13 |
* @since Mar 22, 2017 |
|
14 |
* |
|
15 |
*/ |
|
16 |
public class TypeDesignationEvent extends AbstractEntityEvent { |
|
17 |
|
|
18 |
|
|
19 |
public TypeDesignationEvent(EntityEventType eventType) { |
|
20 |
super(eventType); |
|
21 |
} |
|
22 |
|
|
23 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationWorkflowPresenter.java | ||
---|---|---|
27 | 27 |
import eu.etaxonomy.cdm.model.reference.Reference; |
28 | 28 |
import eu.etaxonomy.cdm.model.reference.ReferenceFactory; |
29 | 29 |
import eu.etaxonomy.cdm.service.IRegistrationWorkingSetService; |
30 |
import eu.etaxonomy.cdm.vaadin.event.ReferenceEvent;
|
|
30 |
import eu.etaxonomy.cdm.vaadin.event.ReferenceEditorAction;
|
|
31 | 31 |
import eu.etaxonomy.cdm.vaadin.event.ShowDetailsEvent; |
32 | 32 |
import eu.etaxonomy.cdm.vaadin.event.registration.RegistrationWorkflowEvent; |
33 | 33 |
import eu.etaxonomy.cdm.vaadin.model.registration.RegistrationWorkingSet; |
... | ... | |
91 | 91 |
} |
92 | 92 |
|
93 | 93 |
@EventListener(condition = "#event.eventType ==T(eu.etaxonomy.cdm.vaadin.event.EntityEventType).ADD") |
94 |
public void onReferenceAddEvent(ReferenceEvent event) {
|
|
94 |
public void onReferenceAddEvent(ReferenceEditorAction event) {
|
|
95 | 95 |
Reference reference = ReferenceFactory.newGeneric(); |
96 | 96 |
ReferencePopupEditor popup = getNavigationManager().showInPopup(ReferencePopupEditor.class); |
97 | 97 |
popup.showInEditor(reference); |
98 | 98 |
} |
99 | 99 |
|
100 | 100 |
@EventListener(condition = "#event.eventType ==T(eu.etaxonomy.cdm.vaadin.event.EntityEventType).EDIT") |
101 |
public void onReferenceEditEvent(ReferenceEvent event) {
|
|
101 |
public void onReferenceEditEvent(ReferenceEditorAction event) {
|
|
102 | 102 |
Reference reference = getRepo().getReferenceService().find(event.getEntityId()); |
103 | 103 |
ReferencePopupEditor popup = getNavigationManager().showInPopup(ReferencePopupEditor.class); |
104 | 104 |
popup.showInEditor(reference); |
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationWorkflowViewBean.java | ||
---|---|---|
38 | 38 |
import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationStyles; |
39 | 39 |
import eu.etaxonomy.cdm.vaadin.component.registration.TypeStateLabel; |
40 | 40 |
import eu.etaxonomy.cdm.vaadin.component.registration.WorkflowSteps; |
41 |
import eu.etaxonomy.cdm.vaadin.event.EntityEventType;
|
|
42 |
import eu.etaxonomy.cdm.vaadin.event.ReferenceEvent;
|
|
41 |
import eu.etaxonomy.cdm.vaadin.event.EditorActionType;
|
|
42 |
import eu.etaxonomy.cdm.vaadin.event.ReferenceEditorAction;
|
|
43 | 43 |
import eu.etaxonomy.cdm.vaadin.event.ShowDetailsEvent; |
44 |
import eu.etaxonomy.cdm.vaadin.event.TaxonNameEvent;
|
|
44 |
import eu.etaxonomy.cdm.vaadin.event.TaxonNameEditorAction;
|
|
45 | 45 |
import eu.etaxonomy.cdm.vaadin.event.registration.RegistrationWorkflowEvent; |
46 | 46 |
import eu.etaxonomy.cdm.vaadin.model.registration.RegistrationWorkingSet; |
47 | 47 |
import eu.etaxonomy.cdm.vaadin.model.registration.WorkflowStep; |
... | ... | |
232 | 232 |
private void addBulletWorkflowName() { |
233 | 233 |
WorkflowSteps steps = new WorkflowSteps(); |
234 | 234 |
steps.appendNewWorkflowItem(1, "Publication details including the publisher.", |
235 |
e -> eventBus.publishEvent(new ReferenceEvent(EntityEventType.EDIT)));
|
|
235 |
e -> eventBus.publishEvent(new ReferenceEditorAction(EditorActionType.EDIT)));
|
|
236 | 236 |
steps.appendNewWorkflowItem(2, "One or multiple published scientific new names.", |
237 |
e -> eventBus.publishEvent(new TaxonNameEvent(EntityEventType.EDIT)));
|
|
237 |
e -> eventBus.publishEvent(new TaxonNameEditorAction(EditorActionType.EDIT)));
|
|
238 | 238 |
steps.appendNewWorkflowItem(3, "Request for data curation and await approval.", null); |
239 | 239 |
steps.appendNewWorkflowItem(4, "Awaiting publication", null); |
240 | 240 |
getWorkflow().addComponent(steps); |
... | ... | |
246 | 246 |
private void addBulletWorkflowTypification() { |
247 | 247 |
WorkflowSteps steps = new WorkflowSteps(); |
248 | 248 |
steps.appendNewWorkflowItem(1, "Publication details including the publisher.", |
249 |
e -> eventBus.publishEvent(new ReferenceEvent(EntityEventType.EDIT)));
|
|
249 |
e -> eventBus.publishEvent(new ReferenceEditorAction(EditorActionType.EDIT)));
|
|
250 | 250 |
steps.appendNewWorkflowItem(2, "One or multiple published typifications.", |
251 |
e -> eventBus.publishEvent(new TaxonNameEvent(EntityEventType.EDIT)));
|
|
251 |
e -> eventBus.publishEvent(new TaxonNameEditorAction(EditorActionType.EDIT)));
|
|
252 | 252 |
steps.appendNewWorkflowItem(3, "Request for data curation and await approval.", null); |
253 | 253 |
steps.appendNewWorkflowItem(4, "Awaiting publication", null); |
254 | 254 |
getWorkflow().addComponent(steps); |
Also available in: Unified diff
ref #6169 renaming EntityEvents into EditorEvents to better express the purpose