Revision 836df5a3
Added by Katja Luther over 6 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonRelationshipDetailElement.java | ||
---|---|---|
13 | 13 |
import org.eclipse.jface.util.PropertyChangeEvent; |
14 | 14 |
import org.eclipse.swt.SWT; |
15 | 15 |
import org.eclipse.ui.IEditorInput; |
16 |
import org.eclipse.ui.forms.widgets.ExpandableComposite; |
|
16 | 17 |
|
18 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
17 | 19 |
import eu.etaxonomy.cdm.model.reference.Reference; |
18 | 20 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
19 | 21 |
import eu.etaxonomy.cdm.model.taxon.SynonymType; |
... | ... | |
28 | 30 |
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement; |
29 | 31 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
30 | 32 |
import eu.etaxonomy.taxeditor.ui.element.ISelectableElement; |
33 |
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; |
|
31 | 34 |
import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator; |
32 | 35 |
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement; |
33 | 36 |
import eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement; |
... | ... | |
45 | 48 |
|
46 | 49 |
private EntitySelectionElement<Taxon> selection_relatedTaxon; |
47 | 50 |
private CheckboxElement checkBoxDoubtful; |
48 |
protected ToggleableTextElement toggleable_cache;
|
|
51 |
protected ToggleableTextElement toggleable_cache; |
|
49 | 52 |
private EntitySelectionElement<Reference> secReference; |
50 | 53 |
private EntitySelectionElement<Reference> sensuReference; |
51 | 54 |
private TextWithLabelElement text_sensu_microreference; |
52 |
private CheckboxElement checkbox_doubtful; |
|
55 |
|
|
53 | 56 |
|
54 | 57 |
private TextWithLabelElement text_secundum_microreference; |
55 | 58 |
|
56 | 59 |
private TextWithLabelElement text_appendedPhrase; |
57 |
|
|
58 |
private CheckboxElement checkbox_published; |
|
59 |
|
|
60 |
private SelectionArbitrator selectionArbitrator; |
|
60 |
private TaxonDetailSection taxonElement; |
|
61 | 61 |
|
62 | 62 |
|
63 |
|
|
63 | 64 |
private Taxon taxon; |
64 | 65 |
|
65 | 66 |
public TaxonRelationshipDetailElement(CdmFormFactory formFactory, |
66 | 67 |
ICdmFormElement formElement) { |
67 | 68 |
super(formFactory, formElement); |
68 | 69 |
|
70 |
|
|
69 | 71 |
} |
70 | 72 |
|
71 | 73 |
@Override |
... | ... | |
84 | 86 |
checkBoxDoubtful = formFactory.createCheckbox(formElement, "Relation is doubtful", entity.isDoubtful(), style); |
85 | 87 |
}else{ |
86 | 88 |
taxon = entity.getFromTaxon(); |
87 |
toggleable_cache = formFactory.createToggleableTextField(formElement, |
|
88 |
"Title Cache", taxon.getTitleCache(), |
|
89 |
taxon.isProtectedTitleCache(), style); |
|
90 |
|
|
91 |
text_appendedPhrase = formFactory.createTextWithLabelElement( |
|
92 |
formElement, "Appended Phrase", taxon.getAppendedPhrase(), |
|
93 |
SWT.WRAP); |
|
94 |
|
|
95 |
|
|
89 |
taxonElement = formFactory.createTaxonDetailSection(getConversationHolder(), formElement, null, style); |
|
90 |
taxonElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
|
91 |
addControl(taxonElement); |
|
92 |
addElement(taxonElement); |
|
93 |
|
|
96 | 94 |
sensuReference = formFactory.createSelectionElement(Reference.class, |
97 | 95 |
getConversationHolder(), formElement, "Sensu", |
98 | 96 |
taxon.getSec(), EntitySelectionElement.ALL, |
... | ... | |
106 | 104 |
|
107 | 105 |
|
108 | 106 |
|
109 |
checkbox_published = formFactory.createCheckbox(formElement, |
|
110 |
"Published", taxon.isPublish(), style); |
|
111 |
|
|
107 |
|
|
112 | 108 |
|
113 | 109 |
secReference = formFactory.createSelectionElement(Reference.class, |
114 | 110 |
getConversationHolder(), formElement, "Misappl. Sec.", |
... | ... | |
119 | 115 |
formElement, "Detail", |
120 | 116 |
entity.getCitationMicroReference(),null, |
121 | 117 |
SWT.WRAP); |
122 |
checkbox_doubtful = formFactory.createCheckbox(formElement, |
|
123 |
"Misappl. Doubtful", entity.isDoubtful(), style); |
|
118 |
|
|
124 | 119 |
} |
125 | 120 |
|
126 | 121 |
} |
... | ... | |
141 | 136 |
@Override |
142 | 137 |
public void handleEvent(Object eventSource) { |
143 | 138 |
if (getEntity().getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){ |
144 |
if (eventSource== toggleable_cache) { |
|
145 |
handleToggleableCacheField(); |
|
146 |
} else if (eventSource == checkbox_doubtful) { |
|
147 |
taxon.setDoubtful(checkbox_doubtful.getSelection()); |
|
148 |
} else if (eventSource == secReference) { |
|
139 |
if (eventSource == secReference) { |
|
149 | 140 |
getEntity().setCitation(secReference.getSelection()); |
150 |
} else if (eventSource == text_appendedPhrase) { |
|
151 |
taxon.setAppendedPhrase(text_appendedPhrase.getText()); |
|
152 | 141 |
} else if (eventSource == text_secundum_microreference) { |
153 | 142 |
getEntity().setCitationMicroReference(text_secundum_microreference.getText()); |
154 |
} else if (eventSource == checkbox_published) { |
|
155 |
taxon.setPublish(checkbox_published.getSelection()); |
|
156 |
} else if (eventSource == text_sensu_microreference) { |
|
143 |
} else if (eventSource == text_sensu_microreference) { |
|
157 | 144 |
taxon.setSecMicroReference(text_sensu_microreference.getText()); |
158 | 145 |
}else if (eventSource == sensuReference) { |
159 | 146 |
taxon.setSec(sensuReference.getSelection()); |
... | ... | |
174 | 161 |
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null)); |
175 | 162 |
} |
176 | 163 |
|
177 |
protected void handleToggleableCacheField() { |
|
178 |
boolean pushedState = toggleable_cache.getState(); |
|
179 |
|
|
180 |
taxon.setTitleCache(toggleable_cache.getText(), pushedState); |
|
181 |
setIrrelevant(pushedState, Arrays.asList(new Object[] { toggleable_cache, checkbox_published})); |
|
182 |
updateToggleableCacheField(); |
|
183 |
} |
|
184 | 164 |
|
185 |
public void updateToggleableCacheField() { |
|
186 |
if (getEntity().getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){ |
|
187 |
if (toggleable_cache != null){ |
|
188 |
if (!taxon.isProtectedTitleCache()) { |
|
189 |
toggleable_cache.setText(taxon.generateTitle()); |
|
190 |
} |
|
191 |
} |
|
192 |
} |
|
193 |
} |
|
194 | 165 |
|
195 |
@Override |
|
196 |
protected void updateContent() { |
|
197 |
super.updateContent(); |
|
198 |
if (getEntity().getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){ |
|
199 |
|
|
200 |
toggleable_cache.setEnabled(taxon.isProtectedTitleCache()); |
|
201 |
setIrrelevant(toggleable_cache.getState(), |
|
202 |
Arrays.asList(new Object[] { toggleable_cache, checkbox_published})); |
|
203 |
} |
|
204 |
} |
|
166 |
|
|
205 | 167 |
@Override |
206 | 168 |
protected void updateControlStates() { |
207 | 169 |
super.updateControlStates(); |
... | ... | |
219 | 181 |
@Override |
220 | 182 |
public void refresh(){ |
221 | 183 |
updateContent(); |
222 |
updateToggleableCacheField(); |
|
184 |
|
|
223 | 185 |
} |
224 | 186 |
|
187 |
@Override |
|
188 |
public void setEntity(TaxonRelationship entity) { |
|
189 |
super.setEntity(entity); |
|
190 |
if (taxonElement!=null) { |
|
191 |
taxonElement.setEntity(entity.getFromTaxon()); |
|
192 |
} |
|
225 | 193 |
|
226 |
|
|
194 |
} |
|
227 | 195 |
|
228 | 196 |
} |
Also available in: Unified diff
ref #6789: taxon of misapplied name is now clickable and supplemental data enabled