-
Binding a Boolean Value
Hi,
I have a model object binding in a form.
By default a Boolean value is showed like a radio button.
I need that this Boolean value binding to a ComboBox or similar that supports 3 values (null, true, false) showing in the ComboBox ("", "yes", "no").
This can be very useful in the Data Editor to do filter. With the default implementation I have problems, don't support null.
I try to do that, but I don't have success.
Can any give me an idea
PD: sorry for the bad english
-
Recently I've added a new binder that allows just that. It's called the StringSelectionListBinder. It also has Boolean behavior built-in. Take a look at the trunk.
To use it, define a binder like this:
Code:
<bean id="nullableBooleanComboBoxBinder" class="org.springframework.richclient.form.binding.swing.StringSelectionListBinder">
<property name="keys">
<util:constant static-field="org.springframework.richclient.form.binding.swing.StringSelectionListBinder.TRUE_FALSE_NULL"/>
</property>
<property name="labelId" value="nullableBooleanComboBoxBinder"/>
</bean>
Standard it will show true, false or null, but if you define the keys nullableBooleanComboBoxBinder.true.label, nullableBooleanComboBoxBinder.false.label and nullableBooleanComboBoxBinder.null.label, you can change the shown Strings.
-