Revision: 1566 http://svn.sourceforge.net/spring-rich-c/?rev=1566&view=rev Author: mathiasbr Date: 2006-11-17 02:29:44 -0800 (Fri, 17 Nov 2006)
Log Message: ----------- better support for Closures to create Renderer/Editor instances by using the default Renderer/Editor Modified Paths: -------------- trunk/spring-richclient/support/src/main/java/org/springframework/richclient/form/binding/swing/ComboBoxBinder.java Modified: trunk/spring-richclient/support/src/main/java/org/springframework/richclient/form/binding/swing/ComboBoxBinder.java =================================================================== --- trunk/spring-richclient/support/src/main/java/org/springframework/richclient/form/binding/swing/ComboBoxBinder.java 2006-11-17 10:28:26 UTC (rev 1565) +++ trunk/spring-richclient/support/src/main/java/org/springframework/richclient/form/binding/swing/ComboBoxBinder.java 2006-11-17 10:29:44 UTC (rev 1566) @@ -23,6 +23,7 @@ import javax.swing.ListCellRenderer; import org.springframework.binding.form.FormModel; +import org.springframework.core.closure.Closure; import org.springframework.util.Assert; /** @@ -34,19 +35,20 @@ public static final String EDITOR_KEY = "editor"; /** - * context key for a value which is used to mark an empty Selection. - * If this value is selected null will be assigned to the fields value + * context key for a value which is used to mark an empty Selection. If this value is selected null will be assigned + * to the fields value */ public static final String EMPTY_SELECTION_VALUE = "emptySelectionValue"; - private ListCellRenderer renderer; + private Object renderer; - private ComboBoxEditor editor; - + private Object editor; + private Object emptySelectionValue; public ComboBoxBinder() { - this(null, new String[] { SELECTABLE_ITEMS_KEY, COMPARATOR_KEY, RENDERER_KEY, EDITOR_KEY, FILTER_KEY, EMPTY_SELECTION_VALUE }); + this(null, new String[] { SELECTABLE_ITEMS_KEY, COMPARATOR_KEY, RENDERER_KEY, EDITOR_KEY, FILTER_KEY, + EMPTY_SELECTION_VALUE }); } public ComboBoxBinder(String[] supportedContextKeys) { @@ -87,22 +89,37 @@ return getComponentFactory().createComboBox(); } - public ListCellRenderer getRenderer() { - return renderer; - } - public void setRenderer(ListCellRenderer renderer) { this.renderer = renderer; } - public ComboBoxEditor getEditor() { - return editor; + /** + * Defines a closure which is called to create the renderer. The argument for the closure will be the default + * renderer (see [EMAIL PROTECTED] JComboBox#getRenderer()} of the combobox. The closure must create an instance of + * [EMAIL PROTECTED] ListCellRenderer} + * + * @param rendererClosure + * the closure which is used to create the renderer + */ + public void setRendererClosure(Closure rendererClosure) { + this.renderer = rendererClosure; } public void setEditor(ComboBoxEditor editor) { this.editor = editor; } + /** + * Defines a closure which is called to create the editor. The argument for the closure will be the default editor + * (see [EMAIL PROTECTED] JComboBox#getEditor()} of the combobox. The closure must create an instance of [EMAIL PROTECTED] ComboBoxEditor} + * + * @param editorClosure + * the closure which is used to create the editor + */ + public void setEditorClosure(Closure editorClosure) { + this.editor = editorClosure; + } + public Object getEmptySelectionValue() { return emptySelectionValue; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ spring-rich-c-cvs mailing list spring-rich-c-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs