private ITaxonTreeNode parentTreeNode;
private EntitySelectionElement<Taxon> selection_reuseExistingTaxon;
+ private EntitySelectionElement<Reference> selection_SecRef;
private Taxon taxon;
+ private Reference secReference;
+
private TextWithLabelElement textNewTaxonName;
private CheckboxElement checkbox_openInEditor;
selection_parentTaxonNode = formFactory
.createTaxonNodeSelectionElement(getConversationHolder(), formElement, "Parent", null,
EntitySelectionElement.DELETABLE, style);
+
selection_reuseExistingTaxon = formFactory
.createSelectionElement(Taxon.class,
getConversationHolder(), formElement,
getConversationHolder(), formElement,
"Reuse existing name", null,
EntitySelectionElement.DELETABLE, style);
-
+ selection_SecRef = formFactory
+ .createSelectionElement(Reference.class,getConversationHolder(), formElement, "Secundum Reference", null,
+ EntitySelectionElement.DELETABLE, style);
textNewTaxonName = formFactory.createTextWithLabelElement(formElement,
"New Taxon", "", style);
textNewTaxonName.setFocus();
}
}
}
+
}
}
}
setClassification(selection_classification.getEntity());
} else if (eventSource == selection_parentTaxonNode) {
setParentTreeNode(selection_parentTaxonNode.getEntity());
+ } else if (eventSource == selection_SecRef) {
+ setSecReference(selection_SecRef.getEntity());
} else if (eventSource == selection_reuseExistingTaxon) {
- boolean enabled = selection_reuseExistingTaxon.getEntity() == null;
- selection_reuseExistingName.setEnabled(enabled);
- textNewTaxonName.setEnabled(enabled);
+ boolean enabled = selection_reuseExistingTaxon.getEntity() == null;
+ selection_reuseExistingName.setEnabled(enabled);
+ textNewTaxonName.setEnabled(enabled);
+ if (!enabled){
+ setTaxon(selection_reuseExistingTaxon.getEntity());
+ } else{
+ textNewTaxonName.setText(null);
+ }
+ complete = !textNewTaxonName.getText().isEmpty();
+
- setTaxon(selection_reuseExistingTaxon.getEntity());
} else if (eventSource == selection_reuseExistingName) {
- boolean enabled = selection_reuseExistingName.getEntity() == null;
+ boolean enabled = selection_reuseExistingName.getEntity() == null;
+ setTaxon(selection_reuseExistingName.getEntity());
selection_reuseExistingTaxon.setEnabled(enabled);
textNewTaxonName.setEnabled(enabled);
setTaxon(selection_reuseExistingName.getEntity());
+
+ complete = !textNewTaxonName.getText().isEmpty();
} else if (eventSource == textNewTaxonName) {
- boolean enabled = CdmUtils.isEmpty(textNewTaxonName.getText());
+ boolean enabled = CdmUtils.isBlank(textNewTaxonName.getText());
selection_reuseExistingTaxon.setEnabled(enabled);
selection_reuseExistingName.setEnabled(enabled);
selection_classification.setEntity(classification);
selection_parentTaxonNode.setEntity(null);
selection_parentTaxonNode.setClassification(classification);
+ selection_SecRef.setEntity(classification.getReference());
} else if (parentTreeNode instanceof TaxonNode) {
classification = (Classification) HibernateProxyHelper
.deproxy(((TaxonNode) parentTreeNode).getClassification());
selection_classification.setEntity(classification);
selection_parentTaxonNode.setEntity((TaxonNode) parentTreeNode);
selection_parentTaxonNode.setClassification(classification);
+ selection_SecRef.setEntity(((TaxonNode)parentTreeNode).getTaxon().getSec());
} else if(parentTreeNode == null){
this.parentTreeNode = selection_classification.getEntity();
}
}
+ private void setSecReference(Reference secRef){
+ this.secReference = secRef;
+ setTaxon(textNewTaxonName.getText());
+ }
+
private void setTaxon(Taxon taxon) {
this.taxon = taxon;
+ textNewTaxonName.setText(taxon.getName().getTitleCache());
+ selection_SecRef.setEntity(taxon.getSec());
}
private void setTaxon(String taxonNameString) {
private void setTaxon(TaxonNameBase taxonName) {
Reference secundum = null;
if (getParentTreeNode() != null) {
- if (getParentTreeNode() instanceof Classification) {
+ if (this.selection_SecRef.getEntity() != null){
+ secundum = this.selection_SecRef.getEntity();
+ } /*else if (getParentTreeNode() instanceof Classification) {
secundum = ((Classification) getParentTreeNode())
.getReference();
} else if (getParentTreeNode() instanceof TaxonNode) {
secundum = ((TaxonNode) getParentTreeNode()).getTaxon()
.getSec();
- }
+ }*/
+ }
+ if (taxonName != null){
+ taxon = Taxon.NewInstance(taxonName, secundum);
+ if (!taxonName.getTitleCache().trim().equals(textNewTaxonName.getText().trim())){
+ textNewTaxonName.setText(taxonName.getTitleCache());
+ }
+ } else {
+ textNewTaxonName.setText(null);
}
- taxon = Taxon.NewInstance(taxonName, secundum);
}
private void setOpenInEditor(boolean openInEditor) {