Updating old code - how to put JButton in a TableFormBuilder.
Hi,
I'm updating an application from an extremely old version of Spring Rich (> 1 year old). I used to put a button in a form to help set additional contact information about a "Sales Account" (too many fields to put in the top level form) in the following manner
Code:
public class SalesAccountForm extends AbstractForm
{
/// omitted...
protected JComponent createFormControl()
{
SwingBindingFactory bf = (SwingBindingFactory) getBindingFactory();
TableFormBuilder formBuilder = new TableFormBuilder(getBindingFactory());
/// many other bindings...
JButton contactButton = new JButton("Edit Contact Info");
contactButton.addActionListener(new ContactActionListener());
formBuilder.add("contactSearchButton", contactButton);
}
}
however with verison 0.1.0 this now gives the error...
Code:
ERROR [AWT-EventQueue-0] 2006-08-29 19:29:45,651 [config.ApplicationLifecycleAdvisor] - Control must be an instance of JTextComponent.
java.lang.IllegalArgumentException: Control must be an instance of JTextComponent.
at org.springframework.util.Assert.isTrue(Assert.java:66)
at org.springframework.richclient.form.binding.swing.TextComponentBinder.doBind(TextComponentBinder.java:38)
at org.springframework.richclient.form.binding.support.AbstractBinder.bind(AbstractBinder.java:96)
at org.springframework.richclient.form.binding.support.AbstractBindingFactory.bindControl(AbstractBindingFactory.java:83)
at org.springframework.richclient.form.binding.support.AbstractBindingFactory.bindControl(AbstractBindingFactory.java:61)
at org.springframework.richclient.form.builder.AbstractFormBuilder.getBinding(AbstractFormBuilder.java:76)
at org.springframework.richclient.form.builder.TableFormBuilder.add(TableFormBuilder.java:69)
at org.springframework.richclient.form.builder.TableFormBuilder.add(TableFormBuilder.java:65)
at com.codestreet.admin.ui.SalesAccountForm.createFormControl(SalesAccountForm.java:135)
Any ideas? I'd like not to have to alter the layout if possible.
Thanks!
Mark