Permalink
Browse files

Added the login-image, some comments and cleaned up the code.

  • Loading branch information...
1 parent e6a66b4 commit 69441b27b7fe556542f805b6358e490a9899a577 @KlasJoensson KlasJoensson committed Mar 19, 2012
@@ -1,10 +1,25 @@
+/* *****************************************************************************
+ * Copyright (c) 2007-2009 Bioclipse Project
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ *******************************************************************************/
package net.bioclipse.usermanager;
import net.bioclipse.usermanager.dialogs.DialogArea;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.widgets.Composite;
-
+/**
+ * This is the wizard page for log-in into Bioclipse.
+ *
+ * @author Klas Jšnsson (aka "konditorn")
+ *
+ */
public class LoginWizardPage extends WizardPage {
private DialogArea loginDialogArea;
@@ -26,10 +41,21 @@ public boolean isPageComplete() {
return !loginDialogArea.getErrorFlag();
}
+ /**
+ * This method just passes on the username written in the text-field in the
+ * login dialog.
+ *
+ * @return The username
+ */
public String getUsername() {
return loginDialogArea.getUsername();
}
-
+ /**
+ * This method just passes on the password written in the text-field in the
+ * login dialog.
+ *
+ * @return The password
+ */
public String getPassword() {
return loginDialogArea.getPassword();
@@ -47,7 +47,6 @@
private LoginWizardPage loginPage;
public NewAccountWizard() {
-// boolean cancel = false;
IUserManager usermanager = Activator.getDefault().getUserManager();
if (usermanager.getUserNames().size() == 0) {
UserContainer sandbox = usermanager.getSandBoxUserContainer();
@@ -117,6 +116,9 @@ public boolean performCancel() {
return true;
}
+ /**
+ * This method log in the user.
+ */
private void performLogin() {
final String username = loginPage.getUsername();
final String password = loginPage.getPassword();
@@ -30,7 +30,7 @@
/**
* The wizard page that handles the different parts accounts.
*
- * @author Klas Jšnsson
+ * @author Klas Jšnsson (aka "konditorn")
*
*/
public class NewAccountWizardPage extends WizardPage implements Listener {
@@ -179,16 +179,16 @@ public void widgetSelected(SelectionEvent e) {
repeatPasswordLabel });
}
-// Label icon = new Label(container, SWT.NONE);
-// ImageDescriptor imgDesc = ImageDescriptor
-// .createFromFile(this.getClass(),
-// "icons/login_16.png");
-// Image img = imgDesc.createImage();
-// icon.setImage(img);
-// final FormData formData_6 = new FormData();
-// formData_6.top = new FormAttachment(usernameText, 0, SWT.RIGHT);
-// formData_6.left = new FormAttachment(usernameText, 0, SWT.RIGHT);
-// icon.setLayoutData(formData_6);
+ Label icon = new Label(container, SWT.NONE);
+ ImageDescriptor imgDesc = ImageDescriptor
+ .createFromFile(this.getClass(),
+ "../../../../../icons/login_16.png");
+ Image img = imgDesc.createImage();
+ icon.setImage(img);
+ final FormData formData_6 = new FormData();
+ formData_6.bottom = new FormAttachment(usernameText, 0, SWT.RIGHT);
+ formData_6.left = new FormAttachment(usernameText, 0, SWT.RIGHT);
+ icon.setLayoutData(formData_6);
usernameText.setFocus();
@@ -214,23 +214,12 @@ public boolean isUserContainerEdited() {
*/
public boolean isFilledIn() {
if (createNewAccountButton) {
- if (usernameText.getText().isEmpty() ||
- passwordText.getText().isEmpty() )
- return false;
- else
- return true;
-// return ( !usernameText.getText().isEmpty() &&
-// !passwordText.getText().isEmpty() );
+ return ( !usernameText.getText().isEmpty() &&
+ !passwordText.getText().isEmpty() );
} else
- if (usernameText.getText().isEmpty() ||
- passwordText.getText().isEmpty() ||
- repeatPasswordText.getText().isEmpty())
- return false;
- else
- return true;
- // return ( !usernameText.getText().isEmpty() &&
-// !passwordText.getText().isEmpty() &&
-// !repeatPasswordText.getText().isEmpty() );
+ return ( !usernameText.getText().isEmpty() &&
+ !passwordText.getText().isEmpty() &&
+ !repeatPasswordText.getText().isEmpty() );
}
/**

0 comments on commit 69441b2

Please sign in to comment.