selection_parentTaxonNode = formFactory
.createTaxonNodeSelectionElement(getConversationHolder(), formElement, "Parent", null,
EntitySelectionElement.DELETABLE, style);
- selection_SecRef = formFactory
- .createSelectionElement(Reference.class,getConversationHolder(), formElement, "Secundum Reference", 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();
}
}
}
+
}
}
}
textNewTaxonName.setEnabled(enabled);
if (!enabled){
setTaxon(selection_reuseExistingTaxon.getEntity());
+ } else{
+ textNewTaxonName.setText(null);
}
complete = !textNewTaxonName.getText().isEmpty();
selection_reuseExistingTaxon.setEnabled(enabled);
textNewTaxonName.setEnabled(enabled);
- //setTaxon(selection_reuseExistingName.getEntity());
+ setTaxon(selection_reuseExistingName.getEntity());
complete = !textNewTaxonName.getText().isEmpty();
} else if (eventSource == textNewTaxonName) {
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 setTaxon(Taxon taxon) {
this.taxon = taxon;
textNewTaxonName.setText(taxon.getName().getTitleCache());
- this.secReference = taxon.getSec();
+ selection_SecRef.setEntity(taxon.getSec());
}
private void setTaxon(String taxonNameString) {
private void setTaxon(TaxonNameBase taxonName) {
Reference secundum = null;
if (getParentTreeNode() != null) {
- if (this.secReference != null){
- secundum = this.secReference;
- } else 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);
- //textNewTaxonName.setText(taxonName.getTitleCache());
}
private void setOpenInEditor(boolean openInEditor) {