1

I have a Wizard with 3 WizardPages, each page with widgets holding inputs from the user, I need to add a last page, holding all the informations entered by the user.

I didn't know how to do that, because the 4 pages are created at the same time.

Public Wizard(){
    addPage(new Page1()) ;
    addPage(new Page2()) ;
    addPage(new Page3()) ;
    addPage(new PageSummary()) ;

}

How can i change PageSummary Controls depending on what is entered in previous pages ?

Edit: I've found a post, that do exactly what i want, using the onEnterPage() method looks clever, here is how i have tried it:

public class NewEquipementSummaryPage extends WizardPage {
    public void createControl(Composite parent) {
    // composite to hold widgets 
    Composite composite = new Composite(parent, SWT.NONE) ;

    // composite layout 
    GridLayout gl = new GridLayout(2, false) ;
    composite.setLayout(gl) ;

    // making widgets 
    createWidgets(composite) ;
    setControl(composite) ;
}

    public void onEnterPage() {
    TypeEquipementPage typePage = (TypeEquipementPage) getWizard().getPage(TypeEquipementPage.PAGE_NAME) ;
    CompanySellerPage companyPage = (CompanySellerPage) getWizard().getPage(CompanySellerPage.PAGE_NAME) ;
    EquipementUserPage userPage = (EquipementUserPage) getWizard().getPage(EquipementUserPage.PAGE_NAME) ;

    if(typePage.types[0].getSelection() == true)
        typeEquipementLabel.setText("Poste de travail") ;
    else
        typeEquipementLabel.setText("Peripherique") ;

    marqueEquipementLabel.setText(typePage.marquesCombo.getText()) ;
    descriptionEquipementLabel.setText(typePage.descriptionField.getText()) ;

    if(companyPage.companyExistButton[0].getSelection() == true) {
        companyNameLabel.setText(companyPage.companiesCombo.getText()) ;
    }
    else{
        companyNameLabel.setText(companyPage.companyNameField.getText()) ;
        companyAdressLabel.setText(companyPage.companyAdressField.getText()) ;
        companyNumberLabel.setText(companyPage.companyNumberField.getText()) ;
    }

    if( !(userPage.sharedEquipementButton.getSelection()) )
        useOfEquipementLabel.setText("Utilisateur") ;
    else
        useOfEquipementLabel.setText("Bureau") ;

    pack() ;
}

With the pack() method in the end, i have an error in compilation (cannot find symbol)

and without it nothing appear in the page .. what did I miss ?

Community
  • 1
  • 1
elaich
  • 939
  • 1
  • 19
  • 35
  • 1
    The `onEnterPage` method as used in that link is just a custom method to handle entering the page in the 'Creating JFace Wizards' tutorial. It's called from their Wizard when it calls their overridden `Wizard#getNextPage`. Nothing will call it automatically – mecsco Aug 20 '12 at 16:34

2 Answers2

3

Try overriding DialogPage#setVisible in NewEquipementSummaryPage and call onEnterPage from there:

public void setVisible(boolean visible) {

    super.setVisible(visible);

    if (visible) {

        onEnterPage();
    }
}

(as well as changing to composite.pack() as suggested in SoboLAN's answer)

mecsco
  • 2,250
  • 1
  • 15
  • 28
0

I think you want composite.pack (), not just pack (). To do this, store the composite variable as a private field in your class (so that you can have acess to it in the onEnterPage method).

Radu Murzea
  • 10,724
  • 10
  • 47
  • 69
  • it's composite.pack() .. and it didn't work is there another way to do what I'm plaining ? the last page in the wizard serve as a summary to what do user has entered in all previous pages, so he can read and change by pressing previous and update values or validate by pressing finish. i made empty labels where informations will be displayed using the setText() method in the onEnterPage() .. – elaich Aug 17 '12 at 13:55
  • I used a log to see if there is a call for the onEnterPage() method, but only the createControl() method is called during the process .. When i verified the javadoc there is no onEnterPage() method in the IWizardPage interface not even an inerhited one .. Where is this method ? – elaich Aug 18 '12 at 01:30
  • @elaich I found that method here: http://www.eclipse.org/epf/composer_javadoc/1.0/org/eclipse/epf/library/ui/wizards/BaseWizardPage.html . However I don't know what its purpose is... – Radu Murzea Aug 18 '12 at 07:02
  • 1
    The `onEnterPage` method in the link in the OP's question is just a custom method to handle entering the page in the 'Creating JFace Wizards' tutorial. It's called from their Wizard when it calls their overridden `Wizard#getNextPage`. Nothing will call it automatically – mecsco Aug 20 '12 at 16:31