-// $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 org.eclipse.swt.widgets.Shell;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.INameService;
-import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
import eu.etaxonomy.taxeditor.newWizard.NewNonViralNameWizard;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>FilteredNameSelectionDialog class.</p>
- *
* @author n.hoffmann
* @created 04.06.2009
- * @version 1.0
*/
-public class NameSelectionDialog extends AbstractFilteredCdmResourceSelectionDialog<TaxonNameBase> {
+public class NameSelectionDialog extends AbstractFilteredCdmResourceSelectionDialog<TaxonName> {
- /**
- * Creates a filtered selection dialog to select a name.
- *
- * @param shell
- * The shell for displaying this widget
- * @param name
- * A name that should be selected when the dialog opens
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @return a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
- */
- public static TaxonNameBase select(Shell shell, ConversationHolder conversation, TaxonNameBase name) {
- NameSelectionDialog dialog = new NameSelectionDialog(shell, conversation,
+ public static TaxonName select(Shell shell, //ConversationHolder conversation,
+ TaxonName name) {
+ NameSelectionDialog dialog = new NameSelectionDialog(shell, //conversation,
"Choose a name", false, name);
return getSelectionFromDialog(dialog);
}
-
- /**
- * <p>Constructor for FilteredNameSelectionDialog.</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param title a {@link java.lang.String} object.
- * @param name a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param multi a boolean.
- */
- protected NameSelectionDialog(Shell shell, ConversationHolder conversation, String title, boolean multi, TaxonNameBase name) {
- super(shell, conversation, title, multi, NameSelectionDialog.class.getCanonicalName(), name);
+
+ protected NameSelectionDialog(Shell shell, //ConversationHolder conversation,
+ String title, boolean multi, TaxonName name) {
+ super(shell, //conversation,
+ title, multi, NameSelectionDialog.class.getCanonicalName(), name);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
- */
/** {@inheritDoc} */
@Override
- protected TaxonNameBase getPersistentObject(UUID cdmUuid) {
+ protected TaxonName getPersistentObject(UUID cdmUuid) {
return CdmStore.getService(INameService.class).load(cdmUuid);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#initModel()
- */
/** {@inheritDoc} */
- @Override
- protected void initModel() {
- model = CdmStore.getService(INameService.class).getUuidAndTitleCache();
- }
+// @Override
+// protected void search() {
+// Control control =getSearchField();
+// String pattern = null;
+// if (control != null){
+// pattern = ((Text)control).getText();
+// }
+//
+// if (pattern.equals("?")){
+// model = CdmStore.getService(INameService.class).getUuidAndTitleCache(null, null);
+// }else if (pattern != null){
+// model = CdmStore.getService(INameService.class).getUuidAndTitleCache(limitOfInitialElements, pattern);
+// }
+// }
/** {@inheritDoc} */
@Override
/** {@inheritDoc} */
@Override
- protected String getNewWizardLinkText() {
- return "Click <A>here</A> to create a new name.";
+ protected String[] getNewWizardText() {
+ return new String[]{"New Name"};
}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.dialog.selection.AbstractFilteredCdmResourceSelectionDialog#callService(java.lang.String)
+ */
+ @Override
+ void callService(String pattern) {
+ model = CdmStore.getService(INameService.class).getUuidAndTitleCache(limitOfInitialElements, pattern);
+ }
}