From 7efbd7cf09b62d5e802b7b827a6cd02fc7a096f9 Mon Sep 17 00:00:00 2001
From: Katja Luther
* select *
- * + * * @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, @@ -58,7 +59,7 @@ public class ClassificationSelectionDialog extends ** Constructor for FilteredClassificationSelectionDialog. *
- * + * * @param shell * a {@link org.eclipse.swt.widgets.Shell} object. * @param title @@ -81,7 +82,7 @@ public class ClassificationSelectionDialog extends /* * (non-Javadoc) - * + * * @see * org.eclipse.ui.dialogs.FilteredItemsSelectionDialog#createExtendedContentArea * (org.eclipse.swt.widgets.Composite) @@ -94,7 +95,7 @@ public class ClassificationSelectionDialog extends /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog * #getPersistentObject(java.util.UUID) @@ -107,7 +108,7 @@ public class ClassificationSelectionDialog extends /* * (non-Javadoc) - * + * * @see * eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog * #initModel() @@ -115,8 +116,15 @@ public class ClassificationSelectionDialog extends /** {@inheritDoc} */ @Override protected void initModel() { + Control control = getPatternControl(); + String pattern = null; + if (control != null){ + pattern = ((Text)control).getText(); + } + + model = CdmStore.getService(IClassificationService.class) - .getUuidAndTitleCache(); + .getUuidAndTitleCache(limitOfInitialElements, pattern); } /** {@inheritDoc} */ diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/CollectionSelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/CollectionSelectionDialog.java index 6f084b1f1..202ba7370 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/CollectionSelectionDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/CollectionSelectionDialog.java @@ -76,7 +76,7 @@ public class CollectionSelectionDialog extends /** {@inheritDoc} */ @Override protected void initModel() { - model = CdmStore.getService(ICollectionService.class).getUuidAndTitleCache(); + model = CdmStore.getService(ICollectionService.class).getUuidAndTitleCache(null, null); } /* (non-Javadoc) diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/MediaSelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/MediaSelectionDialog.java index a0df66d81..b91471b49 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/MediaSelectionDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/MediaSelectionDialog.java @@ -60,7 +60,7 @@ AbstractFilteredCdmResourceSelectionDialogselect
- * - * @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); - } - - /** - *getTitle
- * - * @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$ +/** +* 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(null, null, null); + } + + /** + *select
+ * + * @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); + } + + /** + *getTitle
+ * + * @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."); + } + +} diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorTeamSelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorTeamSelectionDialog.java index 5d9099441..ee313e858 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorTeamSelectionDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorTeamSelectionDialog.java @@ -64,7 +64,7 @@ public class NomenclaturalAuthorTeamSelectionDialog extends /** {@inheritDoc} */ @Override protected AbstractNewEntityWizard getNewEntityWizard(String parameter) { - return new NewTeamWizard(); + return new NewTeamWizard(true); } /** {@inheritDoc} */ diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/PolytomousKeySelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/PolytomousKeySelectionDialog.java index 3a31d6fc9..8accc6c3d 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/PolytomousKeySelectionDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/PolytomousKeySelectionDialog.java @@ -61,7 +61,7 @@ public class PolytomousKeySelectionDialog extends */ @Override protected void initModel() { - model = CdmStore.getService(IPolytomousKeyService.class).getUuidAndTitleCache(); + model = CdmStore.getService(IPolytomousKeyService.class).getUuidAndTitleCache(null, null); } /* (non-Javadoc) diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/ReferenceSelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/ReferenceSelectionDialog.java index 0bba39ae2..805a5e2ff 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/ReferenceSelectionDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/ReferenceSelectionDialog.java @@ -12,7 +12,9 @@ package eu.etaxonomy.taxeditor.ui.dialog.selection; import java.util.UUID; +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.IReferenceService; @@ -75,7 +77,14 @@ public class ReferenceSelectionDialog extends AbstractFilteredCdmResourceSelecti /** {@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); } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionDialogFactory.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionDialogFactory.java index 70cdd0fb3..d7d022a5f 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionDialogFactory.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionDialogFactory.java @@ -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.TermType; 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.taxeditor.store.CdmStore; 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; /** @@ -89,7 +93,9 @@ public class SelectionDialogFactory { //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); } @@ -117,7 +123,9 @@ public class SelectionDialogFactory { 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{ diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SpecimenOrObservationBaseSelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SpecimenOrObservationBaseSelectionDialog.java index 589b08440..9a6a92ac2 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SpecimenOrObservationBaseSelectionDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SpecimenOrObservationBaseSelectionDialog.java @@ -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