15 |
15 |
|
16 |
16 |
import eu.etaxonomy.cdm.common.CdmUtils;
|
17 |
17 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
|
|
18 |
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
|
|
19 |
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
|
18 |
20 |
import eu.etaxonomy.cdm.model.name.TaxonName;
|
19 |
21 |
import eu.etaxonomy.cdm.model.reference.Reference;
|
20 |
22 |
import eu.etaxonomy.cdm.model.taxon.Classification;
|
21 |
23 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
|
22 |
24 |
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
23 |
25 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
|
26 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
|
|
27 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
|
24 |
28 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
25 |
29 |
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
|
26 |
30 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
... | ... | |
65 |
69 |
private CheckboxElement checkbox_unplaced;
|
66 |
70 |
|
67 |
71 |
private CheckboxElement checkbox_excluded;
|
|
72 |
private CheckboxElement checkbox_publish;
|
68 |
73 |
|
69 |
|
private MultilanguageTextElement multiLanguageTextExcludedNotes;
|
|
74 |
|
|
75 |
|
|
76 |
private MultilanguageTextElement multiLanguageTextExcludedNotes;
|
70 |
77 |
|
71 |
78 |
private boolean openInEditor;
|
72 |
79 |
|
... | ... | |
83 |
90 |
createNew = isCreateNew;
|
84 |
91 |
}
|
85 |
92 |
|
|
93 |
|
|
94 |
|
86 |
95 |
/** {@inheritDoc} */
|
87 |
96 |
@Override
|
88 |
97 |
protected void createControls(ICdmFormElement formElement,
|
... | ... | |
149 |
158 |
"Taxon is excluded", ((TaxonNode)entity).isExcluded(), style);
|
150 |
159 |
multiLanguageTextExcludedNotes = formFactory.createMultiLanguageTextElement(formElement, "Excluded Notes", ((TaxonNode)entity).getExcludedNote(), 50, style);
|
151 |
160 |
multiLanguageTextExcludedNotes.setEnabled(((TaxonNode) entity).isExcluded());
|
|
161 |
|
|
162 |
checkbox_publish = formFactory.createCheckbox(formElement,
|
|
163 |
"Taxon is public", ((TaxonNode)entity).getTaxon().isPublish(), style);
|
|
164 |
|
|
165 |
if(isCreateNew()){
|
|
166 |
CdmPreference defaultPublish = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DefaultBehaviourForPublishFlag);
|
|
167 |
if (defaultPublish != null && defaultPublish.getValue().equals(IPreferenceKeys.PUBLISH)){
|
|
168 |
checkbox_publish.setSelection(true);
|
|
169 |
} else if (defaultPublish != null && defaultPublish.getValue().equals(IPreferenceKeys.DO_NOT_PUBLISH)){
|
|
170 |
checkbox_publish.setSelection(false);
|
|
171 |
}else{
|
|
172 |
if((this.getParentTreeNode()).isInstanceOf(TaxonNode.class)){
|
|
173 |
checkbox_publish.setSelection(((TaxonNode)this.getParentTreeNode()).getTaxon().isPublish());
|
|
174 |
}else{
|
|
175 |
checkbox_publish.setSelection(true);
|
|
176 |
}
|
|
177 |
}
|
|
178 |
}
|
152 |
179 |
}
|
153 |
180 |
checkbox_openInEditor = formFactory.createCheckbox(formElement,
|
154 |
181 |
"Open in Editor", true, style);
|
... | ... | |
232 |
259 |
((TaxonNode)getEntity()).setUnplaced(unplaced);
|
233 |
260 |
} else if (eventSource == checkbox_openInEditor) {
|
234 |
261 |
setOpenInEditor(checkbox_openInEditor.getSelection());
|
235 |
|
} else if (eventSource == selectionNodeAgentRelation){
|
|
262 |
} else if (eventSource == checkbox_publish) {
|
|
263 |
((TaxonNode)getEntity()).getTaxon().setPublish(checkbox_publish.getSelection());
|
|
264 |
}else if (eventSource == selectionNodeAgentRelation){
|
236 |
265 |
boolean allComplete = true;
|
237 |
266 |
for (ICdmFormElement element : selectionNodeAgentRelation.getElements()){
|
238 |
267 |
allComplete &=((TaxonNodeAgentRelationCollectionElement)element).isComplete();
|
... | ... | |
271 |
300 |
classification = HibernateProxyHelper
|
272 |
301 |
.deproxy(((TaxonNode) parentTreeNode).getClassification());
|
273 |
302 |
selection_classification.setEntity(classification);
|
274 |
|
selection_parentTaxonNode.setEntity((TaxonNode) parentTreeNode);
|
|
303 |
selection_parentTaxonNode.setEntity(HibernateProxyHelper
|
|
304 |
.deproxy((TaxonNode) parentTreeNode));
|
275 |
305 |
selection_parentTaxonNode.setClassification(classification);
|
276 |
306 |
selection_SecRef.setEntity(((TaxonNode)parentTreeNode).getTaxon().getSec());
|
277 |
307 |
} else if(parentTreeNode == null){
|
... | ... | |
358 |
388 |
return unplaced;
|
359 |
389 |
}
|
360 |
390 |
|
|
391 |
public boolean is_publish() {
|
|
392 |
return checkbox_publish.getSelection();
|
|
393 |
}
|
|
394 |
|
|
395 |
public void set_publish(boolean publish) {
|
|
396 |
this.checkbox_publish.setSelection(publish);
|
|
397 |
}
|
|
398 |
|
361 |
399 |
}
|
add publish flag to newTaxonNodeWizard