Package net.sphene.goim.rcp.ui.preferences

Source Code of net.sphene.goim.rcp.ui.preferences.GOIMPreferencePageCreateAccount

/*
* Gamers Own Instant Messenger
* Copyright (C) 2005-2006 Herbert Poul (kahless@sphene.net)
* http://goim.sphene.net
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
*/
package net.sphene.goim.rcp.ui.preferences;

import net.sphene.goim.rcp.GOIMPlugin;
import net.sphene.goim.rcp.beans.GOIMAccount;
import net.sphene.goim.rcp.beans.GOIMAccountList;

import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;

public class GOIMPreferencePageCreateAccount {

  private Shell sShell = null//  @jve:decl-index=0:visual-constraint="10,10"
  private Shell parent;
  private Label lblName = null;
  private Text name = null;
  private Button createButton = null;
  private Button checkBoxRegisterNewUser = null;
 
  public GOIMPreferencePageCreateAccount(Shell parent) {
    this.parent = parent;
    createSShell();
    sShell.open();
  }

  /**
   * This method initializes sShell
   */
  private void createSShell() {
    if(parent == null)
      sShell = new Shell(SWT.APPLICATION_MODAL | SWT.SHELL_TRIM);
    else
      sShell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.SHELL_TRIM);
    GridData gridData11 = new org.eclipse.swt.layout.GridData();
    gridData11.horizontalSpan = 2;
    gridData11.horizontalAlignment = org.eclipse.swt.layout.GridData.CENTER;
    gridData11.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
    gridData11.grabExcessHorizontalSpace = true;
    GridData gridData1 = new org.eclipse.swt.layout.GridData();
    gridData1.horizontalIndent = 0;
    gridData1.verticalSpan = 1;
    gridData1.horizontalAlignment = org.eclipse.swt.layout.GridData.CENTER;
    gridData1.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
    gridData1.horizontalSpan = 2;
    GridData gridData = new org.eclipse.swt.layout.GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
    gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    gridLayout.marginHeight = 16;
    sShell.setLayout(gridLayout);
    sShell.setText("Create Account");
    lblName = new Label(sShell, SWT.NONE);
    lblName.setText("Enter the name for the new account:");
    name = new Text(sShell, SWT.BORDER);
    name.setLayoutData(gridData);
    checkBoxRegisterNewUser = new Button(sShell, SWT.CHECK);
    checkBoxRegisterNewUser.setText("Register New User");
    checkBoxRegisterNewUser.setLayoutData(gridData11);
    createButton = new Button(sShell, SWT.NONE);
    createButton.setText("Create Account");
    createButton.setLayoutData(gridData1);
    createButton
        .addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            GOIMAccountList accountList = GOIMPlugin.getAccountList();
            GOIMAccount account = new GOIMAccount();
            account.name = name.getText();
            if(checkBoxRegisterNewUser.getSelection()) {
              sShell.close();
              new GOIMPreferencePageCreateUser(parent,account);
            } else {
              sShell.close();
              accountList.add(account);
            }
          }
        });
    sShell.setSize(new org.eclipse.swt.graphics.Point(385,142));
  }

}
TOP

Related Classes of net.sphene.goim.rcp.ui.preferences.GOIMPreferencePageCreateAccount

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.