Project

General

Profile

Download (1.96 KB) Statistics
| Branch: | Tag: | Revision:
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 com.vaadin.ui.Component;
12

    
13
import eu.etaxonomy.vaadin.mvp.AbstractView;
14

    
15
/**
16
 * @author a.kohlbecker
17
 * @since Mar 22, 2017
18
 *
19
 */
20
public abstract class AbstractEditorAction extends AbstractEntityEvent<AbstractEditorAction.Action> {
21

    
22
    public enum Action {
23
        ADD,
24
        EDIT,
25
        REMOVE;
26
    }
27

    
28
    private Component sourceComponent = null;
29

    
30
    private AbstractView sourceView = null;
31

    
32
    public AbstractEditorAction(Action action) {
33
        super(action, null);
34
    }
35

    
36
    public AbstractEditorAction(Action action, Component source) {
37
        this(action, null, source);
38
    }
39

    
40
    /**
41
     * @param type
42
     * @param citationId
43
     */
44
    public AbstractEditorAction(Action action, Integer entityId) {
45
        super(action, entityId);
46
    }
47

    
48
    public AbstractEditorAction(Action action, Integer entityId, Component source) {
49
        super(action, entityId);
50
        this.sourceComponent = source;
51
    }
52

    
53
    public AbstractEditorAction(Action action, Integer entityId, Component source, AbstractView sourceView) {
54
        super(action, entityId);
55
        this.sourceComponent = source;
56
        this.sourceView = sourceView;
57
    }
58

    
59
    public boolean isAddAction() {
60
        return type.equals(Action.ADD);
61
    }
62

    
63
    public boolean isEditAction() {
64
        return type.equals(Action.EDIT);
65
    }
66

    
67
    public boolean isRemoveAction() {
68
        return type.equals(Action.REMOVE);
69
    }
70

    
71
    public Component getSourceComponent(){
72
        return sourceComponent;
73
    }
74

    
75
    public boolean hasSource() {
76
        return sourceComponent != null;
77
    }
78

    
79
    /**
80
     * @return the sourceView
81
     */
82
    public AbstractView getSourceView() {
83
        return sourceView;
84
    }
85

    
86

    
87
}
(1-1/18)