Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [pde-dev] sharing data on multiple pages in a wizard

Sudhir,

Jacek's comment redirecting your query is certainly valid however this may help.

1. WizardPage is usually used in conjunction with
org.eclipse.jface.wizard.Wizard which manages a list of pages.

2. If you look at the Wizard class you'll see the following method:

createPageControls(Composite pageContainer)

Where the javdoc comments state the following:

" The Wizard implementation of this IWizard method creates all the
pages controls using IDialogPage.createControl Subclasses should
reimplement  this method if they want to delay creating one or more of
the pages lazily. The framework ensures that the contents of a page
will be created before attempting to show it."

3. In essence your Wizard object should override
createPageControls(Composite pageContainer) with an empty
implementation that will allow you to defer page creation.

4. Finally, a Wizard also has an addPages() method where you add your
own pages. Since you are (most likely) adding all your WizardPages to
the wizard within this method you can also pass around the map
instance you require inside here. Something like:

public void addPages() {

Map map = new Hashtable();
Wizardpage w1 = new MyWizardPage(map);
Wizardpage w2 = new MyWizardPage(map);

}

The second wizard page now shares a map instance with the first wizard.

I also gleaned this strategy from the forum Jacek noted and I'm sure
you'll find other valuable advice there.

~pkapur







2009/11/27 Jacek Pospychała <jacek.pospychala@xxxxxxxxx>:
> Sudhir,
> For questions like this, related to Eclipse Platform API, you'd best ask on
> eclipse.platform forum
> (http://www.eclipse.org/forums/index.php?t=thread&frm_id=11&S=61b9098512dead10352ea373c4c6dfae)
> There's more platform API experts hanging out there, willing to help with
> questions like yours.
> Jacek
>
> On Fri, Nov 27, 2009 at 8:01 AM, Sudhir Agrawal <sagrawal@xxxxxxxxxxxxxxxxx>
> wrote:
>>
>> Hi,
>>
>>
>>
>> Thanks for the reply.
>>
>>
>>
>>
>>
>>
>>
>> It didn’t work.
>>
>>
>>
>> Actually I have a text field on my 1st page, and after filling that field
>> and pressing “next”, I want to use value of that field to fill up some other
>> fields in 2nd page.
>>
>>
>>
>>
>>
>> The problem is createControl() method is called before any other things
>> (my modifyText event for the field on 1st page), so I can’t set the value in
>> createControl of second page.
>>
>>
>>
>> So, what is the method available on a wizard page which is invoked when I
>> press the “Next” button, so that I can set the values at that time?
>>
>>
>>
>> Best Regards,
>>
>>
>>
>> Sudhir Agrawal
>>
>> Team Lead
>>
>> Sopra India | A-67 Sector 64, Noida 201301
>>
>> Tel: +91-120-4056100 | Fax: +91-120-4056122 | www.in.sopragroup.com
>>
>> ________________________________
>>
>> From: pde-dev-bounces@xxxxxxxxxxx [mailto:pde-dev-bounces@xxxxxxxxxxx] On
>> Behalf Of Aleksandr Kravets
>> Sent: Thursday, November 26, 2009 8:56 PM
>> To: Eclipse PDE general developers list.
>> Subject: Re: [pde-dev] sharing data on multiple pages in a wizard
>>
>>
>>
>> I have class that extends WizardPage that has a protected Map which serves
>> purpose of a model. All wizard pages extend from this class and have access
>> to the the map and its contents, when something on the page changes, model
>> is updated and the data is available to other pages. You could create a
>> dedicated object for this purpose as well, but Map is more flexible in my
>> opinion.
>>
>> HTH,
>> Alex
>>
>> On Thu, Nov 26, 2009 at 10:17 AM, Sudhir Agrawal
>> <sagrawal@xxxxxxxxxxxxxxxxx> wrote:
>>
>> Hi,
>>
>>
>>
>> I want to share the data between multiple pages on a wizard extended by
>> org.eclipse.jface.wizard.WizardPage.
>>
>>
>>
>> I want to use the value of one text field available on 1st page, in the
>> 2nd page.
>>
>>
>>
>> How can this be achieved?
>>
>>
>>
>>
>>
>>
>>
>> This message may contain confidential and proprietary material for the
>> sole use of the intended recipient.
>>
>> Any review or distribution by others is strictly prohibited.
>>
>> If you are not the intended recipient, please contact the sender and
>> delete all copies.
>>
>> _______________________________________________
>> pde-dev mailing list
>> pde-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/pde-dev
>>
>>
>>
>> This message may contain confidential and proprietary material for the
>> sole use of the intended recipient.
>> Any review or distribution by others is strictly prohibited.
>> If you are not the intended recipient, please contact the sender and
>> delete all copies.
>>
>> _______________________________________________
>> pde-dev mailing list
>> pde-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/pde-dev
>>
>
>
> _______________________________________________
> pde-dev mailing list
> pde-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/pde-dev
>
>


Back to the top