-// $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.IUserService;
import eu.etaxonomy.cdm.model.common.User;
-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.NewUserWizard;
import eu.etaxonomy.taxeditor.store.CdmStore;
* @param user
* @return
*/
- public static User select(Shell shell, ConversationHolder conversation, User user){
- UserSelectionDialog dialog = new UserSelectionDialog(shell, conversation,
+ public static User select(Shell shell, //ConversationHolder conversation,
+ User user){
+ UserSelectionDialog dialog = new UserSelectionDialog(shell, //conversation,
"Choose User", false, UserSelectionDialog.class.getCanonicalName(), user);
return getSelectionFromDialog(dialog);
}
* @param settings
* @param cdmObject
*/
- protected UserSelectionDialog(Shell shell, ConversationHolder conversation,
+ protected UserSelectionDialog(Shell shell, //ConversationHolder conversation,
String title, boolean multi, String settings, User 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<User> users = CdmStore.getService(IUserService.class).list(User.class, null, null, null, null);
model = new ArrayList<UuidAndTitleCache<User>>();
for(User user : users){
- model.add(new UuidAndTitleCache<User>(User.class, user.getUuid(),String.format("%s, %s", user.getUsername(), user.getPerson())));
+ if (pattern == null || user.getUsername().matches(pattern + ".*")) {
+ model.add(new UuidAndTitleCache<User>(User.class, user.getUuid(), user.getId(), String.format("%s, %s", user.getUsername(), user.getPerson())));
+ }
}
}
* @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewWizardLinkText()
*/
@Override
- protected String getNewWizardLinkText() {
- return String.format("Create a new <a>%1s</a>", "User ");
+ protected String[] getNewWizardText() {
+ return new String[]{"New User"};
}
/* (non-Javadoc)