Revision: 1324
Author:   mathiasbr
Date:     2006-08-20 15:16:57 -0700 (Sun, 20 Aug 2006)
ViewCVS:  http://svn.sourceforge.net/spring-rich-c/?rev=1324&view=rev

Log Message:
-----------
fixed double binding effect for selectors

Modified Paths:
--------------
    
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/form/builder/AbstractFormBuilder.java
    
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/form/builder/TableFormBuilder.java
Modified: 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/form/builder/AbstractFormBuilder.java
===================================================================
--- 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/form/builder/AbstractFormBuilder.java
  2006-08-20 22:15:47 UTC (rev 1323)
+++ 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/form/builder/AbstractFormBuilder.java
  2006-08-20 22:16:57 UTC (rev 1324)
@@ -89,6 +89,10 @@
         return getBindingFactory().bindControl(component, fieldName);
     }
 
+    protected Binding createBinding(String fieldName, JComponent component, 
Map context) {
+        return getBindingFactory().bindControl(component, fieldName, context);
+    }
+
     /**
      * @deprecated Use [EMAIL PROTECTED] #createSelector(String,Constraint)} 
instead
      */

Modified: 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/form/builder/TableFormBuilder.java
===================================================================
--- 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/form/builder/TableFormBuilder.java
     2006-08-20 22:15:47 UTC (rev 1323)
+++ 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/form/builder/TableFormBuilder.java
     2006-08-20 22:16:57 UTC (rev 1324)
@@ -15,6 +15,10 @@
  */
 package org.springframework.richclient.form.builder;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.swing.JComboBox;
 import javax.swing.JComponent;
 import javax.swing.JLabel;
 import javax.swing.JScrollPane;
@@ -22,6 +26,7 @@
 import org.springframework.core.closure.Constraint;
 import org.springframework.richclient.form.binding.Binding;
 import org.springframework.richclient.form.binding.BindingFactory;
+import org.springframework.richclient.form.binding.swing.ComboBoxBinder;
 import org.springframework.richclient.layout.TableLayoutBuilder;
 import org.springframework.util.Assert;
 
@@ -158,9 +163,6 @@
      *            the name of the field to add
      * @param filter
      *            optional filter constraint for the items of the selector
-     * @param attributes
-     *            optional layout attributes for the selector component. See 
[EMAIL PROTECTED] TableLayoutBuilder} for syntax
-     *            details
      * @return an array containing the label and the selector component which 
where added to the form
      * 
      * @see #createSelector(String, Constraint)
@@ -170,8 +172,7 @@
     }
 
     /**
-     * Adds the field to the form by using a selector component. [EMAIL 
PROTECTED] #createSelector(String, Constraint)} is used to
-     * create the component for the selector
+     * Adds the field to the form by using a selector component.
      * 
      * @param fieldName
      *            the name of the field to add
@@ -182,10 +183,12 @@
      *            details
      * @return an array containing the label and the selector component which 
where added to the form
      * 
-     * @see #createSelector(String, Constraint)
      */
     public JComponent[] addSelector(String fieldName, Constraint filter, 
String attributes) {
-        return addBinding(createBinding(fieldName, createSelector(fieldName, 
filter)), attributes, getLabelAttributes());
+        Map context = new HashMap();
+        context.put(ComboBoxBinder.FILTER_KEY, filter);
+        return addBinding(getBindingFactory().createBinding(JComboBox.class, 
fieldName), attributes,
+                getLabelAttributes());
     }
 
     /**


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
spring-rich-c-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs

Reply via email to