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
|
import java.util.Stack;
|
12
|
import java.util.UUID;
|
13
|
|
14
|
import com.vaadin.ui.Button;
|
15
|
import com.vaadin.ui.Field;
|
16
|
|
17
|
import eu.etaxonomy.cdm.api.service.name.TypeDesignationWorkingSet;
|
18
|
import eu.etaxonomy.cdm.api.service.name.TypeDesignationWorkingSet.TypeDesignationWorkingSetType;
|
19
|
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
|
20
|
import eu.etaxonomy.cdm.model.name.Registration;
|
21
|
import eu.etaxonomy.cdm.ref.TypedEntityReference;
|
22
|
import eu.etaxonomy.vaadin.event.EditorActionType;
|
23
|
import eu.etaxonomy.vaadin.mvp.AbstractView;
|
24
|
|
25
|
/**
|
26
|
* @author a.kohlbecker
|
27
|
* @since Mar 22, 2017
|
28
|
*
|
29
|
*/
|
30
|
public class TypeDesignationWorkingsetEditorAction extends AbstractEditorAction<TypeDesignationWorkingSet> {
|
31
|
|
32
|
private TypeDesignationWorkingSetType workingSetType;
|
33
|
|
34
|
private UUID registrationUuid;
|
35
|
|
36
|
private UUID typifiedNameUuid;
|
37
|
|
38
|
private TypedEntityReference<IdentifiableEntity<?>> baseEntityRef;
|
39
|
|
40
|
/**
|
41
|
* Constructor for {@link EditorActionType#EDIT EDIT} actions
|
42
|
*
|
43
|
* @param baseEntityRef
|
44
|
* @param workingSetType
|
45
|
* @param registrationId
|
46
|
* @param source
|
47
|
* @param sourceView
|
48
|
*/
|
49
|
public TypeDesignationWorkingsetEditorAction(TypedEntityReference<IdentifiableEntity<?>> baseEntityRef,
|
50
|
TypeDesignationWorkingSetType workingSetType,
|
51
|
UUID registrationUuid, UUID typifiedNameUuid,
|
52
|
Button source, Field<TypeDesignationWorkingSet> target, AbstractView sourceView, Stack<EditorActionContext> context) {
|
53
|
super(EditorActionType.EDIT, null, source, target, sourceView);
|
54
|
this.baseEntityRef = baseEntityRef;
|
55
|
this.registrationUuid = registrationUuid;
|
56
|
this.typifiedNameUuid = typifiedNameUuid;
|
57
|
this.workingSetType = workingSetType;
|
58
|
this.context = context;
|
59
|
|
60
|
}
|
61
|
|
62
|
/**
|
63
|
* Constructor for {@link EditorActionType#ADD ADD} actions
|
64
|
*
|
65
|
* @param workingSetType
|
66
|
* @param registrationUuid
|
67
|
* @param source
|
68
|
* @param sourceView
|
69
|
*/
|
70
|
public TypeDesignationWorkingsetEditorAction(TypeDesignationWorkingSetType workingSetType,
|
71
|
UUID registrationUuid, UUID typifiedNameUuid,
|
72
|
Button source, Field<TypeDesignationWorkingSet> target, AbstractView sourceView) {
|
73
|
super(EditorActionType.ADD, null, source, target, sourceView);
|
74
|
this.workingSetType = workingSetType;
|
75
|
this.registrationUuid = registrationUuid;
|
76
|
this.typifiedNameUuid = typifiedNameUuid;
|
77
|
this.context = new Stack<>();
|
78
|
this.context.push(new EditorActionContext(new TypedEntityReference<Registration>(Registration.class, registrationUuid), sourceView));
|
79
|
}
|
80
|
|
81
|
|
82
|
|
83
|
/**
|
84
|
*
|
85
|
* @return
|
86
|
*/
|
87
|
public TypeDesignationWorkingSetType getWorkingSetType() {
|
88
|
return workingSetType;
|
89
|
}
|
90
|
|
91
|
/**
|
92
|
* @return the registrationUuid
|
93
|
*/
|
94
|
public UUID getRegistrationUuid() {
|
95
|
return registrationUuid;
|
96
|
}
|
97
|
|
98
|
public UUID getTypeDesignationWorkingsetUuid(){
|
99
|
return getEntityUuid();
|
100
|
}
|
101
|
|
102
|
/**
|
103
|
* @return the baseEntityRef
|
104
|
*/
|
105
|
public TypedEntityReference<IdentifiableEntity<?>> getBaseEntityRef() {
|
106
|
return baseEntityRef;
|
107
|
}
|
108
|
|
109
|
/**
|
110
|
* @return the typifiedNameUuid
|
111
|
*/
|
112
|
public UUID getTypifiedNameUuid() {
|
113
|
return typifiedNameUuid;
|
114
|
}
|
115
|
|
116
|
|
117
|
}
|