Skip to content

Commit

Permalink
Added the login-image, some comments and cleaned up the code.
Browse files Browse the repository at this point in the history
  • Loading branch information
KlasJoensson committed Mar 19, 2012
1 parent e6a66b4 commit 69441b2
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 30 deletions.
@@ -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;
Expand All @@ -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();

Expand Down
Expand Up @@ -47,7 +47,6 @@ public class NewAccountWizard extends Wizard implements INewWizard {
private LoginWizardPage loginPage;

public NewAccountWizard() {
// boolean cancel = false;
IUserManager usermanager = Activator.getDefault().getUserManager();
if (usermanager.getUserNames().size() == 0) {
UserContainer sandbox = usermanager.getSandBoxUserContainer();
Expand Down Expand Up @@ -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();
Expand Down
Expand Up @@ -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 {
Expand Down
Expand Up @@ -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();

Expand All @@ -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() );
}

/**
Expand Down

0 comments on commit 69441b2

Please sign in to comment.