Results 1 to 3 of 3

Thread: Updating old code - how to put JButton in a TableFormBuilder.

  1. #1
    Join Date
    Aug 2004
    Location
    New York, NY
    Posts
    74

    Default 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
    Last edited by Mark Pollack; Aug 29th, 2006 at 09:23 PM.

  2. #2
    Join Date
    Apr 2006
    Location
    Germany, Berlin
    Posts
    61

    Default

    do it this way:

    TableLayoutBuilder layoutBuilder = formBuilder.getLayoutBuilder();
    layoutBuilder.cell(contactButton);
    ___
    Mathias

  3. #3
    Join Date
    Aug 2004
    Location
    New York, NY
    Posts
    74

    Default

    Hi Mathias,
    Thanks, worked like a charm....
    Cheers,
    Mark

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •