Customizing an ADF List Binding in Enumeration Mode

You can set an ADF list binding in enumeration mode on these UI controls that you insert from the Data Control Palette:

An enumeration mode binding lets users select a value from a display list to update an attribute in a data collection. You use the model list binding editor in enumeration mode to select the data collection and attribute on which you want the control to operate, then specify a set of values from which the user may select. You must know what values the bound attribute takes in order to supply meaningful choices.

To set a list binding in enumeration mode:

  1. Open the data panel in the Java Visual Editor.

  2. 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.

  3. From the Data Control Palette, add the desired control to the data panel.

  4. From the Structure window, display the list binding editor for the control.

  5. In the list binding editor, select Enumeration Mode from the List Binding Mode dropdown list.

  6. In the Data Collection list, select the data collection that contains the attribute you want to update.

  7. In the Attribute list, select the attribute to display with the values list.

  8. 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.

  9. If the control is a combobox, list, or radio button group, enter the values in Set of Values in the order you want the control to display them. Press Enter to set the value and begin typing a new value. Values you supply must be valid for the attribute.

  10. If the control is a spinner, select Range of Values when you want the user to be able to choose from a range that you define. If you prefer to define a specific list, select Static Values and enter the values as described for list and combobox above.

  11. 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 slider from the Data Control Palette, the method which references DataControlId to specify the meta-data, looks like this:

mySpinner.setModel((BoundedRangeModel)panelBinding.bindUIControl("DataControlId", mySpinner));

Meta-data for the new binding appears in the binding definition file ( UIModel.xml):




<DCControl

         id="SameAsDataCollectionName"

         DefClass="oracle.jbo.uicli.jui.JUComboBoxDef | JUListSingleSelDef | JUButtonGroupDef | JUSpinnerDef"

         SubType="DCComboBox | DCListSingleSel | DBButtonGroup | DCSpinner"

         IterBinding="DataCollectionIteratorId"

         ApplyValidation="false"

         ListOperMode="O"

         StaticList="true"

         <? Combobox  only ?>

         Editable="false"

         <? List only ?>

         ShouldScroll="false"

         <AttrNames>

            <Item Value="MySelectedAttribute" />

         </AttrNames>

</DCControl>    

About the ADF Bindings and Swing Controls

 

Copyright © 1997, 2004, Oracle. All rights reserved.