import java.util.Arrays;
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
+import eu.etaxonomy.cdm.model.name.INonViralName;
+import eu.etaxonomy.cdm.model.name.IZoologicalName;
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
-import eu.etaxonomy.cdm.model.name.NonViralName;
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
-import eu.etaxonomy.cdm.model.name.ZoologicalName;
-import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.event.EventUtility;
+import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
+import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
* @version 1.0
*/
public class AuthorshipDetailElement extends
- AbstractIdentifiableEntityDetailElement<NonViralName> {
+ AbstractIdentifiableEntityDetailElement<INonViralName> {
private EntitySelectionElement<TeamOrPersonBase> selectionExBasionymAuthor;
private EntitySelectionElement<TeamOrPersonBase> selectionBasionymAuthor;
/** {@inheritDoc} */
@Override
protected void createControls(ICdmFormElement formElement,
- NonViralName entity, int style) {
- if (isAdvancedView || PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE)){
+ INonViralName entity, int style) {
+ NameDetailsConfigurator config = PreferencesUtil.getPreferredNameDetailsConfiguration();
+ if (config == null || config.isAuthorCacheActivated()){
toggleable_cache = formFactory.createToggleableTextField(this,
"Authorship Cache", entity.getAuthorshipCache(),
entity.isProtectedAuthorshipCache(), style);
- toggleable_cache.setVisible(false);
+ addElement(toggleable_cache);
+ }
+ NomenclaturalCode code = entity.getNameType();
- }
- NomenclaturalCode code = entity.getNomenclaturalCode();
-
- if (isAdvancedView || PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP)){
+ if (config == null || config.isAuthorshipSectionActivated()){
selectionCombinationAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
getConversationHolder(),
formElement, "Author",
entity.getCombinationAuthorship(),
- EntitySelectionElement.ALL, style);
+ EntitySelectionElement.DELETABLE | EntitySelectionElement.SELECTABLE | EntitySelectionElement.EDITABLE, style);
addElement(selectionCombinationAuthor);
selectionExCombinationAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
getConversationHolder(),
formElement, "Ex Author",
entity.getExCombinationAuthorship(),
- EntitySelectionElement.ALL, style);
+ EntitySelectionElement.DELETABLE | EntitySelectionElement.SELECTABLE | EntitySelectionElement.EDITABLE, style);
addElement(selectionExCombinationAuthor);
if (code != null){
if (code.equals(NomenclaturalCode.ICZN)){
- text_publicationYear = formFactory.createNumberTextWithLabelElement(formElement, "Publication Year", ((ZoologicalName)entity).getPublicationYear(), style);
+ text_publicationYear = formFactory.createNumberTextWithLabelElement(formElement, "Publication Year", ((IZoologicalName)entity).getPublicationYear(), style);
}
}
selectionBasionymAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class, getConversationHolder(),
formElement, "Basionym Author", entity.getBasionymAuthorship(),
- EntitySelectionElement.ALL, style);
+ EntitySelectionElement.DELETABLE | EntitySelectionElement.SELECTABLE | EntitySelectionElement.EDITABLE, style);
addElement(selectionBasionymAuthor);
selectionExBasionymAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class, getConversationHolder(),
formElement, "Ex Basionym Author",entity.getExBasionymAuthorship(),
- EntitySelectionElement.ALL, style);
+ EntitySelectionElement.DELETABLE | EntitySelectionElement.SELECTABLE | EntitySelectionElement.EDITABLE, style);
addElement(selectionExBasionymAuthor);
if (code != null){
if (code.equals(NomenclaturalCode.ICZN)){
- text_originalPublicationYear = formFactory.createNumberTextWithLabelElement(formElement, "Orig. Publication Year", ((ZoologicalName)entity).getOriginalPublicationYear(), style);
+ text_originalPublicationYear = formFactory.createNumberTextWithLabelElement(formElement, "Orig. Publication Year", ((IZoologicalName)entity).getOriginalPublicationYear(), style);
}
}
getEntity().setExBasionymAuthorship(
selectionExBasionymAuthor.getSelection());
} else if (eventSource == text_originalPublicationYear) {
- ((ZoologicalName)getEntity()).setOriginalPublicationYear(text_originalPublicationYear.getInteger());
+ ((IZoologicalName)getEntity()).setOriginalPublicationYear(text_originalPublicationYear.getInteger());
} else if (eventSource == text_publicationYear) {
- ((ZoologicalName)getEntity()).setPublicationYear(text_publicationYear.getInteger());
+ ((IZoologicalName)getEntity()).setPublicationYear(text_publicationYear.getInteger());
}
// if (eventSource != toggleable_cache) {
// if (getParentElement() instanceof AbstractCdmDetailSection)
firePropertyChangeEvent(new CdmPropertyChangeEvent(
getParentElement(), null));
+ EventUtility.postEvent(WorkbenchEventConstants.REFRESH_NAME_EDITOR, this.getEntity());
}
@Override