Refactoring of selection elements. Additional minor refactoring. Fixed a bug with...
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / name / AuthorshipDetailElement.java
index 873ff4cc6d68a1554bcfc431f34701855265d1b5..aa03fae0b12bb65b0dda4ea73c45597407929fbc 100644 (file)
@@ -13,16 +13,15 @@ package eu.etaxonomy.taxeditor.ui.section.name;
 import java.util.Arrays;
 
 import eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor;
+import eu.etaxonomy.cdm.model.agent.Team;
 import eu.etaxonomy.cdm.model.name.NonViralName;
 import eu.etaxonomy.taxeditor.model.AuthorHelper;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.SelectionType;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement;
-import eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.NomenclaturalAuthorTeamSelectionElement;
 
 /**
@@ -38,10 +37,10 @@ public class AuthorshipDetailElement extends
        AbstractIdentifiableEntityDetailElement<NonViralName> implements
                IEnableableFormElement {
 
-       private AbstractSelectionElement selection_exBasionymAuthorTeam;
-       private AbstractSelectionElement selection_basionymAuthorTeam;
-       private AbstractSelectionElement selection_exCombinationAuthorTeam;
-       private AbstractSelectionElement selection_combinationAuthorTeam;
+       private NomenclaturalAuthorTeamSelectionElement selection_exBasionymAuthorTeam;
+       private NomenclaturalAuthorTeamSelectionElement selection_basionymAuthorTeam;
+       private NomenclaturalAuthorTeamSelectionElement selection_exCombinationAuthorTeam;
+       private NomenclaturalAuthorTeamSelectionElement selection_combinationAuthorTeam;
 
        /**
         * <p>
@@ -69,30 +68,29 @@ public class AuthorshipDetailElement extends
                toggleable_cache = formFactory.createToggleableTextField(this,
                                "Authorship Cache", entity.getAuthorshipCache(),
                                entity.isProtectedAuthorshipCache(), style);
-
-               selection_combinationAuthorTeam = formFactory.createSelectionElement(
-                               SelectionType.AUTHOR_TEAM, getConversationHolder(),
+               selection_combinationAuthorTeam = formFactory.createNomenclaturalAuthorTeamSelectionElement(
+                               getConversationHolder(),
                                formElement, "Author",
                                AuthorHelper.getAuthor(entity.getCombinationAuthorTeam()),
-                               NomenclaturalAuthorTeamSelectionElement.DEFAULT, style);
+                               EntitySelectionElement.ALL, style);
                addElement(selection_combinationAuthorTeam);
-               selection_exCombinationAuthorTeam = formFactory.createSelectionElement(
-                               SelectionType.AUTHOR_TEAM, getConversationHolder(),
+               selection_exCombinationAuthorTeam = formFactory.createNomenclaturalAuthorTeamSelectionElement(
+                               getConversationHolder(),
                                formElement, "Ex Author",
                                AuthorHelper.getAuthor(entity.getExCombinationAuthorTeam()),
-                               NomenclaturalAuthorTeamSelectionElement.DEFAULT, style);
+                               EntitySelectionElement.ALL, style);
                addElement(selection_exCombinationAuthorTeam);
-               selection_basionymAuthorTeam = formFactory.createSelectionElement(
-                               SelectionType.AUTHOR_TEAM, getConversationHolder(),
+               selection_basionymAuthorTeam = formFactory.createNomenclaturalAuthorTeamSelectionElement(
+                               getConversationHolder(),
                                formElement, "Basionym Author",
                                AuthorHelper.getAuthor(entity.getBasionymAuthorTeam()),
-                               NomenclaturalAuthorTeamSelectionElement.DEFAULT, style);
+                               EntitySelectionElement.ALL, style);
                addElement(selection_basionymAuthorTeam);
-               selection_exBasionymAuthorTeam = formFactory.createSelectionElement(
-                               SelectionType.AUTHOR_TEAM, getConversationHolder(),
+               selection_exBasionymAuthorTeam = formFactory.createNomenclaturalAuthorTeamSelectionElement(
+                               getConversationHolder(),
                                formElement, "Ex Basionym Author",
                                AuthorHelper.getAuthor(entity.getExBasionymAuthorTeam()),
-                               NomenclaturalAuthorTeamSelectionElement.DEFAULT, style);
+                               EntitySelectionElement.ALL, style);
                addElement(selection_exBasionymAuthorTeam);
        }
 
@@ -102,8 +100,7 @@ public class AuthorshipDetailElement extends
                if (getEntity() == null) {
                        setEntity(NonViralName.NewInstance(null));
                }
-               NonViralName nonViralName = getEntity();
-
+               
                super.updateContent();
                toggleable_cache.setEnabled(getEntity().isProtectedAuthorshipCache());