package eu.etaxonomy.cdm.vaadin.view.name;
import java.util.Collection;
+import java.util.EnumSet;
import org.springframework.security.core.GrantedAuthority;
private TeamOrPersonField exCombinationAuthorshipField;
+ private EnumSet<TaxonNamePopupEditorMode> modesActive = EnumSet.noneOf(TaxonNamePopupEditorMode.class);
/**
* @param layout
basionymAuthorshipField.setVisible(enable);
exBasionymAuthorshipField.setVisible(enable);
basionymCombobox.setVisible(enable);
+ if(modesActive.contains(TaxonNamePopupEditorMode.suppressReplacementAuthorshipData)){
+ TaxonName taxonName = getBean();
+ basionymAuthorshipField.setVisible(taxonName.getBasionymAuthorship() != null);
+ }
}
/**
|| taxonName.getExBasionymAuthorship() != null;
basionymToggle.setValue(showBasionymSection);
+ if(modesActive.contains(TaxonNamePopupEditorMode.suppressReplacementAuthorshipData)){
+ combinationAuthorshipField.setVisible(taxonName.getCombinationAuthorship() != null);
+ }
+
}
/**
return exCombinationAuthorshipField;
}
+ @Override
+ public void enableMode(TaxonNamePopupEditorMode mode){
+ modesActive.add(mode);
+ }
+ @Override
+ public void disableMode(TaxonNamePopupEditorMode mode){
+ modesActive.remove(mode);
+ }
}
--- /dev/null
+/**
+* Copyright (C) 2018 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.cdm.vaadin.view.name;
+
+/**
+ * @author a.kohlbecker
+ * @since Jan 11, 2018
+ *
+ */
+public enum TaxonNamePopupEditorMode {
+
+ /**
+ * CombinationAuthorship BasionymAuthorship fields only visible if
+ * not empty
+ */
+ suppressReplacementAuthorshipData
+
+}
import eu.etaxonomy.cdm.vaadin.util.converter.TypeDesignationSetManager.TypeDesignationWorkingSetType;
import eu.etaxonomy.cdm.vaadin.view.name.SpecimenTypeDesignationWorkingsetPopupEditor;
import eu.etaxonomy.cdm.vaadin.view.name.TaxonNamePopupEditor;
+import eu.etaxonomy.cdm.vaadin.view.name.TaxonNamePopupEditorMode;
import eu.etaxonomy.cdm.vaadin.view.name.TypeDesignationWorkingsetEditorIdSet;
import eu.etaxonomy.cdm.vaadin.view.reference.ReferencePopupEditor;
import eu.etaxonomy.vaadin.mvp.AbstractPresenter;
TaxonNamePopupEditor popup = getNavigationManager().showInPopup(TaxonNamePopupEditor.class);
popup.withDeleteButton(true);
+ configureTaxonNameEditor(popup);
popup.loadInEditor(event.getEntityId());
if(event.getSourceComponent() != null){
popup.setReadOnly(event.getSourceComponent().isReadOnly());
}
- // disable NomReferenceCombobox:
- // the in the registration application inReferences should only edited centrally
- // setEnabled must be set at last otherwise it will not be effective
- popup.getNomReferenceCombobox().setEnabled(false);
+
}
TaxonNamePopupEditor popup = getNavigationManager().showInPopup(TaxonNamePopupEditor.class);
popup.grantToCurrentUser(EnumSet.of(CRUD.UPDATE,CRUD.DELETE));
popup.withDeleteButton(true);
+ configureTaxonNameEditor(popup);
popup.loadInEditor(newTaxonNameForRegistration.getId());
// disable NomReferenceCombobox:
// the in the registration application inReferences should only edited centrally
popup.getNomReferenceCombobox().setEnabled(false);
}
+ /**
+ * TODO consider putting this into a Configurer Bean per UIScope.
+ * In the configurator bean this methods popup papamerter should be of the type
+ * AbstractPopupEditor
+ *
+ * @param popup
+ */
+ protected void configureTaxonNameEditor(TaxonNamePopupEditor popup) {
+ popup.enableMode(TaxonNamePopupEditorMode.suppressReplacementAuthorshipData);
+
+ }
+
/**
* Creates a new <code>Registration</code> for a new name that has just been edited
* using the <code>TaxonNamePopupEditor</code>. The new name was previously created