Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Optional Fields on WizardPage
Optional Fields on WizardPage [message #1827440] Thu, 14 May 2020 14:27
Marie-Saphira Flug is currently offline Marie-Saphira FlugFriend
Messages: 21
Registered: January 2019
Junior Member
Hello,
I'm building a jface Wizard where some pages depend on the input given on previous pages.
But not only the data of fields depends on the input but also if some fields are created at all.
Example: I have three chekboxes i.e. Button(main, SWT.CHECK) and a Combo:

  • check1
  • check2
  • optionalCheck
  • combo

Only one of the checkboxes can be selected, so the others have to get deselected in each checkbox's selection listener.
Also the combo has to be disabled if check2 is selected.
The optionalCheck only appears if some value is set false on the previous page.
The fields above are all put in a Group. This group does not appear once on this page but a numberOfGroups times which given to the page's constructor.
Lets call this page MyPage.
I tried three ideas:

1.
Create two pages of MyPage, one with the value set to false, and a second with true , let getNextPage() return the right page and skip the other one.
The optionalCheck is put into an extra Composite which gets a GridData with gridData.exlude set to true or false respectively.
But now the optionalCheckbox is not aligned with the other checkboxes, so I have to put each of the fields into its own Composite?
2.
Have the gridData as field, let it get changed by getNextPage() and pack() the composite, but apparently I didn't get it right and if I went "Back",
changed the boolean and went to MyPage again it didn't work at all.
Also the Groups looked really ugly, since they only enclose the fields but I want them to fill all the (horizontal) space.
3.
Override setVisible(boolean visible) on MyPage, create the fields if(visible) and pack() the main composite.
But the groups again look bad and are created again and again every time the page gets visited. So I prefer the first idea so far.

I will also put a ScrollingComposite around the Groups but that's a different kettle of fish.

So my question is:
Is there a better way to handle optional fields than creating different pages?

(The true/false setting is an example, it's actually an int taken from an enum, but at the moment there are only two possibilities so boolean works as well)
Previous Topic:How to Retain focus on View after opening Editor
Next Topic:Validation for dynamically created fields on WizardPage
Goto Forum:
  


Current Time: Wed Sep 25 08:22:44 GMT 2024

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

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

Back to the top