private EntitySelectionElement<Taxon> selection_reuseExistingTaxon;
private EntitySelectionElement<Reference> selection_SecRef;
private EntitySelectionElement<Reference> selection_Ref;
+ TextWithLabelElement textTaxonSec;
private TextWithLabelElement microReference;
private Taxon taxon;
TextWithLabelElement textClassification = formFactory.createTextWithLabelElement(formElement,"Classification", entity.getClassification().getTitleCache(), style);
textClassification.setEnabled(false);
- TextWithLabelElement textTaxon = formFactory.createTextWithLabelElement(formElement,"Taxon", taxon.getTitleCache(), style);
- textTaxon.setEnabled(false);
+// TextWithLabelElement textTaxon = formFactory.createTextWithLabelElement(formElement,"Taxon", taxon.getTitleCache(), style);
+// textTaxon.setEnabled(false);
- TextWithLabelElement textTaxonSec = formFactory.createTextWithLabelElement(formElement,"Secundum Reference", "", style);
+ selection_reuseExistingTaxon = formFactory
+ .createSelectionElement(Taxon.class,//getConversationHolder(),
+ formElement,
+ "Reuse existing taxon", taxon,
+ EntitySelectionElement.DELETABLE, style);
+
+ textTaxonSec = formFactory.createTextWithLabelElement(formElement,"Secundum Reference", "", style);
if (entity.getTaxon().getSec() != null){
textTaxonSec.setText(taxon.getSec().getTitleCache());
}
if (eventSource == selection_parentTaxonNode) {
setParentTreeNode(selection_parentTaxonNode.getEntity());
} else if (eventSource == selection_reuseExistingTaxon) {
- boolean enabled = selection_reuseExistingTaxon.getEntity() == null;
- selection_reuseExistingName.setEnabled(enabled);
- if (!enabled){
- setTaxon(selection_reuseExistingTaxon.getEntity());
- }else{
- textNewTaxonName.setText(null);
- }
- complete = !textNewTaxonName.getText().isEmpty();
-
-
+ if (selection_reuseExistingTaxon.getEntity() != null){
+ setTaxon(selection_reuseExistingTaxon.getEntity());
+ }
+ complete = true;
} else if (eventSource == selection_reuseExistingName) {
boolean enabled = selection_reuseExistingName.getEntity() == null;
setTaxon(HibernateProxyHelper.deproxy(selection_reuseExistingName.getEntity()));
getEntity().setTaxon(taxon);
if (isCreateNew()){
textNewTaxonName.setText(taxon.getName().getTitleCache());
+ if (taxon.getSec() != null){
+ selection_SecRef.setEntity(taxon.getSec());
+ }
+ }else{
+ if (taxon.getSec() != null) {
+ this.textTaxonSec.setText(taxon.getSec().getTitleCache());
+ }
}
- selection_SecRef.setEntity(taxon.getSec());
+
+
}
private void setTaxon(TaxonName taxonName) {