Announcement Announcement Module
Collapse
No announcement yet.
RCP bindings vs. JGoodies bindings Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • RCP bindings vs. JGoodies bindings

    We're looking into using a binding framework. Looking at RCP and JGoodies, they're obviously very similar. From skimming the code and forums, it looks like the primary differences are RCP enhances for Spring, adds a declarative binding selection mechanism, and adds nested bindings (bean.internalBean.bar). Is this correct? Any other important differences?

    Also, in the JGoodies example the domain objects extend a JGoodies Model class to add Java bean bound properties for update notifications. Is this the recommended method in RCP as well?

    john

  • #2
    In RCP you don't need to subclass your pojos, you can bind them as is. That's a big plus for RCP I think.
    Last edited by Kees de Kooter; Jan 29th, 2006, 02:56 AM.

    Comment


    • #3
      How mature is the spring databinding framework?

      Comment


      • #4
        I think the core is pretty mature. It works fine with a coding-only of swing development.

        In my project we use JFormBuilder to build the windows and add some binding code later on. This was quite easy to do too for the basic controls. For comboboxes I had to make a subclass of SwingBindingFactory. But that was not difficult to do.

        Comment


        • #5
          You don't need to subclass Model for the JGoodies binding library. However, if your bean properties are not bound, any changes that happen directly to the domain object won't be updated in the view. I don't know how Spring RCP/Binding does it, but unless they have a polling thread, they can't get updates from non-bound properties either.

          Jess

          Comment


          • #6
            I think you could if you use AOP. I would not be surprised if spring binding uses this.

            Comment


            • #7
              Jess is correct in that if you modfify the object directly, then no events get triggered. I'd recommend always making changes to an object bound to a form via the ValueModel, this way everything gets notified properly.

              Take a look at FormModel.getValueModel( propertyPath ). You use it like this:

              Code:
              ValueModel vm = getFormModel().getValueModel( "myProperty" );
              vm.setValue( someNewValue );
              And evertyhing will magically update.

              Larry.

              Comment


              • #8
                Hello,

                what happened if you choose to modify your model from a business component . That's my case :
                - the user starts by filling several inputs
                - on the commit action, Gui input (formmodel) copies values to the model (a pojo bean).
                - then I call a business component that updates outputs of my model.
                - gui's outputs have to be updated from the model.

                how can I simply do this ?
                Can I call the formmodel.commit() to force gui updates ? Is it a good way ?

                Regards,

                Christophe

                Comment


                • #9
                  FormModel.commit is not what you want to use since it commits the current buffered values into the form objects, which would overwrite the values you just set in the model objects.

                  Since we are assuming that the pojo's in question do not use bound properties (in the java beans sense), you essentially want to force the UI to notice the updates to the underlying objects. The simplest way to do that is to use a RefreshableValueHolder as the FormObject's holder in the form model. This will allow you to call refresh on it to force the UI updates.

                  In order to do that, you'll either have to code it directly or set up some form of event notification to let interested forms know that their form object needs to be refreshed.

                  I'm sure there are other ways to make this happen, but that's the first one that came to my mind.

                  HTH,
                  Larry.

                  Comment


                  • #10
                    thank you Larry.

                    Do you mean I should use this constructor :
                    DefaultFormModel(ValueModel domainObjectHolder) with a RefreshableValueHolder as parameter or FormModelHelper.createFormModel(ValueModel formObjectHolder) in my forms ?
                    Something like this :

                    FormModel formModel = FormModelHelper.createFormModel(new RefreshableValueModel(myBean) );
                    ...
                    <after commit>
                    <do the updates on my bean>

                    formModel.getFormObjectHolder().refresh();
                    --> all my gui components are updated ?

                    Christophe.

                    PS : recently, it seems that (both in dev list and on the forum) lots of people have code to share (error window, data binder, order of validation message, views as tabs...). What do you think (the spring rich community) of putting all this code in th sandbox. It could be nice to share different components with other people and shorten the time to develop a swing app (THE goal of Spring rich). I know that you (Larry) are going that way.
                    The developpement of a new Swing application could be just to assemble components from the community (an application global design, particular binder...) depending of our needs.
                    Maybe the next step after Mavenization (great work again).
                    Sorry for this long PS !

                    Comment


                    • #11
                      Originally posted by legad
                      thank you Larry.

                      Do you mean I should use this constructor :
                      DefaultFormModel(ValueModel domainObjectHolder) with a RefreshableValueHolder as parameter or FormModelHelper.createFormModel(ValueModel formObjectHolder) in my forms ?
                      Something like this :

                      FormModel formModel = FormModelHelper.createFormModel(new RefreshableValueModel(myBean) );
                      ...
                      <after commit>
                      <do the updates on my bean>

                      formModel.getFormObjectHolder().refresh();
                      --> all my gui components are updated ?

                      Christophe.
                      Yes, give that a try. I haven't done it myself, but it should do what you want. Please report back if it doesn't.


                      Originally posted by legad
                      PS : recently, it seems that (both in dev list and on the forum) lots of people have code to share (error window, data binder, order of validation message, views as tabs...). What do you think (the spring rich community) of putting all this code in th sandbox. It could be nice to share different components with other people and shorten the time to develop a swing app (THE goal of Spring rich). I know that you (Larry) are going that way.
                      The developpement of a new Swing application could be just to assemble components from the community (an application global design, particular binder...) depending of our needs.
                      Maybe the next step after Mavenization (great work again).
                      Sorry for this long PS !
                      The sandbox is meant to house new (experimental) ideas, components that are not ready for the core (maybe due to lack of tests), and for collaborative development. However, the code within it needs to remain reasonably true to the mission of Spring Rich. Thus, you shouldn't find any JSP code in there.

                      That's why you'll often see a discussion on the dev list with some code passing by and then an initial incarnation of the topic ends up in the sandbox for others to play with. I encourage this type of collaboration as I think it can really help move the project along. However, it's important for the initial discussions to take place in order to avoid the sandbox ending up like my cat's litter box.

                      Larry.

                      Comment

                      Working...
                      X