Revision 30c956e4
Added by Katja Luther about 6 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonOfRelationshipElement.java | ||
---|---|---|
1 | 1 |
package eu.etaxonomy.taxeditor.ui.section.taxon; |
2 | 2 |
|
3 | 3 |
import java.util.Arrays; |
4 |
import java.util.List; |
|
5 |
import java.util.Set; |
|
6 | 4 |
|
7 |
import org.eclipse.jface.util.IPropertyChangeListener; |
|
8 |
import org.eclipse.jface.util.PropertyChangeEvent; |
|
9 | 5 |
import org.eclipse.swt.SWT; |
10 |
import org.eclipse.swt.events.ModifyEvent; |
|
11 |
import org.eclipse.swt.events.ModifyListener; |
|
12 |
import org.eclipse.swt.graphics.Color; |
|
13 |
import org.eclipse.swt.widgets.Composite; |
|
14 |
import org.eclipse.swt.widgets.Control; |
|
15 | 6 |
|
16 | 7 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
17 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
|
18 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; |
|
19 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; |
|
20 |
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement; |
|
21 | 8 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
22 |
import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent; |
|
23 | 9 |
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement; |
24 | 10 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
25 |
import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement; |
|
26 |
import eu.etaxonomy.taxeditor.ui.element.IEntityElement; |
|
27 |
import eu.etaxonomy.taxeditor.ui.element.ISelectable; |
|
11 |
import eu.etaxonomy.taxeditor.ui.element.ISelectableElement; |
|
28 | 12 |
import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator; |
29 | 13 |
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement; |
30 | 14 |
import eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement; |
31 |
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; |
|
32 | 15 |
import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement; |
33 | 16 |
|
34 |
public class TaxonOfRelationshipElement extends AbstractIdentifiableEntityDetailElement<Taxon>{ |
|
35 |
|
|
36 |
// private Taxon taxon;
|
|
17 |
public class TaxonOfRelationshipElement extends AbstractIdentifiableEntityDetailElement<Taxon> implements ISelectableElement{
|
|
18 |
|
|
19 |
// private Taxon taxon; |
|
37 | 20 |
protected ToggleableTextElement toggleable_cache; |
38 | 21 |
private TextWithLabelElement text_appendedPhrase; |
39 | 22 |
private SelectionArbitrator selectionArbitrator; |
40 |
private CheckboxElement checkbox_doubtful; |
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
private CheckboxElement checkbox_doubtful; |
|
41 | 28 |
|
42 | 29 |
private CheckboxElement checkbox_published; |
43 |
|
|
30 |
|
|
44 | 31 |
public TaxonOfRelationshipElement(CdmFormFactory formFactory, ICdmFormElement formElement, int style ) { |
45 | 32 |
super(formFactory, formElement); |
46 | 33 |
// make this element selectable |
47 | 34 |
if(formFactory.getSelectionProvider() != null){ |
48 | 35 |
selectionArbitrator = formFactory.createSelectionArbitrator(this); |
49 | 36 |
} |
50 |
} |
|
51 | 37 |
|
38 |
} |
|
52 | 39 |
|
53 |
|
|
54 |
protected void handleToggleableCacheField() {
|
|
40 |
@Override |
|
41 |
protected void handleToggleableCacheField() {
|
|
55 | 42 |
boolean pushedState = toggleable_cache.getState(); |
56 | 43 |
|
57 | 44 |
getEntity().setTitleCache(toggleable_cache.getText(), pushedState); |
58 | 45 |
setIrrelevant(pushedState, Arrays.asList(new Object[] { toggleable_cache, checkbox_published})); |
59 | 46 |
updateToggleableCacheField(); |
60 | 47 |
} |
61 |
|
|
62 |
public void updateToggleableCacheField() { |
|
63 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
@Override |
|
52 |
public void updateToggleableCacheField() { |
|
53 |
|
|
64 | 54 |
if (toggleable_cache != null){ |
65 | 55 |
if (!getEntity().isProtectedTitleCache()) { |
66 | 56 |
toggleable_cache.setText(getEntity().generateTitle()); |
67 | 57 |
} |
68 | 58 |
} |
69 | 59 |
} |
70 |
|
|
60 |
|
|
71 | 61 |
@Override |
72 | 62 |
public void refresh(){ |
73 | 63 |
updateContent(); |
74 | 64 |
updateToggleableCacheField(); |
75 | 65 |
} |
76 |
|
|
66 |
|
|
77 | 67 |
@Override |
78 | 68 |
protected void updateContent() { |
79 | 69 |
super.updateContent(); |
80 | 70 |
toggleable_cache.setEnabled(getEntity().isProtectedTitleCache()); |
81 | 71 |
setIrrelevant(toggleable_cache.getState(), |
82 | 72 |
Arrays.asList(new Object[] { toggleable_cache, checkbox_published})); |
83 |
|
|
73 |
firePropertyChangeEvent(getEntity()); |
|
74 |
|
|
84 | 75 |
} |
85 | 76 |
|
86 |
|
|
77 |
|
|
87 | 78 |
|
88 | 79 |
@Override |
89 | 80 |
protected void createControls(ICdmFormElement formElement, Taxon entity, int style) { |
... | ... | |
94 | 85 |
text_appendedPhrase = formFactory.createTextWithLabelElement( |
95 | 86 |
this, "Appended Phrase", getEntity().getAppendedPhrase(), |
96 | 87 |
SWT.WRAP); |
97 |
|
|
88 |
|
|
98 | 89 |
checkbox_published = formFactory.createCheckbox(this, |
99 | 90 |
"Published", getEntity().isPublish(), style); |
100 |
|
|
91 |
|
|
101 | 92 |
checkbox_doubtful = formFactory.createCheckbox(this, |
102 | 93 |
"Misappl. Doubtful", getEntity().isDoubtful(), style); |
103 |
|
|
94 |
|
|
104 | 95 |
} |
105 | 96 |
|
106 | 97 |
|
... | ... | |
116 | 107 |
} else if (eventSource == checkbox_published) { |
117 | 108 |
getEntity().setPublish(checkbox_published.getSelection()); |
118 | 109 |
} |
119 |
|
|
110 |
|
|
120 | 111 |
} |
121 | 112 |
|
113 |
@Override |
|
114 |
public SelectionArbitrator getSelectionArbitrator() { |
|
115 |
return selectionArbitrator; |
|
116 |
} |
|
122 | 117 |
|
123 | 118 |
|
124 | 119 |
|
Also available in: Unified diff
smaller changes for updating editor when changing taxon in misapplied name relationship