The thing to remember is that the builder is simply a helper class to help construct the visual layout of forms. Conceivably, it's entirely possible to create the return component of the "createFormControl" method manually - meaning you would manually bind properties to controls via BindingFactory and manually add them to some return component/panel. The form builder is designed to handle the most common cases. The builder also happens to include convenience methods that take care of binding properties to components and then adding them to the form. As things stand now, you will probably have to manually bind those components, build out your JPanel, and then add that to the form, rather than relying on the builder to bind the components. I'm doing this off the top of my head, so I'm not sure of its viability, but the basic idea is:
Code:
SwingBindingFactory bf = (SwingBindingFactory)getBindingFactory();
TableFormBuilder fb = new TableFormBuilder(bf);
.. add simple/normal properties using the TableFormBuilder ...
JPanel panel = new JPanel();
panel.add(bf.createBinding("prop1").getControl());
panel.add(bf.createBinding("prop2").getControl());
TableLayoutBuilder tlb = fb.getLayoutBuilder();
tlb.cell(panel, ... attributes...);
.. maybe add more simple properties via TableFormBuilder here ...
return fb.getForm();
TableFormBuilder uses a TableLayoutBuilder to actually add components and lay them out. I simply extract the TableLayoutBuilder and directly add my custom component, bypassing TableFormBuilder and its need to have a Binding for the component. You may have to look at TableLayoutBuilder for usage (and especially look at how TableFormBuilder uses it). We will probably want an easier way to do this in the future, but for now this should work.
- Andy