// $Id$
/**
* Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy
+ * 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.
*/
import java.util.Arrays;
-import eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor;
+import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
import eu.etaxonomy.cdm.model.name.NonViralName;
-import eu.etaxonomy.taxeditor.model.AuthorHelper;
-import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
-import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
-import eu.etaxonomy.taxeditor.ui.selection.NomenclaturalAuthorTeamSelectionElement;
/**
* <p>
* AuthorshipDetailElement class.
* </p>
- *
+ *
* @author n.hoffmann
* @created Mar 4, 2010
* @version 1.0
*/
public class AuthorshipDetailElement extends
- AbstractIdentifiableEntityDetailElement<NonViralName> implements
- IEnableableFormElement {
-
- private NomenclaturalAuthorTeamSelectionElement selection_exBasionymAuthorTeam;
- private NomenclaturalAuthorTeamSelectionElement selection_basionymAuthorTeam;
- private NomenclaturalAuthorTeamSelectionElement selection_exCombinationAuthorTeam;
- private NomenclaturalAuthorTeamSelectionElement selection_combinationAuthorTeam;
+ AbstractIdentifiableEntityDetailElement<NonViralName> {
+ private EntitySelectionElement<TeamOrPersonBase> selectionExBasionymAuthor;
+ private EntitySelectionElement<TeamOrPersonBase> selectionBasionymAuthor;
+ private EntitySelectionElement<TeamOrPersonBase> selectionExCombinationAuthor;
+ private EntitySelectionElement<TeamOrPersonBase> selectionCombinationAuthor;
/**
* <p>
* Constructor for AuthorshipDetailElement.
* </p>
- *
+ *
* @param cdmFormFactory
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
* object.
toggleable_cache = formFactory.createToggleableTextField(this,
"Authorship Cache", entity.getAuthorshipCache(),
entity.isProtectedAuthorshipCache(), style);
- selection_combinationAuthorTeam = formFactory.createNomenclaturalAuthorTeamSelectionElement(
+
+ //TODO RL
+ if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
+ toggleable_cache.setVisible(false);
+ }
+ selectionCombinationAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
getConversationHolder(),
formElement, "Author",
- AuthorHelper.getAuthor(entity.getCombinationAuthorTeam()),
+ entity.getCombinationAuthorship(),
EntitySelectionElement.ALL, style);
- addElement(selection_combinationAuthorTeam);
- selection_exCombinationAuthorTeam = formFactory.createNomenclaturalAuthorTeamSelectionElement(
+ addElement(selectionCombinationAuthor);
+ selectionExCombinationAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
getConversationHolder(),
formElement, "Ex Author",
- AuthorHelper.getAuthor(entity.getExCombinationAuthorTeam()),
- EntitySelectionElement.ALL, style);
- addElement(selection_exCombinationAuthorTeam);
- selection_basionymAuthorTeam = formFactory.createNomenclaturalAuthorTeamSelectionElement(
- getConversationHolder(),
- formElement, "Basionym Author",
- AuthorHelper.getAuthor(entity.getBasionymAuthorTeam()),
+ entity.getExCombinationAuthorship(),
EntitySelectionElement.ALL, style);
- addElement(selection_basionymAuthorTeam);
- selection_exBasionymAuthorTeam = formFactory.createNomenclaturalAuthorTeamSelectionElement(
- getConversationHolder(),
- formElement, "Ex Basionym Author",
- AuthorHelper.getAuthor(entity.getExBasionymAuthorTeam()),
- EntitySelectionElement.ALL, style);
- addElement(selection_exBasionymAuthorTeam);
+ addElement(selectionExCombinationAuthor);
+ selectionBasionymAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class, getConversationHolder(),
+ formElement, "Basionym Author", entity.getBasionymAuthorship(),
+ EntitySelectionElement.ALL, style);
+ addElement(selectionBasionymAuthor);
+ selectionExBasionymAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class, getConversationHolder(),
+ formElement, "Ex Basionym Author", entity.getExBasionymAuthorship(),
+ EntitySelectionElement.ALL, style);
+
+ addElement(selectionExBasionymAuthor);
}
/** {@inheritDoc} */
if (getEntity() == null) {
setEntity(NonViralName.NewInstance(null));
}
-
+
super.updateContent();
toggleable_cache.setEnabled(getEntity().isProtectedAuthorshipCache());
if (eventSource == toggleable_cache) {
getEntity().setAuthorshipCache(toggleable_cache.getText(),
toggleable_cache.getState());
- if (!isIrrelevant())
+ if (!isIrrelevant()){
setIrrelevant(toggleable_cache.getState(),
Arrays.asList(new Object[] { toggleable_cache }));
- } else if (eventSource == selection_combinationAuthorTeam) {
- getEntity().setCombinationAuthorTeam(
- (INomenclaturalAuthor) selection_combinationAuthorTeam
- .getSelection());
- } else if (eventSource == selection_exCombinationAuthorTeam) {
- getEntity().setExCombinationAuthorTeam(
- (INomenclaturalAuthor) selection_exCombinationAuthorTeam
- .getSelection());
- } else if (eventSource == selection_basionymAuthorTeam) {
- getEntity().setBasionymAuthorTeam(
- (INomenclaturalAuthor) selection_basionymAuthorTeam
- .getSelection());
- } else if (eventSource == selection_exBasionymAuthorTeam) {
- getEntity().setExBasionymAuthorTeam(
- (INomenclaturalAuthor) selection_exBasionymAuthorTeam
- .getSelection());
+ }
+ } else if (eventSource == selectionCombinationAuthor) {
+ getEntity().setCombinationAuthorship(
+ selectionCombinationAuthor.getSelection());
+ } else if (eventSource == selectionExCombinationAuthor) {
+ getEntity().setExCombinationAuthorship(
+ selectionExCombinationAuthor.getSelection());
+ } else if (eventSource == selectionBasionymAuthor) {
+ getEntity().setBasionymAuthorship(
+ selectionBasionymAuthor.getSelection());
+ } else if (eventSource == selectionExBasionymAuthor) {
+ getEntity().setExBasionymAuthorship(
+ selectionExBasionymAuthor.getSelection());
}
// if (eventSource != toggleable_cache) {
firePropertyChangeEvent(new CdmPropertyChangeEvent(
getParentElement(), null));
}
-
+
@Override
public void updateToggleableCacheField() {
if(! getEntity().isProtectedAuthorshipCache()){