Permalink
  • 7 commits
  • 6 files changed
  • 0 commit comments
  • 2 contributors
@@ -52,7 +52,6 @@
.getFieldDecoration(FieldDecorationRegistry.DEC_REQUIRED)
.getImage();
private AccountType accountType;
- private Boolean errorFlag = false;
private NewAccountWizardPage mainPage;
private UserContainer sandbox;
private String accountId = "";
@@ -92,7 +91,7 @@ public AccountPropertiesPage(Composite parent,
@Override
public void modifyText( ModifyEvent e ) {
accountId = accountNameTxt.getText();
- isAllRequierdPropertiesFilledIn();
+ mainPage.setPageComplete( isAllRequierdPropertiesFilledIn() );
}
} );
@@ -187,7 +186,10 @@ public void modifyText( ModifyEvent e ) {
//
// } );
+ mainPage.setPageComplete( isAllRequierdPropertiesFilledIn() );
+
accountPropGroup.setFocus();
+
}
/**
@@ -218,6 +220,7 @@ public void modifyText( ModifyEvent e ) {
} else {
createMissingFieldsError();
}
+ mainPage.setPageComplete( isAllRequierdPropertiesFilledIn() );
}
} );
if (required) {
@@ -237,7 +240,7 @@ public void createMissingFieldsError() {
errorMessage += ": " + unfilledFields.get(0);
else if(unfilledFields.size() > 1) {
errorMessage += "s:\n" + createErrorMessage(unfilledFields);
- } else if (!isFieldsProperlyFilled())
+ } else if (!isAllRequierdPropertiesFilledIn())
errorMessage = "Now you're way of...";
else
errorMessage = "WTF?";
@@ -374,9 +377,11 @@ public boolean createAccount() {
public Boolean isAllRequierdPropertiesFilledIn() {
Iterator<Text> itr = requiredFields.iterator();
while (itr.hasNext()) {
- if (itr.next().getText().isEmpty())
- return false;
+ if (itr.next().getText().isEmpty()) {
+ return false;
+ }
}
+
return true;
}
@@ -397,15 +402,6 @@ public Boolean isAllRequierdPropertiesFilledIn() {
return requiredPropertiesLeft;
}
-
- /**
- * A method to check that all the fields are valid.
- *
- * @return True if everything is ok
- */
- public Boolean isFieldsProperlyFilled() {
- return !errorFlag;
- }
public void dispose() {
dispose();
@@ -1,12 +1,10 @@
package net.bioclipse.usermanager;
import net.bioclipse.usermanager.UserContainer;
-import net.bioclipse.usermanager.dialogs.CreateUserDialog;
+
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
@@ -17,8 +15,6 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.wb.swt.SWTResourceManager;
-
public class CreateUserWizardPage extends WizardPage implements Listener {
@@ -31,7 +27,6 @@
private UserContainer sandBox;
protected CreateUserWizardPage(String pageName, UserContainer userContainer) {
-
super( pageName );
sandBox = userContainer;
}
@@ -93,7 +88,8 @@ public void createControl( Composite parent ) {
usernameLabel,
passwordLabel,
repeatPasswordLabel });
- setControl(container);
+ setControl(container);
+ setPageComplete( isPageComplete() );
}
@Override
@@ -10,7 +10,6 @@
*******************************************************************************/
package net.bioclipse.usermanager;
-import net.bioclipse.core.util.LogUtils;
import net.bioclipse.usermanager.dialogs.DialogArea;
import net.bioclipse.usermanager.dialogs.LoginDialog;
@@ -31,8 +30,7 @@
private static final Logger logger
= Logger.getLogger(LoginDialog.class);
private DialogArea loginDialogArea;
- private UserContainer sandbox;
- private boolean stop = false;
+ private UserContainer sandbox;;
protected LoginWizardPage(String pageName, UserContainer userContainer) {
super(pageName);
@@ -44,7 +42,7 @@ protected LoginWizardPage(String pageName, UserContainer userContainer) {
public void createControl(Composite parent) {
Composite container = loginDialogArea.getLoginArea(parent);
setControl(container);
- setErrorMessage(loginDialogArea.getErrorMessage());
+ setPageComplete( isPageComplete() );
}
@Override
@@ -68,8 +66,7 @@ public String getUsername() {
* @return The password
*/
public String getPassword() {
- return loginDialogArea.getPassword();
-
+ return loginDialogArea.getPassword();
}
@Override
@@ -86,6 +83,7 @@ public void setVisible(boolean visible) {
+ getUsername(), e.getMessage() );
getWizard().getContainer().showPage( this );
getWizard().getContainer().updateButtons();
+ logger.error( "Could not sign in user: "+e.getStackTrace() );
}
else
super.setVisible( visible );
@@ -74,7 +74,9 @@ public void addPages() {
addAccountPage = new NewAccountWizardPage("addAccountPage", sandbox);
addAccountPage.setTitle("New Account");
- addAccountPage.setDescription("Add a third-part account to Bioclipse");
+ addAccountPage.setDescription("Add a third-part account to " +
+ "Bioclipse.\nAll fields denoted with an asterisk (*) are " +
+ "required.");
addPage(addAccountPage);
@@ -13,26 +13,18 @@
import java.util.ArrayList;
import java.util.HashMap;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StackLayout;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.help.WorkbenchHelpSystem;
-
-import sun.text.resources.FormatData;
/**
* The wizard page that handles the different parts accounts.
@@ -106,6 +98,7 @@ public void createControl(Composite parent) {
}
setControl(container);
+ setPageComplete( isPageComplete() );
}
@@ -117,15 +110,17 @@ public void createControl(Composite parent) {
public void handleEvent(Event event) {
if (event.widget == accountTypeCombo) {
if (accountTypeCombo.getSelectionIndex() == -1){
- System.out.println("Please select an account-type");
+ MessageDialog.openInformation( getShell(),
+ "No account type selected",
+ "Please select an account-type");
} else if (accountTypeCombo.getSelectionIndex() <
accountComposites.size()) {
accountStack.topControl = accountComposites.get(
accountTypeCombo.getSelectionIndex());
accountSettings.layout();
}
}
-
+ setPageComplete( isPageComplete() );
}
/**
@@ -157,7 +152,7 @@ protected Boolean createAccount(){
AccountPropertiesPage account =
addedAccounts.get(accountTypeCombo.getSelectionIndex());
if (account.isAllRequierdPropertiesFilledIn() &&
- account.isFieldsProperlyFilled()) {
+ account.isAllRequierdPropertiesFilledIn()) {
accountId = account.getAccountId();
accountType = account.getAccountType();
properties = account.getProperties();
@@ -187,7 +182,7 @@ private void createErrorMessage(AccountPropertiesPage account) {
errorMessage += ": " + unfilledFields.get(0);
else if(unfilledFields.size() > 1) {
errorMessage += "s:\n" + createErrorMessage(unfilledFields);
- } else if (!account.isFieldsProperlyFilled())
+ } else if (!account.isAllRequierdPropertiesFilledIn())
errorMessage = "There is something missing.";
else
errorMessage = "WTF?";
@@ -213,24 +208,25 @@ private String createErrorMessage(ArrayList<String> unfilledFields) {
}
@Override
- public boolean isPageComplete() {;
+ public boolean isPageComplete() {
+ boolean pageComplete = false;
if (isCurrentPage()) {
if (addedAccounts.size()>0) {
AccountPropertiesPage account =
addedAccounts.get(accountTypeCombo.getSelectionIndex());
- return account.isFieldsProperlyFilled();
+ pageComplete = account.isAllRequierdPropertiesFilledIn();
} else
- return false;
+ pageComplete = false;
} else
- return false;
+ pageComplete = false;
+
+ return pageComplete;
}
@Override
public void setVisible(boolean visible) {
super.setVisible( visible );
-// if (visible)
- performNext(visible);
-
+ performNext(visible);
}
protected void fireUpdate() {
@@ -247,7 +243,6 @@ private void performNext(boolean enteringPage) {
accountId = account.getAccountId();
properties = account.getProperties();
accountType = account.getAccountType();
-
}
@Override
@@ -68,7 +68,7 @@ public DialogArea(UserContainer userContainer,
this.userContainer = userContainer;
this.userContainerEdited = false;
this.createNewAccountButton = createNewAccountButton;
- this.errorFlag = true;
+ this.errorFlag = false;
this.page = page;
}
@@ -270,6 +270,5 @@ else if (!createNewAccountButton &&
page.getWizard().getContainer().updateMessage();
}
}
-
-
+
}

No commit comments for this range