-// $Id$
/**
* Copyright (C) 2007 EDIT
* European Distributed Institute of Taxonomy
import org.eclipse.swt.widgets.Shell;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.IGroupService;
import eu.etaxonomy.cdm.model.common.Group;
-import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
+import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
import eu.etaxonomy.taxeditor.newWizard.NewGroupWizard;
import eu.etaxonomy.taxeditor.store.CdmStore;
public class GroupSelectionDialog extends
AbstractFilteredCdmResourceSelectionDialog<Group> {
- public static Group select(Shell shell, ConversationHolder conversation, Group group){
- GroupSelectionDialog dialog = new GroupSelectionDialog(shell, conversation,
+ public static Group select(Shell shell, //ConversationHolder conversation,
+ Group group){
+ GroupSelectionDialog dialog = new GroupSelectionDialog(shell, //conversation,
"Choose Group", false, GroupSelectionDialog.class.getCanonicalName(), group);
return getSelectionFromDialog(dialog);
}
* @param settings
* @param cdmObject
*/
- protected GroupSelectionDialog(Shell shell,
- ConversationHolder conversation, String title, boolean multi,
+ protected GroupSelectionDialog(Shell shell,//ConversationHolder conversation,
+ String title, boolean multi,
String settings, Group cdmObject) {
- super(shell, conversation, title, multi, settings, cdmObject);
+ super(shell, //conversation,
+ title, multi, settings, cdmObject);
}
/* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#initModel()
+ * @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#search
*/
@Override
- protected void initModel() {
+ protected void callService(String pattern) {
List<Group> groups = CdmStore.getService(IGroupService.class).list(Group.class, null, null, null, null);
model = new ArrayList<UuidAndTitleCache<Group>>();
for(Group group : groups){
- model.add(new UuidAndTitleCache<Group>(Group.class, group.getUuid(), group.getId(), String.format("%s", group.getName())));
+ if (pattern == null || group.getName().matches("(?i)"+pattern + ".*")){
+ model.add(new UuidAndTitleCache<Group>(Group.class, group.getUuid(), group.getId(), String.format("%s", group.getName())));
+ }
}
}
* @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewWizardLinkText()
*/
@Override
- protected String getNewWizardLinkText() {
- return String.format("Create a new <a>%1s</a>", "Group ");
+ protected String[] getNewWizardText() {
+ return new String[]{"New Group"};
}
/* (non-Javadoc)