use the CdmFilteredSelectionDialog
authorKatja Luther <k.luther@bgbm.org>
Fri, 10 Jun 2016 12:14:19 +0000 (14:14 +0200)
committerKatja Luther <k.luther@bgbm.org>
Fri, 10 Jun 2016 12:19:19 +0000 (14:19 +0200)
15 files changed:
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java
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/ClassificationSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/CollectionSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/MediaSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NameSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NamedAreaSelectionDialog.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/NomenclaturalAuthorTeamSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/PolytomousKeySelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/ReferenceSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionDialogFactory.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SpecimenOrObservationBaseSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TaxonBaseSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TaxonNodeSelectionDialog.java

index a22f14454b57b8fe06cad6624edb8ee1e1ce9153..8f8fa314492772f61204aad36c0085ef7fb94600 100644 (file)
@@ -39,7 +39,6 @@ import org.eclipse.swt.widgets.Link;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.IMemento;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.IMemento;
-import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
@@ -62,13 +61,14 @@ import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
  * @version 1.0
  */
 public abstract class AbstractFilteredCdmResourceSelectionDialog<T extends ICdmBase> extends
  * @version 1.0
  */
 public abstract class AbstractFilteredCdmResourceSelectionDialog<T extends ICdmBase> extends
-               FilteredItemsSelectionDialog implements IConversationEnabled {
+               CdmFilteredItemsSelectionDialog implements IConversationEnabled {
 
        private final ConversationHolder conversation;
 
        protected List<UuidAndTitleCache<T>> model;
        private final Set<T> transientCdmObjects = new HashSet<T>();
        private final String settings;
 
        private final ConversationHolder conversation;
 
        protected List<UuidAndTitleCache<T>> model;
        private final Set<T> transientCdmObjects = new HashSet<T>();
        private final String settings;
+       protected final int limitOfInitialElements = 100;
 
        protected T cdmBaseToBeFiltered;
 
 
        protected T cdmBaseToBeFiltered;
 
@@ -302,6 +302,8 @@ public abstract class AbstractFilteredCdmResourceSelectionDialog<T extends ICdmB
                ((Text) getPatternControl()).setText(pattern);
        }
 
                ((Text) getPatternControl()).setText(pattern);
        }
 
+
+
        /* (non-Javadoc)
        * @see org.eclipse.ui.dialogs.FilteredItemsSelectionDialog#fillContentProvider(org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.AbstractContentProvider, org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.ItemsFilter, org.eclipse.core.runtime.IProgressMonitor)
        */
        /* (non-Javadoc)
        * @see org.eclipse.ui.dialogs.FilteredItemsSelectionDialog#fillContentProvider(org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.AbstractContentProvider, org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.ItemsFilter, org.eclipse.core.runtime.IProgressMonitor)
        */
index 3891c897ea0b493522571b6ea314cc59191e9040..5dd48275d61190d3399fa80d50df201d7cb70de8 100644 (file)
@@ -14,7 +14,9 @@ import java.util.UUID;
 
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.swt.events.SelectionListener;
 
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IAgentService;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IAgentService;
@@ -107,7 +109,7 @@ public class AgentSelectionDialog extends
        @Override
        protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
                if(TEAM.equals(parameter)){
        @Override
        protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
                if(TEAM.equals(parameter)){
-                       return new NewTeamWizard();
+                       return new NewTeamWizard(false);
                }
                else if(PERSON.equals(parameter)){
                        return new NewPersonWizard();
                }
                else if(PERSON.equals(parameter)){
                        return new NewPersonWizard();
@@ -134,7 +136,14 @@ public class AgentSelectionDialog extends
        /** {@inheritDoc} */
        @Override
        protected void initModel() {
        /** {@inheritDoc} */
        @Override
        protected void initModel() {
-               model = CdmStore.getService(IAgentService.class).getUuidAndTitleCache();
+           Control control = getPatternControl();
+        String pattern = null;
+        if (control != null){
+            pattern = ((Text)control).getText();
+        }
+
+
+               model = CdmStore.getService(IAgentService.class).getUuidAndTitleCache(limitOfInitialElements, pattern);
        }
 
 
        }
 
 
index 46cdcaa5e5135ccc1d5f9dc9579adeea8b8c886a..6010690e3499b20008d746aeadf6a6e2cd0958c3 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
  * Copyright (C) 2007 EDIT
 // $Id$
 /**
  * Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy 
+ * European Distributed Institute of Taxonomy
  * http://www.e-taxonomy.eu
  * 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.
  */
  * 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.
  */
@@ -15,6 +15,7 @@ import java.util.UUID;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IClassificationService;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IClassificationService;
@@ -26,7 +27,7 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  * <p>
  * FilteredClassificationSelectionDialog class.
  * </p>
  * <p>
  * FilteredClassificationSelectionDialog class.
  * </p>
- * 
+ *
  * @author n.hoffmann
  * @created Sep 21, 2009
  * @version 1.0
  * @author n.hoffmann
  * @created Sep 21, 2009
  * @version 1.0
@@ -38,13 +39,13 @@ public class ClassificationSelectionDialog extends
         * <p>
         * select
         * </p>
         * <p>
         * select
         * </p>
-        * 
+        *
         * @param shell
         *            a {@link org.eclipse.swt.widgets.Shell} object.
         * @param conversation
         *            a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
         *            object.
         * @param shell
         *            a {@link org.eclipse.swt.widgets.Shell} object.
         * @param conversation
         *            a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
         *            object.
-        * @param curentSelection 
+        * @param curentSelection
         * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonomicTree} object.
         */
        public static Classification select(Shell shell,
         * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonomicTree} object.
         */
        public static Classification select(Shell shell,
@@ -58,7 +59,7 @@ public class ClassificationSelectionDialog extends
         * <p>
         * Constructor for FilteredClassificationSelectionDialog.
         * </p>
         * <p>
         * Constructor for FilteredClassificationSelectionDialog.
         * </p>
-        * 
+        *
         * @param shell
         *            a {@link org.eclipse.swt.widgets.Shell} object.
         * @param title
         * @param shell
         *            a {@link org.eclipse.swt.widgets.Shell} object.
         * @param title
@@ -81,7 +82,7 @@ public class ClassificationSelectionDialog extends
 
        /*
         * (non-Javadoc)
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * org.eclipse.ui.dialogs.FilteredItemsSelectionDialog#createExtendedContentArea
         * (org.eclipse.swt.widgets.Composite)
         * @see
         * org.eclipse.ui.dialogs.FilteredItemsSelectionDialog#createExtendedContentArea
         * (org.eclipse.swt.widgets.Composite)
@@ -94,7 +95,7 @@ public class ClassificationSelectionDialog extends
 
        /*
         * (non-Javadoc)
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog
         * #getPersistentObject(java.util.UUID)
         * @see
         * eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog
         * #getPersistentObject(java.util.UUID)
@@ -107,7 +108,7 @@ public class ClassificationSelectionDialog extends
 
        /*
         * (non-Javadoc)
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog
         * #initModel()
         * @see
         * eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog
         * #initModel()
@@ -115,8 +116,15 @@ public class ClassificationSelectionDialog extends
        /** {@inheritDoc} */
        @Override
        protected void initModel() {
        /** {@inheritDoc} */
        @Override
        protected void initModel() {
+           Control control = getPatternControl();
+        String pattern = null;
+        if (control != null){
+            pattern = ((Text)control).getText();
+        }
+
+
                model = CdmStore.getService(IClassificationService.class)
                model = CdmStore.getService(IClassificationService.class)
-                               .getUuidAndTitleCache();
+                               .getUuidAndTitleCache(limitOfInitialElements, pattern);
        }
 
        /** {@inheritDoc} */
        }
 
        /** {@inheritDoc} */
index 6f084b1f1a0718e9df678419e8ab691b7dbb325d..202ba7370b8eea26104406e97e8f8cbab6986fc3 100644 (file)
@@ -76,7 +76,7 @@ public class CollectionSelectionDialog extends
        /** {@inheritDoc} */
        @Override
        protected void initModel() {
        /** {@inheritDoc} */
        @Override
        protected void initModel() {
-               model = CdmStore.getService(ICollectionService.class).getUuidAndTitleCache();
+               model = CdmStore.getService(ICollectionService.class).getUuidAndTitleCache(null, null);
        }
 
        /* (non-Javadoc)
        }
 
        /* (non-Javadoc)
index a0df66d8122820228aeeeac59e2ca2f1896263f0..b91471b49782c5bdfe7818e4a47efe96e57abd49 100644 (file)
@@ -60,7 +60,7 @@ AbstractFilteredCdmResourceSelectionDialog<Media> {
     /** {@inheritDoc} */
     @Override
     protected void initModel() {
     /** {@inheritDoc} */
     @Override
     protected void initModel() {
-        model = CdmStore.getService(IMediaService.class).getUuidAndTitleCache();
+        model = CdmStore.getService(IMediaService.class).getUuidAndTitleCache(null, null);
     }
 
     /* (non-Javadoc)
     }
 
     /* (non-Javadoc)
index a3e52d6d9108d41ca618bb74722d44f604613891..86222d5a8b3e6bc104be05b0d5699fcf93665a90 100644 (file)
@@ -12,7 +12,9 @@ package eu.etaxonomy.taxeditor.ui.dialog.selection;
 
 import java.util.UUID;
 
 
 import java.util.UUID;
 
+import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.INameService;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.INameService;
@@ -47,7 +49,14 @@ public class NameSelectionDialog extends AbstractFilteredCdmResourceSelectionDia
        /** {@inheritDoc} */
        @Override
        protected void initModel() {
        /** {@inheritDoc} */
        @Override
        protected void initModel() {
-               model = CdmStore.getService(INameService.class).getUuidAndTitleCache();
+           Control control = getPatternControl();
+        String pattern = null;
+        if (control != null){
+            pattern = ((Text)control).getText();
+        }
+
+
+               model = CdmStore.getService(INameService.class).getUuidAndTitleCache(limitOfInitialElements, pattern);
        }
 
        /** {@inheritDoc} */
        }
 
        /** {@inheritDoc} */
index b671c35be679b75423e0aa11b4db97336683a9fc..055fd74cbbe41fc27ae496f6722b1d261df2d5a8 100644 (file)
@@ -66,8 +66,8 @@ public class NamedAreaSelectionDialog extends
                }
        }
 
                }
        }
 
-       private Collection<TermVocabulary> selectedVocabularies;
-    private ArrayList<TermVocabulary> preselectedVocabularies;
+       protected Collection<TermVocabulary> selectedVocabularies;
+    protected ArrayList<TermVocabulary> preselectedVocabularies;
 
 
        /**
 
 
        /**
index 7aa0dd9ffa1ad504a2c1271ace890246b8980780..f5a5e41c9b8ba7c30747db97a14a965b4aa2f4ab 100644 (file)
@@ -1,84 +1,84 @@
-// $Id$
-/**
-* Copyright (C) 2016 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.taxeditor.ui.dialog.selection;
-
-import org.eclipse.swt.widgets.Shell;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.service.IAgentService;
-import eu.etaxonomy.cdm.model.agent.AgentBase;
-import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * @author k.luther
- * @date 25.05.2016
- *
- */
-public class NomenclaturalAuthorSelectionDialog extends AgentSelectionDialog {
-
-
-    /**
-     * @param shell
-     * @param conversation
-     * @param title
-     * @param multi
-     * @param settings
-     * @param agent
-     */
-    protected NomenclaturalAuthorSelectionDialog(Shell shell, ConversationHolder conversation, String title,
-            boolean multi, String settings, AgentBase agent) {
-        super(shell, conversation, title, multi, settings, agent);
-        // TODO Auto-generated constructor stub
-    }
-
-    @Override
-    protected void initModel() {
-        model = CdmStore.getService(IAgentService.class).getUuidAndAbbrevTitleCache();
-    }
-
-    /**
-     * <p>select</p>
-     *
-     * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
-     * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
-     * @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) {
-        NomenclaturalAuthorSelectionDialog dialog = new NomenclaturalAuthorSelectionDialog(shell, conversation,
-                "Choose Agent", false, NomenclaturalAuthorSelectionDialog.class.getCanonicalName(), entity);
-        return getSelectionFromDialog(dialog);
-    }
-
-    /**
-     * <p>getTitle</p>
-     *
-     * @param cdmObject a T object.
-     * @return a {@link java.lang.String} object.
-     */
-    @Override
-    protected String getTitle(AgentBase cdmObject) {
-        if(cdmObject == null){
-            return "";
-        }
-
-        if (cdmObject instanceof TeamOrPersonBase) {
-            return ((TeamOrPersonBase) cdmObject).getNomenclaturalTitle();
-        } else if (cdmObject instanceof AgentBase){
-            return ((TeamOrPersonBase) cdmObject).getTitleCache();
-        }
-
-        throw new IllegalArgumentException("Generic method only" +
-                " supports cdmObject of type IIdentifiableEntity." +
-                " Please implement specific method in subclass.");
-    }
-
-}
+// $Id$\r
+/**\r
+* Copyright (C) 2016 EDIT\r
+* European Distributed Institute of Taxonomy\r
+* http://www.e-taxonomy.eu\r
+*\r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.ui.dialog.selection;\r
+\r
+import org.eclipse.swt.widgets.Shell;\r
+\r
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
+import eu.etaxonomy.cdm.api.service.IAgentService;\r
+import eu.etaxonomy.cdm.model.agent.AgentBase;\r
+import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;\r
+import eu.etaxonomy.taxeditor.store.CdmStore;\r
+\r
+/**\r
+ * @author k.luther\r
+ * @date 25.05.2016\r
+ *\r
+ */\r
+public class NomenclaturalAuthorSelectionDialog extends AgentSelectionDialog {\r
+\r
+\r
+    /**\r
+     * @param shell\r
+     * @param conversation\r
+     * @param title\r
+     * @param multi\r
+     * @param settings\r
+     * @param agent\r
+     */\r
+    protected NomenclaturalAuthorSelectionDialog(Shell shell, ConversationHolder conversation, String title,\r
+            boolean multi, String settings, AgentBase agent) {\r
+        super(shell, conversation, title, multi, settings, agent);\r
+        // TODO Auto-generated constructor stub\r
+    }\r
+\r
+    @Override\r
+    protected void initModel() {\r
+        model = CdmStore.getService(IAgentService.class).getUuidAndAbbrevTitleCache(null, null, null);\r
+    }\r
+\r
+    /**\r
+     * <p>select</p>\r
+     *\r
+     * @param shell a {@link org.eclipse.swt.widgets.Shell} object.\r
+     * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.\r
+     * @param entity a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.\r
+     * @return a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.\r
+     */\r
+    public static AgentBase select(Shell shell, ConversationHolder conversation, AgentBase entity) {\r
+        NomenclaturalAuthorSelectionDialog dialog = new NomenclaturalAuthorSelectionDialog(shell, conversation,\r
+                "Choose Agent", false, NomenclaturalAuthorSelectionDialog.class.getCanonicalName(), entity);\r
+        return getSelectionFromDialog(dialog);\r
+    }\r
+\r
+    /**\r
+     * <p>getTitle</p>\r
+     *\r
+     * @param cdmObject a T object.\r
+     * @return a {@link java.lang.String} object.\r
+     */\r
+    @Override\r
+    protected String getTitle(AgentBase cdmObject) {\r
+        if(cdmObject == null){\r
+            return "";\r
+        }\r
+\r
+        if (cdmObject instanceof TeamOrPersonBase) {\r
+            return ((TeamOrPersonBase) cdmObject).getNomenclaturalTitle();\r
+        } else if (cdmObject instanceof AgentBase){\r
+            return ((TeamOrPersonBase) cdmObject).getTitleCache();\r
+        }\r
+\r
+        throw new IllegalArgumentException("Generic method only" +\r
+                " supports cdmObject of type IIdentifiableEntity." +\r
+                " Please implement specific method in subclass.");\r
+    }\r
+\r
+}\r
index 5d9099441bbbafe58bd74977f4176d2dedf8c920..ee313e85806b57bd7d272a944c525a8599dc89c3 100644 (file)
@@ -64,7 +64,7 @@ public class NomenclaturalAuthorTeamSelectionDialog extends
        /** {@inheritDoc} */
        @Override
        protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
        /** {@inheritDoc} */
        @Override
        protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
-               return new NewTeamWizard();
+               return new NewTeamWizard(true);
        }
 
        /** {@inheritDoc} */
        }
 
        /** {@inheritDoc} */
index 3a31d6fc942726572538fb2f799ffd3feffd5da4..8accc6c3db16764732fa59db81ddcdf45a788dda 100644 (file)
@@ -61,7 +61,7 @@ public class PolytomousKeySelectionDialog extends
         */
        @Override
        protected void initModel() {
         */
        @Override
        protected void initModel() {
-               model = CdmStore.getService(IPolytomousKeyService.class).getUuidAndTitleCache();
+               model = CdmStore.getService(IPolytomousKeyService.class).getUuidAndTitleCache(null, null);
        }
 
        /* (non-Javadoc)
        }
 
        /* (non-Javadoc)
index 0bba39ae2df1c5fc2c868f526ae89225acc046cd..805a5e2ff5b07542180fc1f0bc49bdd6900fd0aa 100644 (file)
@@ -12,7 +12,9 @@ package eu.etaxonomy.taxeditor.ui.dialog.selection;
 
 import java.util.UUID;
 
 
 import java.util.UUID;
 
+import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IReferenceService;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IReferenceService;
@@ -75,7 +77,14 @@ public class ReferenceSelectionDialog extends AbstractFilteredCdmResourceSelecti
        /** {@inheritDoc} */
        @Override
        protected void initModel() {
        /** {@inheritDoc} */
        @Override
        protected void initModel() {
-               model = CdmStore.getService(IReferenceService.class).getUuidAndTitleCache();
+           Control control = getPatternControl();
+        String pattern = null;
+        if (control != null){
+            pattern = ((Text)control).getText();
+        }
+
+
+               model = CdmStore.getService(IReferenceService.class).getUuidAndTitleCache(limitOfInitialElements,pattern);
        }
 
 
        }
 
 
index 70cdd0fb3e6533a2530fcb17043d661f52218f45..d7d022a5f9ee2c3daef08de933e037bdef983417 100644 (file)
@@ -21,6 +21,7 @@ import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
 import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl;
 import eu.etaxonomy.cdm.model.common.Group;
 import eu.etaxonomy.cdm.model.common.ICdmBase;
 import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl;
 import eu.etaxonomy.cdm.model.common.Group;
 import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.cdm.model.common.TermType;
 import eu.etaxonomy.cdm.model.common.User;
 import eu.etaxonomy.cdm.model.description.Feature;
 import eu.etaxonomy.cdm.model.description.FeatureTree;
 import eu.etaxonomy.cdm.model.common.User;
 import eu.etaxonomy.cdm.model.description.Feature;
 import eu.etaxonomy.cdm.model.description.FeatureTree;
@@ -42,8 +43,11 @@ import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
+import eu.etaxonomy.taxeditor.ui.section.agent.TeamMemberElement;
+import eu.etaxonomy.taxeditor.ui.section.description.detail.DistributionDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.name.AuthorshipDetailElement;
 
 /**
 import eu.etaxonomy.taxeditor.ui.section.name.AuthorshipDetailElement;
 
 /**
@@ -89,7 +93,9 @@ public class SelectionDialogFactory {
                    //TODO: add TeamOrPersonBaseSelectionDialog (see ticket #4545)
                    return (T) AgentSelectionDialog.select(shell, conversation, (AgentBase) currentSelection);
                }
                    //TODO: add TeamOrPersonBaseSelectionDialog (see ticket #4545)
                    return (T) AgentSelectionDialog.select(shell, conversation, (AgentBase) currentSelection);
                }
-
+               if(clazz.equals(Person.class) && parentElement instanceof TeamMemberElement){
+                   return (T) NomenclaturalAuthorSelectionDialog.select(shell, conversation, (AgentBase) currentSelection);
+        }
                if(clazz.equals(AgentBase.class)){
                        return (T) AgentSelectionDialog.select(shell, conversation, (AgentBase) currentSelection);
                }
                if(clazz.equals(AgentBase.class)){
                        return (T) AgentSelectionDialog.select(shell, conversation, (AgentBase) currentSelection);
                }
@@ -117,7 +123,9 @@ public class SelectionDialogFactory {
                    return (T) SpecimenOrObservationBaseSelectionDialog.select(shell, conversation, (SpecimenOrObservationBase) currentSelection);
                }
                if(clazz.equals(NamedArea.class)){
                    return (T) SpecimenOrObservationBaseSelectionDialog.select(shell, conversation, (SpecimenOrObservationBase) currentSelection);
                }
                if(clazz.equals(NamedArea.class)){
-                   if(parentElement instanceof IEntityElement && ((IEntityElement) parentElement).getEntity() instanceof DerivedUnitFacade){
+                   if(parentElement instanceof DistributionDetailElement){
+                return (T) NamedAreaSelectionForDistributionDialog.select(shell, conversation, (NamedArea) currentSelection, CdmStore.getTermManager().getPreferredVocabulary(TermType.NamedArea));
+            }else if(parentElement instanceof IEntityElement && ((IEntityElement) parentElement).getEntity() instanceof DerivedUnitFacade){
                        return (T) NamedAreaSelectionDialog.select(shell, conversation, (NamedArea) currentSelection, Country.uuidCountryVocabulary);
                    }
                    else{
                        return (T) NamedAreaSelectionDialog.select(shell, conversation, (NamedArea) currentSelection, Country.uuidCountryVocabulary);
                    }
                    else{
index 589b08440cea7c7b0f4d1c5be9370d302556eebe..9a6a92ac225f2f9a3750f4038d193bed27855712 100644 (file)
@@ -1,67 +1,67 @@
-// $Id$
-/**
-* Copyright (C) 2007 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.taxeditor.ui.dialog.selection;
-
-import java.util.UUID;
-
-import org.eclipse.swt.widgets.Shell;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.service.IOccurrenceService;
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
-import eu.etaxonomy.taxeditor.newWizard.NewDerivedUnitBaseWizard;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * @author pplitzner
- */
-public class SpecimenOrObservationBaseSelectionDialog extends
-               AbstractFilteredCdmResourceSelectionDialog<SpecimenOrObservationBase> {
-
-       public static SpecimenOrObservationBase select(Shell shell, ConversationHolder conversation, SpecimenOrObservationBase observation){
-               SpecimenOrObservationBaseSelectionDialog dialog = new SpecimenOrObservationBaseSelectionDialog(shell, conversation,
-                               "Choose field unit or derived unit", false, SpecimenOrObservationBaseSelectionDialog.class.getCanonicalName(), observation);
-               return getSelectionFromDialog(dialog);
-       }
-
-       protected SpecimenOrObservationBaseSelectionDialog(Shell shell, ConversationHolder conversation,
-                       String title, boolean multi, String settings,
-                       SpecimenOrObservationBase cdmObject) {
-               super(shell, conversation, title, multi, settings, cdmObject);
-       }
-
-       /** {@inheritDoc} */
-       @Override
-       protected SpecimenOrObservationBase getPersistentObject(UUID uuid) {
-               Object object = CdmStore.getService(IOccurrenceService.class).load(uuid);
-               return HibernateProxyHelper.deproxy(object, SpecimenOrObservationBase.class);
-       }
-
-       /** {@inheritDoc} */
-       @Override
-       protected void initModel() {
-               model = CdmStore.getService(IOccurrenceService.class).getUuidAndTitleCache();
-       }
-
-       /** {@inheritDoc} */
-       @Override
-       protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
-               return new NewDerivedUnitBaseWizard();
-       }
-
-       /** {@inheritDoc} */
-       @Override
-       protected String getNewWizardLinkText() {
-               return String.format("Create a new <a>%1s</a>", "field unit/derived unit");
-       }
-}
+// $Id$\r
+/**\r
+* Copyright (C) 2007 EDIT\r
+* European Distributed Institute of Taxonomy\r
+* http://www.e-taxonomy.eu\r
+*\r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+\r
+package eu.etaxonomy.taxeditor.ui.dialog.selection;\r
+\r
+import java.util.UUID;\r
+\r
+import org.eclipse.swt.widgets.Shell;\r
+\r
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;\r
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;\r
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;\r
+import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;\r
+import eu.etaxonomy.taxeditor.newWizard.NewDerivedUnitBaseWizard;\r
+import eu.etaxonomy.taxeditor.store.CdmStore;\r
+\r
+/**\r
+ * @author pplitzner\r
+ */\r
+public class SpecimenOrObservationBaseSelectionDialog extends\r
+               AbstractFilteredCdmResourceSelectionDialog<SpecimenOrObservationBase> {\r
+\r
+       public static SpecimenOrObservationBase select(Shell shell, ConversationHolder conversation, SpecimenOrObservationBase observation){\r
+               SpecimenOrObservationBaseSelectionDialog dialog = new SpecimenOrObservationBaseSelectionDialog(shell, conversation,\r
+                               "Choose field unit or derived unit", false, SpecimenOrObservationBaseSelectionDialog.class.getCanonicalName(), observation);\r
+               return getSelectionFromDialog(dialog);\r
+       }\r
+\r
+       protected SpecimenOrObservationBaseSelectionDialog(Shell shell, ConversationHolder conversation,\r
+                       String title, boolean multi, String settings,\r
+                       SpecimenOrObservationBase cdmObject) {\r
+               super(shell, conversation, title, multi, settings, cdmObject);\r
+       }\r
+\r
+       /** {@inheritDoc} */\r
+       @Override\r
+       protected SpecimenOrObservationBase getPersistentObject(UUID uuid) {\r
+               Object object = CdmStore.getService(IOccurrenceService.class).load(uuid);\r
+               return HibernateProxyHelper.deproxy(object, SpecimenOrObservationBase.class);\r
+       }\r
+\r
+       /** {@inheritDoc} */\r
+       @Override\r
+       protected void initModel() {\r
+               model = CdmStore.getService(IOccurrenceService.class).getUuidAndTitleCache(null, null);\r
+       }\r
+\r
+       /** {@inheritDoc} */\r
+       @Override\r
+       protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {\r
+               return new NewDerivedUnitBaseWizard();\r
+       }\r
+\r
+       /** {@inheritDoc} */\r
+       @Override\r
+       protected String getNewWizardLinkText() {\r
+               return String.format("Create a new <a>%1s</a>", "field unit/derived unit");\r
+       }\r
+}\r
index a02f2c0e1d963681d507511e387ea2fe97dfd1d8..d28a01d2434b25ab964193b7ca502c075e596034 100644 (file)
@@ -12,7 +12,9 @@ package eu.etaxonomy.taxeditor.ui.dialog.selection;
 
 import java.util.UUID;
 
 
 import java.util.UUID;
 
+import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.ITaxonService;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.ITaxonService;
@@ -69,14 +71,22 @@ public class TaxonBaseSelectionDialog extends AbstractFilteredCdmResourceSelecti
     /** {@inheritDoc} */
     @Override
     protected void initModel() {
     /** {@inheritDoc} */
     @Override
     protected void initModel() {
+        Control control = getPatternControl();
+        String pattern = null;
+        if (control != null){
+            pattern = ((Text)control).getText();
+        }
+
+
+
         if(clazz == TaxonBase.class){
         if(clazz == TaxonBase.class){
-            model = CdmStore.getService(ITaxonService.class).getUuidAndTitleCache();
+            model = CdmStore.getService(ITaxonService.class).getUuidAndTitleCache(limitOfInitialElements, pattern);
         }
         else if(clazz == Taxon.class){
         }
         else if(clazz == Taxon.class){
-            model = CdmStore.getService(ITaxonService.class).getUuidAndTitleCacheTaxon();
+            model = CdmStore.getService(ITaxonService.class).getUuidAndTitleCacheTaxon(limitOfInitialElements, pattern);
         }
         else if(clazz == Synonym.class){
         }
         else if(clazz == Synonym.class){
-            model = CdmStore.getService(ITaxonService.class).getUuidAndTitleCacheSynonym();
+            model = CdmStore.getService(ITaxonService.class).getUuidAndTitleCacheSynonym(limitOfInitialElements, pattern);
         }
     }
 
         }
     }
 
index 35239371ca5ab3ccaa73602f62ed12fe85a1c447..9392a4c4cb4c4ead6600998cdfdfbd485986dc4e 100644 (file)
@@ -19,6 +19,7 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IClassificationService;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IClassificationService;
@@ -126,6 +127,12 @@ public class TaxonNodeSelectionDialog extends AbstractFilteredCdmResourceSelecti
                // default to first tree
                // TODO this will be problematic and can only be seen as workaround
 
                // default to first tree
                // TODO this will be problematic and can only be seen as workaround
 
+           Control control = getPatternControl();
+        String pattern = null;
+        if (control != null){
+            pattern = ((Text)control).getText();
+        }
+
 
                if(classifications == null){
                        classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, null);
 
                if(classifications == null){
                        classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, null);
@@ -143,7 +150,7 @@ public class TaxonNodeSelectionDialog extends AbstractFilteredCdmResourceSelecti
                        }
                }
 
                        }
                }
 
-               model = CdmStore.getService(IClassificationService.class).getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(selectedClassification.getUuid(), excludeTaxa);
+               model = CdmStore.getService(IClassificationService.class).getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(selectedClassification.getUuid(), excludeTaxa, limitOfInitialElements, pattern);
        }
 
        /** {@inheritDoc} */
        }
 
        /** {@inheritDoc} */