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 com.vaadin.ui.Field;
|
12
|
|
13
|
import eu.etaxonomy.vaadin.mvp.AbstractPopupEditor;
|
14
|
import eu.etaxonomy.vaadin.mvp.AbstractView;
|
15
|
import eu.etaxonomy.vaadin.util.PropertyIdPath;
|
16
|
|
17
|
public class EditorActionContext {
|
18
|
|
19
|
Object parentEntity;
|
20
|
|
21
|
AbstractView parentView;
|
22
|
|
23
|
/**
|
24
|
* The field in the parent view to which the child view is related to.
|
25
|
*/
|
26
|
Field<?> targetField;
|
27
|
|
28
|
/**
|
29
|
* @param parentEntity
|
30
|
* @param parentView
|
31
|
*/
|
32
|
public EditorActionContext(Object parentEntity, AbstractView parentView) {
|
33
|
super();
|
34
|
this.parentEntity = parentEntity;
|
35
|
this.parentView = parentView;
|
36
|
}
|
37
|
|
38
|
/**
|
39
|
* TODO rename to getParentBean()
|
40
|
*
|
41
|
* @return the parentEntity
|
42
|
*/
|
43
|
public Object getParentEntity() {
|
44
|
return parentEntity;
|
45
|
}
|
46
|
|
47
|
/**
|
48
|
* @return the parentView
|
49
|
*/
|
50
|
public AbstractView getParentView() {
|
51
|
return parentView;
|
52
|
}
|
53
|
|
54
|
/**
|
55
|
* @param targetField
|
56
|
*/
|
57
|
public void setTargetField(Field<?> targetField) {
|
58
|
this.targetField = targetField;
|
59
|
}
|
60
|
|
61
|
public Field<?> getTargetField() {
|
62
|
return targetField;
|
63
|
}
|
64
|
|
65
|
public PropertyIdPath getTargetPropertyIdPath(){
|
66
|
if(parentView instanceof AbstractPopupEditor && targetField != null){
|
67
|
return ((AbstractPopupEditor)getParentView()).boundPropertyIdPath(targetField);
|
68
|
} else {
|
69
|
return null;
|
70
|
}
|
71
|
}
|
72
|
|
73
|
|
74
|
|
75
|
}
|