fix #5977: create a new teammember should allow only persons
authorKatja Luther <k.luther@bgbm.org>
Mon, 22 Aug 2016 11:59:51 +0000 (13:59 +0200)
committerKatja Luther <k.luther@bgbm.org>
Mon, 22 Aug 2016 11:59:51 +0000 (13:59 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AgentSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalPersonAuthorSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionDialogFactory.java

index 748929b4d7cdbbd5ae18c128c2061fa8b07fef44..6c7b9e294f80d4980cf9b9e5ed49ae4771c8b1dc 100644 (file)
@@ -46,6 +46,8 @@ public class AgentSelectionDialog extends
         *
         */
        protected static final String TEAM = "Team";
+       
+       protected static boolean selectTeamMember;
 
        /**
         * <p>select</p>
@@ -55,9 +57,9 @@ public class AgentSelectionDialog extends
         * @param entity a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
         * @return a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
         */
-       public static AgentBase select(Shell shell, ConversationHolder conversation, AgentBase entity) {
+       public static AgentBase select(Shell shell, ConversationHolder conversation, AgentBase entity, boolean selectTeamMember) {
                AgentSelectionDialog dialog = new AgentSelectionDialog(shell, conversation,
-                               "Choose Agent", false, AgentSelectionDialog.class.getCanonicalName(), entity);
+                               "Choose Agent", false, AgentSelectionDialog.class.getCanonicalName(), entity, selectTeamMember);
                return getSelectionFromDialog(dialog);
        }
 
@@ -71,8 +73,9 @@ public class AgentSelectionDialog extends
         * @param multi a boolean.
         * @param settings a {@link java.lang.String} object.
         */
-       protected AgentSelectionDialog(Shell shell, ConversationHolder conversation, String title, boolean multi, String settings, AgentBase agent) {
+       protected AgentSelectionDialog(Shell shell, ConversationHolder conversation, String title, boolean multi, String settings, AgentBase agent, boolean selectTeamMember) {
                super(shell, conversation, title, multi, settings, agent);
+               this.selectTeamMember = selectTeamMember;
        }
 
 
@@ -122,6 +125,9 @@ public class AgentSelectionDialog extends
        /** {@inheritDoc} */
        @Override
        protected String getNewWizardLinkText() {
+               if (this.selectTeamMember){
+                       return String.format("Create a new <a>%1s</a>", PERSON);
+               }
                return String.format("Create a new <a>%1s</a> or <a>%2s</a>", TEAM, PERSON);
        }
 
index 255f8022724734be2741a2e058926a8fda703cfe..c513a785deece3374b82d2ced336d0613ba46762 100644 (file)
@@ -41,8 +41,8 @@ public class NomenclaturalAuthorSelectionDialog extends AgentSelectionDialog {
      * @param agent
      */
     protected NomenclaturalAuthorSelectionDialog(Shell shell, ConversationHolder conversation, String title,
-            boolean multi, String settings, AgentBase agent) {
-        super(shell, conversation, title, multi, settings, agent);
+            boolean multi, String settings, AgentBase agent, boolean teamMemberSelection) {
+        super(shell, conversation, title, multi, settings, agent, teamMemberSelection);
         // TODO Auto-generated constructor stub
     }
 
@@ -80,9 +80,9 @@ public class NomenclaturalAuthorSelectionDialog extends AgentSelectionDialog {
      * @param entity a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
      * @return a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
      */
-    public static AgentBase select(Shell shell, ConversationHolder conversation, AgentBase entity) {
+    public static AgentBase select(Shell shell, ConversationHolder conversation, AgentBase entity, boolean teamMemberSelection) {
         NomenclaturalAuthorSelectionDialog dialog = new NomenclaturalAuthorSelectionDialog(shell, conversation,
-                "Choose Agent", false, NomenclaturalAuthorSelectionDialog.class.getCanonicalName(), entity);
+                "Choose Agent", false, NomenclaturalAuthorSelectionDialog.class.getCanonicalName(), entity, teamMemberSelection);
         return getSelectionFromDialog(dialog);
     }
 
index 0e700202c34d3743991e676fc916ba84200995d7..9429d1ffe400dc8534f013113347bfb4041a04fe 100644 (file)
@@ -35,8 +35,8 @@ public class NomenclaturalPersonAuthorSelectionDialog extends NomenclaturalAutho
      * @param agent
      */
     protected NomenclaturalPersonAuthorSelectionDialog(Shell shell, ConversationHolder conversation, String title,
-            boolean multi, String settings, AgentBase agent) {
-        super(shell, conversation, title, multi, settings, agent);
+            boolean multi, String settings, AgentBase agent, boolean teamMemberSelection) {
+        super(shell, conversation, title, multi, settings, agent, teamMemberSelection);
         // TODO Auto-generated constructor stub
     }
 
@@ -49,9 +49,9 @@ public class NomenclaturalPersonAuthorSelectionDialog extends NomenclaturalAutho
      * @param entity a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
      * @return a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
      */
-    public static AgentBase select(Shell shell, ConversationHolder conversation, AgentBase entity) {
+    public static AgentBase select(Shell shell, ConversationHolder conversation, AgentBase entity, boolean teamMemberSelection) {
         NomenclaturalPersonAuthorSelectionDialog dialog = new NomenclaturalPersonAuthorSelectionDialog(shell, conversation,
-                "Choose Agent", false, NomenclaturalAuthorSelectionDialog.class.getCanonicalName(), entity);
+                "Choose Agent", false, NomenclaturalAuthorSelectionDialog.class.getCanonicalName(), entity,teamMemberSelection);
         return getSelectionFromDialog(dialog);
     }
 
index 36792fe6357799c1dc67b2036b520bf20181e039..9d207d1531dcee2ff2c9927074ae8a4389219a14 100644 (file)
@@ -86,16 +86,16 @@ public class SelectionDialogFactory {
                        return (T) TeamSelectionDialog.select(shell, conversation, (Team) currentSelection);
                }
                if(clazz.equals(TeamOrPersonBase.class) && parentElement instanceof AuthorshipDetailElement){
-            return (T) NomenclaturalAuthorSelectionDialog.select(shell, conversation, (AgentBase) currentSelection);
+            return (T) NomenclaturalAuthorSelectionDialog.select(shell, conversation, (AgentBase) currentSelection, false);
         }else if(clazz.equals(TeamOrPersonBase.class)){
                    //TODO: add TeamOrPersonBaseSelectionDialog (see ticket #4545)
-                   return (T) AgentSelectionDialog.select(shell, conversation, (AgentBase) currentSelection);
+                   return (T) AgentSelectionDialog.select(shell, conversation, (AgentBase) currentSelection, false);
                }
                if(clazz.equals(Person.class) && parentElement instanceof TeamMemberElement){
-                   return (T) NomenclaturalPersonAuthorSelectionDialog.select(shell, conversation, (AgentBase) currentSelection);
+                   return (T) NomenclaturalPersonAuthorSelectionDialog.select(shell, conversation, (AgentBase) currentSelection, true);
         }
                if(clazz.equals(AgentBase.class)){
-                       return (T) AgentSelectionDialog.select(shell, conversation, (AgentBase) currentSelection);
+                       return (T) AgentSelectionDialog.select(shell, conversation, (AgentBase) currentSelection, false);
                }
                if(clazz.equals(Feature.class)){
                        return (T) FeatureSelectionDialog.select(shell, conversation, (Feature) currentSelection);