Results 1 to 8 of 8

Thread: Changing Form Fields after changing ComboBox

  1. #1
    Join Date
    Nov 2007
    Location
    Hamburg - Germany
    Posts
    24

    Default Changing Form Fields after changing ComboBox

    Hello everybody!

    Does anybody have any example or tip for how to add new Form fields after changing the selection in a combobox?

    In my App (a Protegé ontology based application) I need to select first the type of Object to be instantiated (per Select List), and then after firing a ChangeListener the same form should show the new fields for the Properties of this Object. These fields are not known until the Listener is fired and the new selection is read.

    As I have found on the documentation, it could be possible using a child Form.
    But I´m not sure about the backing form objects. Must they also have a Composition relationship, or could they be fully decoupled?

    I´ve been trying this unsuccessfully long enough and have not found any examples for this issue, so I would appreciate very much any kind of help.

    Thanks

  2. #2
    Join Date
    Jan 2008
    Location
    Toulouse, France
    Posts
    23

    Default

    They can be fully decoupled, the objects in the hierarchical form model do not have to be in a composition/agregation etc.
    But when your "master" form is committed, all child forms are committed. Also, if one of the child forms contains a validation error, the form can not be comitted. In your case, even if it is an hidden one, the user will not be permitted to commit (press Ok) the form. I guess this is not what you want.

    I ran into this problem when I had to create a dynamic Wizard that allow the user to create different data. I had one master form model to which I added the form model needed and removed the form models not needed.

  3. #3
    Join Date
    Nov 2007
    Location
    Hamburg - Germany
    Posts
    24

    Question recapitulation

    thanks one more time Hugo!

    I though I wouldn´t have any answer for this thread ... so I used two independent forms called in 2 steps to solve this.

    Now, to see if I understood correctly... here is how I would implement this:

    1 - so I would need to have a master form, which I use to put the attribute data for the instatiated Object

    2 - in a child form I would put the ComboBox for selection of the class to be instantiated

    3 - when I select some class in the list, the form is commited and the master form is reloaded with the respectives attribute fields.

    Am I right? or did I missunderstand something?

    Thanks in advance!

    Regards,

    Wagner

  4. #4
    Join Date
    Jul 2006
    Posts
    106

    Default

    I would like to ask an additional question:

    Is it possible (and how) to enable/disable a field based on a checkbox selection or any other property value?

  5. #5
    Join Date
    Mar 2007
    Location
    Oudenaarde
    Posts
    294

    Default

    Quote Originally Posted by Shake View Post
    I would like to ask an additional question:

    Is it possible (and how) to enable/disable a field based on a checkbox selection or any other property value?
    Sure, you can add a change listener to a valuemodel of a property, and in that listener you can then change the fieldmetadata of another property (setting it readonly) for example.
    MSN: PM me please
    Skype: doclo_lieven

    Spring Rich Client Project Lead

  6. #6
    Join Date
    Jul 2006
    Posts
    106

    Default

    Okay, thanks. That war really easy... But didn't think of it - so thanks for your hint.

  7. #7
    Join Date
    Nov 2007
    Location
    Hamburg - Germany
    Posts
    24

    Default problem solved

    Problem solved adding a listener on the combobox.
    Changing the selection, a itemEvent is fired and the listener
    adds a new child form to the current.

    Spring RCP is really nice!!!

  8. #8

    Default

    Thank for the hint. I helped me a lot and saved me a lot of time.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •