-// $Id$
/**
* Copyright (C) 2007 EDIT
* European Distributed Institute of Taxonomy
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;
/**
* @author n.hoffmann
* @created 04.06.2009
- * @version 1.0
*/
-public class NameSelectionDialog extends AbstractFilteredCdmResourceSelectionDialog<TaxonNameBase> {
+public class NameSelectionDialog extends AbstractFilteredCdmResourceSelectionDialog<TaxonName> {
- public static TaxonNameBase select(Shell shell, ConversationHolder conversation, TaxonNameBase name) {
+ public static TaxonName select(Shell shell, ConversationHolder conversation, TaxonName name) {
NameSelectionDialog dialog = new NameSelectionDialog(shell, conversation,
"Choose a name", false, name);
return getSelectionFromDialog(dialog);
}
- protected NameSelectionDialog(Shell shell, ConversationHolder conversation, String title, boolean multi, TaxonNameBase name) {
+ protected NameSelectionDialog(Shell shell, ConversationHolder conversation, String title, boolean multi, TaxonName name) {
super(shell, conversation, title, multi, NameSelectionDialog.class.getCanonicalName(), name);
}
/** {@inheritDoc} */
@Override
- protected TaxonNameBase getPersistentObject(UUID cdmUuid) {
+ protected TaxonName getPersistentObject(UUID cdmUuid) {
return CdmStore.getService(INameService.class).load(cdmUuid);
}
/** {@inheritDoc} */
@Override
- protected void initModel() {
- Control control = getPatternControl();
+ protected void search() {
+ Control control =getSearchField();
String pattern = null;
if (control != null){
pattern = ((Text)control).getText();
}
-
- model = CdmStore.getService(INameService.class).getUuidAndTitleCache(limitOfInitialElements, pattern);
+ if (pattern == null || pattern.equals("?")){
+ model = CdmStore.getService(INameService.class).getUuidAndTitleCache(null, null);
+ }else{
+ model = CdmStore.getService(INameService.class).getUuidAndTitleCache(limitOfInitialElements, pattern);
+ }
}
/** {@inheritDoc} */
/** {@inheritDoc} */
@Override
- protected String getNewWizardLinkText() {
- return String.format("Create a new <a>%1s</a>", "Name ");
+ protected String[] getNewWizardText() {
+ return new String[]{"Name "};
}
}