(no commit message)
authorn.hoffmann <n.hoffmann@localhost>
Wed, 8 Jul 2009 12:34:09 +0000 (12:34 +0000)
committern.hoffmann <n.hoffmann@localhost>
Wed, 8 Jul 2009 12:34:09 +0000 (12:34 +0000)
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchBar.java
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/dialogs/LoginDialog.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/user/view/UserManagerView.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/user/wizard/UserWizardPage.java

index aba36dd275349c45843199d901e3ac2b69cb3b08..3a02dc2acafc6bc1202dd00839ef114fa2e03038 100644 (file)
@@ -14,25 +14,27 @@ import org.apache.log4j.Logger;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.FocusEvent;
 import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.RowLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
 import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
 import org.eclipse.ui.IViewPart;
 import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.menus.WorkbenchWindowControlContribution;
 
-import eu.etaxonomy.taxeditor.model.ImageResources;
+import eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator;
 import eu.etaxonomy.taxeditor.model.Resources;
 import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 
 /**
  * @author n.hoffmann
@@ -42,31 +44,36 @@ import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin;
 public class SearchBar extends WorkbenchWindowControlContribution{
        private static final Logger logger = Logger.getLogger(SearchBar.class);
        private Text text_search;
-       private Button button_search;
        private String srv;
        
        private String defaultText = "Use \"*\" for wildcard searching";
-       private Button button_configure;
+       
+       final private ConfigurationSelectionListener configurationListener = new ConfigurationSelectionListener();
 
        @Override
        protected Control createControl(Composite parent) {
                //parent.setLayout(new FillLayout());
                
                Composite composite = new Composite(parent, SWT.NONE);
-               final GridLayout gridLayout = new GridLayout();
-               gridLayout.numColumns = 3;
-               gridLayout.marginWidth = 0;
-               gridLayout.marginHeight = 0;
-               gridLayout.verticalSpacing = 0;
-               gridLayout.horizontalSpacing = 0;
-               composite.setLayout(gridLayout);
+               
+               final RowLayout layout = new RowLayout(); 
+               layout.wrap = false;
+               layout.pack = true;
+               layout.justify = true;
+               layout.type = SWT.HORIZONTAL;
+               layout.marginLeft = 0;
+               layout.marginTop = 0;
+               layout.marginRight = 0;
+               layout.marginBottom = 0;
+               layout.spacing = 0;
+               composite.setLayout(layout);
+               
                // FIXME we have this here for debugging purposes, remove color once the layout of the search bar is correct
                composite.setBackground(Resources.getColor(Resources.SEARCH_VIEW_FOREGROUND));
                
-               text_search = new Text(composite, SWT.SEARCH);
-               GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
-
-               text_search.setLayoutData(gridData);
+               // TODO for some reason the text_search composite has a margin when either SWT.BORDER or SWT.SEARCH
+               // is applied. I am not sure how to get rid of this.
+               text_search = new Text(composite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
                text_search.setForeground(Resources.getColor(Resources.SEARCH_VIEW_FOREGROUND));
                text_search.setText(defaultText);
 
@@ -84,53 +91,148 @@ public class SearchBar extends WorkbenchWindowControlContribution{
                                }       
                        }
                });
-               text_search.addKeyListener(new KeyAdapter() {
-                       public void keyReleased(KeyEvent e) {
-                               int key = e.keyCode;
-                               if (key == SWT.CR) {
-                                       openSearchResultsView(text_search);
-                               } else {
-                                       setSearchButtonEnabled();
-                               }
-                       }
-               });
+
                
-               button_configure = new Button(composite, SWT.DROP_DOWN);
-               button_configure.setImage(ImageResources.getImage(ImageResources.MOVE_ICON));
+               final ToolBar toolBar = new ToolBar(composite, SWT.NULL);
                
-               button_search = new Button(composite, SWT.PUSH);
-               button_search.setText("Search");
-               button_search.setEnabled(false);
-               button_search.addMouseListener(new MouseAdapter() {
-                       
-                       // Populate search results resultsTable after clicking button
-                       public void mouseUp(MouseEvent e) {
-                               openSearchResultsView(text_search);
-                       }
-               });
-               return composite;
-       }
+               ToolItem toolItem = new ToolItem(toolBar, SWT.DROP_DOWN);
+               toolItem.setText("Search");
+               
+               DropdownSelectionListener dropdownListener = new DropdownSelectionListener(toolItem);
+               
+           dropdownListener.add(SearchOption.TAXON);
+           dropdownListener.add(SearchOption.SYNONYM);
+           dropdownListener.add(SearchOption.NAME);
+           dropdownListener.add(SearchOption.COMMON_NAME);
+           
+           toolItem.addSelectionListener(dropdownListener);
 
-       protected void setSearchButtonEnabled() {
-               if (text_search.getText().length() == 0) {
-                       button_search.setEnabled(false);
-               } else {
-                       button_search.setEnabled(true);                 
-               }
+               
+               return composite;
        }
-
-       private void openSearchResultsView(Text searchText) {
-               if(searchText.getText().length() > 0){
+       
+       private void openSearchResultsView() {
+               if(text_search.getText().trim().length() > 0){
+                       
+                       ITaxonServiceConfigurator configurator = configurationListener.getConfigurator();
+                       configurator.setSearchString(text_search.getText().trim());
+                       
                        srv += "1";
                        logger.info("Opening search results window " + srv);
                        try {
                                IViewPart resultsView = TaxeditorNavigationPlugin.getDefault().getWorkbench()
                                        .getActiveWorkbenchWindow().getActivePage().showView(SearchResultView.ID, 
                                                srv, IWorkbenchPage.VIEW_ACTIVATE);
-                               ((SearchResultView) resultsView).performSearch(searchText.getText());
+                               ((SearchResultView) resultsView).performSearch(configurator);
                        } catch (PartInitException e) {
                                logger.error("Error opening search result.", e);
                        }
                }
        }
+       
+       class DropdownSelectionListener extends SelectionAdapter {
+
+               private Menu menu;
+
+               public DropdownSelectionListener(ToolItem dropdown) {
+                       menu = new Menu(dropdown.getParent().getShell());
+               }
+
+               public void add(SearchOption option) {
+                       MenuItem menuItem = new MenuItem(menu, SWT.CHECK);
+                       menuItem.setData(option);
+                   menuItem.setText(option.getLabel());
+                   menuItem.setSelection(option.getPreference());
+                   menuItem.addSelectionListener(configurationListener);
+               }
+
+               public void widgetSelected(SelectionEvent event) {
+                       if (event.detail == SWT.ARROW) {
+                               ToolItem item = (ToolItem) event.widget;
+                               Rectangle rect = item.getBounds();
+                               Point pt = item.getParent().toDisplay(new Point(rect.x, rect.y));
+                               menu.setLocation(pt.x, pt.y + rect.height);
+                               menu.setVisible(true);
+                   } else {
+                       openSearchResultsView();
+                   }
+               }
+       }
+       
+       class ConfigurationSelectionListener extends SelectionAdapter{
+
+               ITaxonServiceConfigurator configurator;
+               
+               /* (non-Javadoc)
+                * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+                */
+               public void widgetSelected(SelectionEvent e) {
+                       logger.warn("configuration menu clicked");
+                       SearchOption option = (SearchOption) e.widget.getData();
+                       
+                       if(option == SearchOption.TAXON){
+                               getConfigurator().setDoTaxa(configurator.isDoTaxa() ? false : true);
+                       }
+                       
+                       if(option == SearchOption.SYNONYM){
+                               getConfigurator().setDoSynonyms(configurator.isDoSynonyms() ? false : true);
+                       }
+                       
+                       if(option == SearchOption.NAME){
+                               getConfigurator().setDoNamesWithoutTaxa(configurator.isDoNamesWithoutTaxa() ? false : true);
+                       }
+                       
+                       if(option == SearchOption.COMMON_NAME){
+                               getConfigurator().setDoTaxaByCommonNames(configurator.isDoTaxaByCommonNames() ? false : true);
+                       }
+                       saveConfigurator();
+               }
+               
+               public ITaxonServiceConfigurator getConfigurator(){
+                       if(configurator == null){
+                               configurator = PreferencesUtil.getSearchConfigurator();
+                       }
+                       return configurator;
+               }
+               
+               private void saveConfigurator(){
+                       PreferencesUtil.setSearchConfigurator(configurator);
+                       this.configurator = PreferencesUtil.getSearchConfigurator();
+               }
+       }
+       
+       enum SearchOption {
+               TAXON("Taxa"),
+               SYNONYM("Synonyms"),
+               NAME("Names (without taxa)"),
+               COMMON_NAME("Common Names");
+               
+               private String label;
+               
+               private SearchOption(String label){
+                       this.label = label;
+               }
+               
+               public String getLabel(){
+                       return label;
+               }
+               
+               public boolean getPreference(){
+                       switch(this){
+                       case TAXON:
+                               return PreferencesUtil.getPreferenceStore().getBoolean(PreferencesUtil.TAXON_SERVICE_CONFIGURATOR_TAXA);
+                       case SYNONYM:
+                               return PreferencesUtil.getPreferenceStore().getBoolean(PreferencesUtil.TAXON_SERVICE_CONFIGURATOR_SYNONYMS);
+                       case NAME:
+                               return PreferencesUtil.getPreferenceStore().getBoolean(PreferencesUtil.TAXON_SERVICE_CONFIGURATOR_NAMES);
+                       case COMMON_NAME:
+                               return PreferencesUtil.getPreferenceStore().getBoolean(PreferencesUtil.TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES);
+                       }
+                       
+                       return true;
+               }
+               
+               
+               
+       }
 }
index ecf653adee0896bbab81e2e6176ad66c5735ead4..019c665242d04260962708e990ff4a558d4dd7b1 100644 (file)
@@ -28,6 +28,7 @@ import org.eclipse.ui.part.ViewPart;
 \r
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;\r
+import eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator;\r
 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;\r
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;\r
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;\r
@@ -52,6 +53,8 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{
        private String queryString;\r
 \r
        private ConversationHolder conversation;\r
+\r
+       private ITaxonServiceConfigurator configurator;\r
        \r
        \r
        /* (non-Javadoc)\r
@@ -82,12 +85,22 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{
                control.setMenu(menu);  \r
        }\r
        \r
+       @Deprecated\r
        protected void performSearch(String queryString) {\r
                List searchResult = CdmStore.searchTaxaByName(queryString);\r
                \r
                resultViewer.setInput(searchResult); \r
                setPartName("Search: '" + queryString + "'");\r
        }\r
+       \r
+       protected void performSearch(ITaxonServiceConfigurator configurator) {\r
+               List searchResult = CdmStore.findNames(configurator);\r
+               \r
+               resultViewer.setInput(searchResult); \r
+               setPartName("Search: '" + configurator.getSearchString() + "'");\r
+\r
+               this.configurator = configurator;\r
+       }\r
 \r
        /* (non-Javadoc)\r
         * @see org.eclipse.ui.part.WorkbenchPart#setFocus()\r
index 01bbf5ed6188337a3b9ee595930269e00836b050..73f0abce5758a5b3d07a4c79fadc14c045dd96cb 100644 (file)
@@ -42,11 +42,14 @@ public class LoginDialog extends Dialog {
        private static Text text_password;
        private static Text text_username;
 
+       private String title;
+
        /**
         * @param parentShell
         */
        public LoginDialog(Shell parentShell) {
                super(parentShell);
+               title = "Login";
        }
                
 
@@ -76,14 +79,24 @@ public class LoginDialog extends Dialog {
                passwordLabel.setText("Password");
 
                // Textfield for the password
-               text_password = new Text(composite, SWT.BORDER);
-               text_password.setEchoChar('*');
+               text_password = new Text(composite, SWT.PASSWORD | SWT.BORDER);
                text_password.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
                
                
                return composite;
        }
 
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
+    protected void configureShell(Shell shell) {
+        super.configureShell(shell);
+        if (title != null) {
+                       shell.setText(title);
+               }
+    }
 
        /* (non-Javadoc)
         * @see org.eclipse.jface.dialogs.Dialog#okPressed()
index ca58fd53af07dcc821ac53e4b8c9b0208105b20b..fe1ba4b8b65e3f896a6ae6c005199611bf414619 100644 (file)
 package eu.etaxonomy.taxeditor.preference;\r
 \r
 import java.util.ArrayList;\r
-import java.util.HashSet;\r
 import java.util.List;\r
 import java.util.Set;\r
 \r
 import org.apache.log4j.Logger;\r
 import org.eclipse.jface.preference.IPreferenceStore;\r
 \r
+import eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator;\r
+import eu.etaxonomy.cdm.api.service.config.impl.TaxonServiceConfiguratorImpl;\r
 import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
 import eu.etaxonomy.cdm.model.common.TermBase;\r
 import eu.etaxonomy.cdm.model.description.Feature;\r
@@ -30,6 +31,7 @@ import eu.etaxonomy.cdm.model.name.Rank;
 import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;\r
 import eu.etaxonomy.cdm.model.name.ZoologicalName;\r
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;\r
+import eu.etaxonomy.cdm.persistence.query.MatchMode;\r
 import eu.etaxonomy.taxeditor.model.Resources;\r
 import eu.etaxonomy.taxeditor.store.VocabularyStore;\r
 import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;\r
@@ -44,6 +46,11 @@ public class PreferencesUtil {
        private static final Logger logger = Logger\r
                        .getLogger(PreferencesUtil.class);\r
 \r
+       public static final String TAXON_SERVICE_CONFIGURATOR_TAXA = "TAXON_SERVICE_CONFIGURATOR_TAXA";\r
+       public static final String TAXON_SERVICE_CONFIGURATOR_SYNONYMS = "TAXON_SERVICE_CONFIGURATOR_SYNONYMS";\r
+       public static final String TAXON_SERVICE_CONFIGURATOR_NAMES = "TAXON_SERVICE_CONFIGURATOR_NAMES";\r
+       public static final String TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES = "TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES";\r
+       \r
        /**\r
         * \r
         * @return\r
@@ -216,4 +223,52 @@ public class PreferencesUtil {
                                . concat(".")\r
                                . concat(term.getUuid().toString());\r
        }\r
+\r
+       /**\r
+        * Retrieves search preferences from the preference store\r
+        * \r
+        * @return an <code>ITaxonServiceConfigurator</code> to pass to search methods\r
+        */\r
+       public static ITaxonServiceConfigurator getSearchConfigurator() {\r
+               ITaxonServiceConfigurator configurator = TaxonServiceConfiguratorImpl.NewInstance();\r
+               // check for existence of at least one preference variable\r
+               if(getPreferenceStore().getBoolean(TAXON_SERVICE_CONFIGURATOR_TAXA)){\r
+                       // preferences exist\r
+                       configurator.setDoTaxa(getPreferenceStore().getBoolean(TAXON_SERVICE_CONFIGURATOR_TAXA));\r
+                       configurator.setDoSynonyms(getPreferenceStore().getBoolean(TAXON_SERVICE_CONFIGURATOR_SYNONYMS));\r
+                       configurator.setDoNamesWithoutTaxa(getPreferenceStore().getBoolean(TAXON_SERVICE_CONFIGURATOR_NAMES));\r
+                       configurator.setDoTaxaByCommonNames(getPreferenceStore().getBoolean(TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES));                  \r
+               }else{\r
+                       // create new preferences setting everything to true\r
+                       configurator.setDoTaxa(true);\r
+                       configurator.setDoSynonyms(true);\r
+                       configurator.setDoNamesWithoutTaxa(true);\r
+                       configurator.setDoTaxaByCommonNames(true);\r
+                       setSearchConfigurator(configurator);\r
+               }\r
+               \r
+               // DEFAULT VALUES               \r
+               // match mode default only\r
+               configurator.setMatchMode(MatchMode.BEGINNING);\r
+               // i don't know what happens to sec at the moment\r
+               configurator.setSec(null);\r
+               // we set page number and size here as this should always be unlimited\r
+               configurator.setPageNumber(0);\r
+               // TODO currently limit results to 1000\r
+               configurator.setPageSize(1000);\r
+               \r
+               return configurator;\r
+       }\r
+       \r
+       /**\r
+        * Store search preferences\r
+        * \r
+        * @param configurator\r
+        */\r
+       public static void setSearchConfigurator(ITaxonServiceConfigurator configurator){\r
+               getPreferenceStore().setValue(TAXON_SERVICE_CONFIGURATOR_TAXA, configurator.isDoTaxa());\r
+               getPreferenceStore().setValue(TAXON_SERVICE_CONFIGURATOR_SYNONYMS, configurator.isDoSynonyms());\r
+               getPreferenceStore().setValue(TAXON_SERVICE_CONFIGURATOR_NAMES, configurator.isDoNamesWithoutTaxa());\r
+               getPreferenceStore().setValue(TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES, configurator.isDoTaxaByCommonNames());\r
+       }\r
 }\r
index 1b24924c26e29ec21eb42186fdc7db65f5b35573..69bc6504c8c5b04c7749bfdfc8302143e1525da2 100644 (file)
@@ -255,6 +255,7 @@ public class CdmStore{
                return resultSet;
        }
        
+       @Deprecated
        private List<IdentifiableEntity> findTaxaByName(String queryString, boolean restrictToTaxonObjs) {
 
                ITaxonServiceConfigurator configurator = new TaxonServiceConfiguratorImpl();
@@ -279,6 +280,21 @@ public class CdmStore{
                return result;
        }
        
+       
+       
+       private List<IdentifiableEntity> findTaxaByName(ITaxonServiceConfigurator configurator){
+               
+               List<IdentifiableEntity> result = getTaxonService().findTaxaAndNames(configurator).getRecords();
+               
+               return result;
+       }
+       
+       public static List<IdentifiableEntity> findNames(ITaxonServiceConfigurator configurator){
+               return getDefault().findTaxaByName(configurator);
+       }
+       
+       
+       
        public static List<IdentifiableEntity> searchTaxaByName(String queryString){
                return getDefault().findTaxaByName(queryString, false);
        }
index 5ca9a1f9828f6940b408c09e5b8278a27dd358a1..880e8851290db5f119833b1cf69ef4c4d95ba39d 100644 (file)
@@ -63,19 +63,14 @@ public class UserManagerView extends ViewPart implements IConversationEnabled, I
                fillLayout.type = SWT.VERTICAL; 
                parent.setLayout(fillLayout);
                
-               Composite composite = new Composite(parent, SWT.NULL);
-               GridLayout layout = new GridLayout();
-               composite.setLayout(layout);
+               listViewer = new ListViewer(parent, SWT.MULTI | SWT.H_SCROLL
+                               | SWT.V_SCROLL | SWT.FULL_SELECTION);
                
-               
-               listViewer = new ListViewer(composite);
-               Control control = listViewer.getControl();
-               control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-               // register context menu
                MenuManager menuMgr = new MenuManager();
                menuMgr.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
                getSite().registerContextMenu(menuMgr, listViewer);
 
+               Control control = listViewer.getControl();
                Menu menu = menuMgr.createContextMenu(control);
                control.setMenu(menu);  
                
index f432f4658a08f52d7a248027eb621f4251888e9b..1e2b48de526014a728a76d7f838622b7a07b8017 100644 (file)
@@ -11,6 +11,7 @@
 package eu.etaxonomy.taxeditor.user.wizard;
 
 import org.apache.log4j.Logger;
+import org.eclipse.jface.dialogs.IInputValidator;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.CLabel;
@@ -34,6 +35,10 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  * @version 1.0
  */
 public class UserWizardPage extends WizardPage implements ModifyListener{
+       
+       public static final String NAME = "USER_WIZARD_PAGE";
+       
+
        private Composite composite;
        private Text text_username;
        private Text text_oldPassword;
@@ -46,11 +51,14 @@ public class UserWizardPage extends WizardPage implements ModifyListener{
        private Text text_personLastName;
        private Text text_userEmail;
 
+       private IInputValidator uniqueUserNameValidator;
+       private IInputValidator passwordRepetitionEqualityValidator;
+       
        /**
         * @param pageName
         */
        protected UserWizardPage(User user) {
-               super("USER_WIZARD_PAGE");
+               super(NAME);
                
                this.user = user;
                
@@ -62,8 +70,10 @@ public class UserWizardPage extends WizardPage implements ModifyListener{
                }else{
                        setTitle("Edit existing user");
                        setDescription("Edit information for the selected user.");
-                       
-               }               
+               }
+
+               uniqueUserNameValidator = new UniqueUserNameValidator();
+               passwordRepetitionEqualityValidator = new PasswordRepetitionEqualityValidator();
        }
 
        private static final Logger logger = Logger.getLogger(UserWizardPage.class);
@@ -101,14 +111,15 @@ public class UserWizardPage extends WizardPage implements ModifyListener{
                
                setControl(composite);
                
+               setPageComplete(false);
+               
                init();
        }
 
        private void createPasswordFieldsEdit(Composite parent){
                CLabel label_oldPassword = new CLabel(parent, SWT.NULL);
                label_oldPassword.setText("Old Password");
-               text_oldPassword = new Text(parent, SWT.BORDER);
-               text_oldPassword.setEchoChar('*');
+               text_oldPassword = new Text(parent, SWT.PASSWORD | SWT.BORDER);
                text_oldPassword.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
                text_oldPassword.addModifyListener(this);
                
@@ -119,8 +130,7 @@ public class UserWizardPage extends WizardPage implements ModifyListener{
                CLabel label_password = new CLabel(parent, SWT.NULL);
                label_password.setText("Password");
                
-               text_password = new Text(parent, SWT.BORDER);
-               text_password.setEchoChar('*');
+               text_password = new Text(parent, SWT.PASSWORD | SWT.BORDER);
                text_password.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
                text_password.addModifyListener(this);
                
@@ -193,4 +203,33 @@ public class UserWizardPage extends WizardPage implements ModifyListener{
        public User getUser() {
                return user;
        }
+       
+       private class UniqueUserNameValidator implements IInputValidator{
+
+               private static final String MESSAGE = "Username already exists";
+               
+               /* (non-Javadoc)
+                * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
+                */
+               public String isValid(String newText) {
+                       // query for username
+                       if( CdmStore.getUserService().loadUserByUsername(newText) != null){
+                               return MESSAGE;
+                       }
+                       
+                       return null;
+               }
+       }
+       
+       private class PasswordRepetitionEqualityValidator implements IInputValidator{
+
+               /* (non-Javadoc)
+                * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
+                */
+               public String isValid(String newText) {
+                       // TODO Auto-generated method stub
+                       return null;
+               }
+               
+       }
 }