Since I have added new component bindings, and I need a simple way to use them (ala the createBoundList in SwingBindingFactory). This leads to the need to override the getBindingFactory() method of AbstractForm (since it currently always returns a new instance of SwingBindingFactory).
It appears that I would have to extend AbstractForm, but that would mean that every form I create in my application would have to then extend from that new base class instead of AbstractForm. This will cause problems down the line when you consider the new form types like AbstractMasterForm and AbstractDetailForm.
It would seem that this problem is best suited by some form of injection configured in the application context. Am I in the weeds, or does this seem reasonable:
1. Define a new bindingFactoryProvider (or bindingFactoryFactory) bean that specifies the class of the provider that will generate BindingFactory instances at runtime.
2. Define a new interface, BindingFactoryProvider, that contains a simple method:Implementing classes would simply instantiate a proper object (like a SwingBindingFactory) using the form model provided.Code:BindingFactory getBindingFactory(FormModel formModel)
3. Modify AbstractForm to get the provider from the ApplicationServices and then have the provider construct the BindingFactory.
This would seem like a simple solution (in line with the normal configuration style of Spring) and it would avoid the whole derivation hierarchy issue.
Comments? Is this something that has general value?
Thanks.
Larry.


Reply With Quote