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.TypeDesignationSet;
|
18
|
import eu.etaxonomy.cdm.api.service.name.TypeDesignationSet.TypeDesignationSetType;
|
19
|
import eu.etaxonomy.cdm.model.common.VersionableEntity;
|
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
|
public class TypeDesignationSetEditorAction extends AbstractEditorAction<TypeDesignationSet> {
|
30
|
|
31
|
private TypeDesignationSetType workingSetType;
|
32
|
|
33
|
private UUID registrationUuid;
|
34
|
|
35
|
private UUID typifiedNameUuid;
|
36
|
|
37
|
private VersionableEntity baseEntity;
|
38
|
|
39
|
/**
|
40
|
* Constructor for {@link EditorActionType#EDIT EDIT} actions
|
41
|
*/
|
42
|
public TypeDesignationSetEditorAction(VersionableEntity baseEntity,
|
43
|
TypeDesignationSetType workingSetType,
|
44
|
UUID registrationUuid, UUID typifiedNameUuid,
|
45
|
Button source, Field<TypeDesignationSet> target, AbstractView sourceView, Stack<EditorActionContext> context) {
|
46
|
|
47
|
super(EditorActionType.EDIT, null, source, target, sourceView);
|
48
|
this.baseEntity = baseEntity;
|
49
|
this.registrationUuid = registrationUuid;
|
50
|
this.typifiedNameUuid = typifiedNameUuid;
|
51
|
this.workingSetType = workingSetType;
|
52
|
this.context = context;
|
53
|
}
|
54
|
|
55
|
/**
|
56
|
* Constructor for {@link EditorActionType#ADD ADD} actions
|
57
|
*
|
58
|
* @param workingSetType
|
59
|
* @param registrationUuid
|
60
|
* @param source
|
61
|
* @param sourceView
|
62
|
*/
|
63
|
public TypeDesignationSetEditorAction(TypeDesignationSetType workingSetType,
|
64
|
UUID registrationUuid, UUID typifiedNameUuid,
|
65
|
Button source, Field<TypeDesignationSet> target, AbstractView sourceView) {
|
66
|
|
67
|
super(EditorActionType.ADD, null, source, target, sourceView);
|
68
|
this.workingSetType = workingSetType;
|
69
|
this.registrationUuid = registrationUuid;
|
70
|
this.typifiedNameUuid = typifiedNameUuid;
|
71
|
this.context = new Stack<>();
|
72
|
this.context.push(new EditorActionContext(new TypedEntityReference<Registration>(Registration.class, registrationUuid), sourceView));
|
73
|
}
|
74
|
|
75
|
public TypeDesignationSetType getWorkingSetType() {
|
76
|
return workingSetType;
|
77
|
}
|
78
|
|
79
|
public UUID getRegistrationUuid() {
|
80
|
return registrationUuid;
|
81
|
}
|
82
|
|
83
|
public UUID getTypeDesignationSetUuid(){
|
84
|
return getEntityUuid();
|
85
|
}
|
86
|
|
87
|
public VersionableEntity getBaseEntity() {
|
88
|
return baseEntity;
|
89
|
}
|
90
|
|
91
|
public UUID getTypifiedNameUuid() {
|
92
|
return typifiedNameUuid;
|
93
|
}
|
94
|
|
95
|
}
|