Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » can anyone use wizard ?
can anyone use wizard ? [message #444362] Tue, 12 October 2004 04:15 Go to next message
Eclipse UserFriend
Originally posted by: cicadaw.hotmail.com

I create two pages and add the two pages into the wizard. But why I can't
see the seperate pages but a whole page which contains the controls on both
pages.

the following is the codes:
public class NewServer extends Wizard {

public NewServerSelection page;
public ServerLogin page2;

/* (non-Javadoc)
* @see org.eclipse.jface.wizard.IWizard#addPages()
*/
public void addPages() {

page = new NewServerSelection("test");

addPage(page);

page2 = new ServerLogin("test2");
// page2.setTitle( "Html File2" );
// page2.setDescription( "Enter file name.2" );
addPage(page2);



}
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.IWizard#performFinish()
*/
public boolean performFinish() {
if (page.getServerAddress().getText().equalsIgnoreCase("")
||page.getServerPort().getText().equalsIgnoreCase(""))
{
page.setErrorMessage("You must provide an address and an port.");
//page.setPageComplete(false);
return false;

}
else return true;
}

}


//*************************************
public class NewServerSelection extends WizardPage {

private Text ServerAddress;
private Text ServerPort;
/**
* @param pageName
*/
protected NewServerSelection(String pageName) {
super(pageName);

setTitle("Create A New Server");
setDescription("Please enter the never and port");
}

/**
* @return Returns the serverAddress.
*/
public Text getServerAddress() {
return ServerAddress;
}

/**
* @return Returns the serverPort.
*/
public Text getServerPort() {
return ServerPort;
}
/**
* @param serverPort The serverPort to set.
*/

/* (non-Javadoc)
* @see
org.eclipse.jface.dialogs.IDialogPage#createControl(org.ecli pse.swt.widgets.
Composite)
*/
public void createControl(Composite parent) {
GridLayout pageLayout = new GridLayout();
pageLayout.numColumns = 2;
parent.setLayout(pageLayout);
parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

Label serverip = new Label(parent, SWT.NONE);
serverip.setText("Server IP:");

ServerAddress = new Text(parent, SWT.BORDER);


Label serverport = new Label(parent, SWT.NONE);
serverport.setText("Server PORT:");

ServerPort = new Text(parent, SWT.BORDER);

// create main composite & set layout
Composite mainComposite = new Composite( parent, SWT.NONE );
// mainComposite.setLayout( new FillLayout( ) );
// mainComposite.setLayoutData( new GridData( GridData.FILL_BOTH ) );

// create contents
// createPageContent( mainComposite );

// page setting
setControl( mainComposite );
setPageComplete( true );


}

}

//*********************************
public class ServerLogin extends WizardPage {

private Text UserName;
private Text Password;

/**
* @param pageName
*/
protected ServerLogin(String pageName) {
super(pageName);
setTitle("Login");
setDescription("Please enter the username and password");
}

/* (non-Javadoc)
* @see
org.eclipse.jface.dialogs.IDialogPage#createControl(org.ecli pse.swt.widgets.
Composite)
*/
public void createControl(Composite parent) {
GridLayout pageLayout = new GridLayout();
pageLayout.numColumns = 2;
parent.setLayout(pageLayout);
parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

Label serverip = new Label(parent, SWT.NONE);
serverip.setText("User Name:");

UserName = new Text(parent, SWT.BORDER);


Label serverport = new Label(parent, SWT.NONE);
serverport.setText("Password:");

Password = new Text(parent, SWT.BORDER);

//setControl(parent);



//// create main composite & set layout
Composite mainComposite = new Composite( parent, SWT.NONE );
// mainComposite.setLayout( new FillLayout( ) );
// mainComposite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
//
// // create contents
// //createPageContent( mainComposite );
//
// // page setting
setControl( mainComposite );
// setPageComplete( true );


}

/**
* @return Returns the password.
*/
public Text getPassword() {
return Password;
}
/**
* @return Returns the userName.
*/
public Text getUserName() {
return UserName;
}
}
Re: can anyone use wizard ? [message #444365 is a reply to message #444362] Tue, 12 October 2004 08:13 Go to previous messageGo to next message
Mihail Podgursky is currently offline Mihail PodgurskyFriend
Messages: 14
Registered: July 2009
Junior Member
Don't do something with parent composite - it is a wizard window composite
not a page composite!

Try like this
mainComposite = new Composite(parent,SWT.NONE);
new Label(mainComposite,SWT.NONE).setText("Server Port");
setControl(mainComposite);

> //*************************************
> public class NewServerSelection extends WizardPage {
>

> public void createControl(Composite parent) {
> GridLayout pageLayout = new GridLayout();
> pageLayout.numColumns = 2;
> parent.setLayout(pageLayout);
> parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
>
> Label serverip = new Label(parent, SWT.NONE);
> serverip.setText("Server IP:");
>
> ServerAddress = new Text(parent, SWT.BORDER);
>
>
> Label serverport = new Label(parent, SWT.NONE);
> serverport.setText("Server PORT:");
>
> ServerPort = new Text(parent, SWT.BORDER);
>
> // create main composite & set layout
> Composite mainComposite = new Composite( parent, SWT.NONE );
> // mainComposite.setLayout( new FillLayout( ) );
> // mainComposite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
>
> // create contents
> // createPageContent( mainComposite );
>
> // page setting
> setControl( mainComposite );
> setPageComplete( true );
> }
Re: can anyone use wizard ? [message #444440 is a reply to message #444362] Tue, 12 October 2004 17:38 Go to previous message
Eclipse UserFriend
Originally posted by: manish.garg.gmail.com

You also have to set one of the pages as the initial pages.
The API is:

defaultPage.init(structuredSelection); // defaultPage can be page or page2
for you.
structuredSelection is passed into the init method that should be
overridden.



"cicada" <cicadaw@hotmail.com> wrote in message
news:ckflb1$bdm$1@eclipse.org...
> I create two pages and add the two pages into the wizard. But why I can't
> see the seperate pages but a whole page which contains the controls on
both
> pages.
>
> the following is the codes:
> public class NewServer extends Wizard {
>
> public NewServerSelection page;
> public ServerLogin page2;
>
> /* (non-Javadoc)
> * @see org.eclipse.jface.wizard.IWizard#addPages()
> */
> public void addPages() {
>
> page = new NewServerSelection("test");
>
> addPage(page);
>
> page2 = new ServerLogin("test2");
> // page2.setTitle( "Html File2" );
> // page2.setDescription( "Enter file name.2" );
> addPage(page2);
>
>
>
> }
> /* (non-Javadoc)
> * @see org.eclipse.jface.wizard.IWizard#performFinish()
> */
> public boolean performFinish() {
> if (page.getServerAddress().getText().equalsIgnoreCase("")
> ||page.getServerPort().getText().equalsIgnoreCase(""))
> {
> page.setErrorMessage("You must provide an address and an port.");
> //page.setPageComplete(false);
> return false;
>
> }
> else return true;
> }
>
> }
>
>
> //*************************************
> public class NewServerSelection extends WizardPage {
>
> private Text ServerAddress;
> private Text ServerPort;
> /**
> * @param pageName
> */
> protected NewServerSelection(String pageName) {
> super(pageName);
>
> setTitle("Create A New Server");
> setDescription("Please enter the never and port");
> }
>
> /**
> * @return Returns the serverAddress.
> */
> public Text getServerAddress() {
> return ServerAddress;
> }
>
> /**
> * @return Returns the serverPort.
> */
> public Text getServerPort() {
> return ServerPort;
> }
> /**
> * @param serverPort The serverPort to set.
> */
>
> /* (non-Javadoc)
> * @see
>
org.eclipse.jface.dialogs.IDialogPage#createControl(org.ecli pse.swt.widgets.
> Composite)
> */
> public void createControl(Composite parent) {
> GridLayout pageLayout = new GridLayout();
> pageLayout.numColumns = 2;
> parent.setLayout(pageLayout);
> parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
>
> Label serverip = new Label(parent, SWT.NONE);
> serverip.setText("Server IP:");
>
> ServerAddress = new Text(parent, SWT.BORDER);
>
>
> Label serverport = new Label(parent, SWT.NONE);
> serverport.setText("Server PORT:");
>
> ServerPort = new Text(parent, SWT.BORDER);
>
> // create main composite & set layout
> Composite mainComposite = new Composite( parent, SWT.NONE );
> // mainComposite.setLayout( new FillLayout( ) );
> // mainComposite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
>
> // create contents
> // createPageContent( mainComposite );
>
> // page setting
> setControl( mainComposite );
> setPageComplete( true );
>
>
> }
>
> }
>
> //*********************************
> public class ServerLogin extends WizardPage {
>
> private Text UserName;
> private Text Password;
>
> /**
> * @param pageName
> */
> protected ServerLogin(String pageName) {
> super(pageName);
> setTitle("Login");
> setDescription("Please enter the username and password");
> }
>
> /* (non-Javadoc)
> * @see
>
org.eclipse.jface.dialogs.IDialogPage#createControl(org.ecli pse.swt.widgets.
> Composite)
> */
> public void createControl(Composite parent) {
> GridLayout pageLayout = new GridLayout();
> pageLayout.numColumns = 2;
> parent.setLayout(pageLayout);
> parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
>
> Label serverip = new Label(parent, SWT.NONE);
> serverip.setText("User Name:");
>
> UserName = new Text(parent, SWT.BORDER);
>
>
> Label serverport = new Label(parent, SWT.NONE);
> serverport.setText("Password:");
>
> Password = new Text(parent, SWT.BORDER);
>
> //setControl(parent);
>
>
>
> //// create main composite & set layout
> Composite mainComposite = new Composite( parent, SWT.NONE );
> // mainComposite.setLayout( new FillLayout( ) );
> // mainComposite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
> //
> // // create contents
> // //createPageContent( mainComposite );
> //
> // // page setting
> setControl( mainComposite );
> // setPageComplete( true );
>
>
> }
>
> /**
> * @return Returns the password.
> */
> public Text getPassword() {
> return Password;
> }
> /**
> * @return Returns the userName.
> */
> public Text getUserName() {
> return UserName;
> }
> }
>
>
Previous Topic:[PocketPC] Problem with newer SWT versions + thicker line
Next Topic:What is "CodePage" value for HPUX ?
Goto Forum:
  


Current Time: Mon Oct 19 16:37:12 GMT 2020

Powered by FUDForum. Page generated in 0.01573 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top