Announcement Announcement Module
Collapse
No announcement yet.
master / detail and service calls - whereto? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • master / detail and service calls - whereto?

    Where do I put the calls to my services in master / detail forms?
    For example to store a detail object on save.

    Can I inject my services into these forms btw?
    Injecting is seems hard because of the need of FormModelHelper's static methods.

  • #2
    Where do I put the calls to my services in master / detail forms?
    For example to store a detail object on save.
    Updating the backing store is normally handled in the container that handles the commit action (such as a form backed dialog).

    Can I inject my services into these forms btw?
    Injecting is seems hard because of the need of FormModelHelper's static methods.
    Unfortunately, there is no way to "inject" services. The master/detail forms rely on subclassing. Can you give me an idea of the kind of services you need to inject?

    Thanks,
    Larry.

    Comment


    • #3
      I would need to inject in an AbstractForm a service which returns the list that a combobox should use in it's binding.

      I can also imagine that more things might need to be injected into Forms, such as other formmodels, ...
      Please note the only reason they cannot be injected is I think because of the static call needed to FormModelHelper.
      If we'd make that FormModelHelper a singleton defined in the application context and let the contructor take some arguments to create his own formmodel from it, it might work?
      But then of course there is a new bean that always needs to be configured in the rcp context and I already think that there are to many beans from petclinic you need for a simple "hello world".

      Comment


      • #4
        Geoffrey,

        How are you going about creating your forms in a way that you can use injection? Since the form has to have a FormModel, I'm assuming that you're using some form of factory method that is invoked from your XML context configuration. If that is true, then you should be able to make the factory construct a proper form model for a master/detail form as well. Then you'd be able to perform any injection you need on your master form bean.

        Maybe I'm not understanding your problem/question? :?

        Thanks,
        Larry.

        Comment


        • #5
          Originally posted by lstreepy
          How are you going about creating your forms in a way that you can use injection?
          I am not, but I would like to

          Views can be used in a spring-like way, but forms cannot it seems?

          I would like to configure a form factory for each of my forms in my bean context and then inject it in my views.
          Then my views can set my valueBean on the form and show it.

          Comment


          • #6
            Originally posted by ge0ffrey
            Views can be used in a spring-like way, but forms cannot it seems?
            AFAIK, it's problematic to create a form from the bean context. Admittedly, my knowledge is limited in many areas of RCP, so this could simply be my lack of understanding.

            Although I haven't tried it, it would seem that you could construct a form factory that creates forms from the bean context as long as you can provide the FormModel for the form. Obviously, this means you need access to a proper form model object, but that depends on your application (which is why the factory would be application specific). Have you tried this?

            Larry.

            Comment

            Working...
            X