Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 242611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:51:08+00:00 2026-05-11T20:51:08+00:00

I need a wizard which second page content depends on the first page’s selection.

  • 0

I need a wizard which second page content depends on the first page’s selection. The first page asks the user the “kind” of filter he wants to create and the second one asks the user to create one filter instance of the selected “kind”.

JFace’s wizards pages contents (createControl(…) method) are all created when the wizard is open and not when a given page is displayed (this allow JFace to know the wizard size I guess ??).

Because of this, I have to create my second page content BEFORE the wizard is opened BUT I can’t since the second page’s content depends on the first page selection.

For now the cleaner solution I found consists in creating all (seconds) pages before the wizard is open (with their content) and override the getNextPage() method in the first page’s implementation.

The main drawback of that solution is that it can be be expensive when there are many second pages to create.

What do you think about that solution ? How do you manage your wizard’s pages ? Is there any cleaner solution I missed ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:51:08+00:00Added an answer on May 11, 2026 at 8:51 pm

    The approach is right if you are several other pages which are

    • completely different one with another
    • depends on the previous choices made in a previous page

    Then you can add the next page dynamically (also as described here)

    But if you have just a next page with a dynamic content, you should be able to create that content in the onEnterPage() method

    public void createControl(Composite parent)
    {
        //
        // create the composite to hold the widgets
        //
        this.composite = new Composite(parent, SWT.NONE);
    
        //
        // create the desired layout for this wizard page
        //
        GridLayout layout = new GridLayout();
        layout.numColumns = 4;
        this.composite.setLayout(layout);
    
        // set the composite as the control for this page
        setControl(this.composite);
    }
    
    void onEnterPage()
    {
        final MacroModel model = ((MacroWizard) getWizard()).model;
        String selectedKey = model.selectedKey;
        String[] attrs = (String[]) model.macroMap.get(selectedKey);
    
        for (int i = 0; i < attrs.length; i++)
        {
            String attr = attrs[i];
            Label label = new Label(this.composite, SWT.NONE);
            label.setText(attr + ":");
    
            new Text(this.composite, SWT.NONE);
        }
        pack();
    }
    

    As shown in the eclipse corner article Creating JFace Wizards:

    We can change the order of the wizard pages by overwriting the getNextPage method of any wizard page.Before leaving the page, we save in the model the values chosen by the user. In our example, depending on the choice of travel the user will next see either the page with flights or the page for travelling by car.

    public IWizardPage getNextPage(){
       saveDataToModel();       
       if (planeButton.getSelection()) {
           PlanePage page = ((HolidayWizard)getWizard()).planePage;
         page.onEnterPage();
           return page;
       }
       // Returns the next page depending on the selected button
       if (carButton.getSelection()) { 
        return ((HolidayWizard)getWizard()).carPage;
       }
       return null;
    }
    

    We define a method to do this initialization for the PlanePage, onEnterPage() and we invoke this method when moving to the PlanePage, that is in the getNextPage() method for the first page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 182k
  • Answers 182k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Unfortunately, it seems that DOMDocument will automatically convert all characters… May 12, 2026 at 4:27 pm
  • Editorial Team
    Editorial Team added an answer All tests point towards PDO being the most efficient and… May 12, 2026 at 4:27 pm
  • Editorial Team
    Editorial Team added an answer 1) If you're just going to use CUBLAS, you do… May 12, 2026 at 4:27 pm

Related Questions

I need a wizard which second page content depends on the first page's selection.
I was wondering if anyone could tell me if what I'm trying to accomplish
I have three tables, which are each 1:n. An entry in table1 has n
I've got a wizard which needs to validate if a user is logged in
I have to build a html website, which will contain about 50+ pages. The

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.