You can set an ADF boolean binding on this UI control that you insert from the Data Control Palette:
The boolean binding lets users select the control and update an attribute in a data collection based on the control's selection state. You use the boolean binding editor to select the data collection and attribute on which you want the control to operate, then specify values corresponding to the control's selection state (for example, "true" for selected and "false" for unselected). You must know what values the bound attribute takes in order to supply meaningful values.
To set a boolean binding:
In the top portion of the Data Control Palette, select the desired attribute to display.
Be sure to select an attribute and not a data collection.
From the Data Control Palette, add the checkbox control to the data panel.
From the Structure window, display the boolean binding editor for the desired control.
In the Data Collection list, select the data collection which contains the attribute you want to update.
In the Attribute list, select the attribute to display with the values list.
If the iterator dropdown list already displays a named iterator to access the selected data collection, leave the selection unchanged. If the dropdown appears empty, click New and create the iterator so it appears in the dropdown list.
Warning: Changing the iterator selection in the dropdown list will remove the previously made attribute selection. Before you change the iterator selection, take note of the original attribute selection. If you need to, you can press Cancel to exit the binding editor without updating the original attribute selection. If you create the binding and decide not to use it, you can remove the unused iterator binding from the binding definition file; pressing Cancel in the editor will not automatically delete the binding.
In the Selected State Value field, enter the value the model will use to update the attribute when the user makes the control appear selected.
In the Unselected State Value field, enter the value the model will use to update the attribute when the user makes the control appear unselected.
Click OK to save the binding settings.
JDeveloper adds the setModel() method in the jbInit()
method to create the control binding. For example, after inserting a checkbox
from the Data Control Palette, the method which references
DataControlId to specify the meta-data, looks like this:
myCheckbox.setModel((ButtonModel)panelBinding.bindUIControl("DataControlId",
myCheckbox));
Meta-data for the new binding appears in the binding definition file (
UIModel.xml):
<DCControl
id="SameAsAttributeName"
DefClass="oracle.jbo.uicli.jui.JUButtonDef"
SubType="DCButton"
IterBinding="DataCollectionIteratorId"
ApplyValidation="false"
ListOperMode="0"
StaticList="true"
BoolVal="true"
<AttrNames>
<Item Value="MySelectedAttribute" />
</AttrNames>
<ValueList>
<Item Value="myTrueValue" />
<Item Value="myFalseValue" />
</ValueList>
</DCControl>
About the ADF Bindings and Swing Controls
Copyright © 1997, 2004, Oracle. All rights reserved.