Customizing an ADF List Binding in LOV Mode

You can set an ADF list binding in LOV (list of value) mode on these UI controls that you insert from the Data Control Palette:

Note: In the case of Button LOV, the control provides both the UI to display the selection and the UI (in the form of a separate window) to make the selection. All other controls require that your add a separate control to display the target of the user's selection.

A LOV mode binding lets users choose a value from a list that displays the data collection rows of one or more attributes. When the user makes the selection, the LOV updates one or more attributes of another data collection based on their selection. You use the list binding editor in LOV mode to define the source and target data collections, the binding between their attributes, and the attributes to display in the LOV.

To set a list binding in LOV 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.

    Hint: Drop the desired ComboBox, Button LOV, List, or Radio Button Group on the open panel in a position near the form field that you want to receive the LOV selection.

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

To define the LOV to display:

  1. In the list binding editor, select LOV Mode from the List Binding Mode dropdown list.

  2. Click the LOV Update Attributes tab and select the data collections you want your LOV to use:

    LOV (Source) Data Collection defines the collection that you want to use to display your list of values for selection. This should be a collection that is not constrained by a master data collection in the business services Model project.

    Target Data Collection is the collection that contains the attribute you want to receive the selected value in the JClient panel. This should be the same data collection that your panel displays.

  3. 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 previously made attribute selections. Before you change the iterator selection, take note of the original attribute selections. If you need to, you can press Cancel to exit the binding editor without updating the original attribute selections. 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.

  4. Click Add to bind at least one attribute between the two data collections.

    The bottom area of the list binding editor displays a table with a list of possible LOV binding attributes between the collection used to display the list of values and the collection used to receive the attribute selection.

  5. Choose the attribute from the LOV Attributes dropdown that you want to use to supply the value to the field displayed in the JClient form.

  6. Choose the attribute from the Target Attributes dropdown that you want to receive the value from the LOV.

  7. Click Add again to bind multiple attributes through the same LOV.

  8. Click the LOV Display Attributes tab and select the attributes that you want the LOV window to display. You may add as many attributes as desired to the Selected Attributes list, although you are not required to include the LOV binding attribute (the attribute that you want to display the selected value).

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

myList.setModel((ListModel)panelBinding.bindUIControl("DataControlId", myList));

Meta-data for the new binding is added to the binding definition file ( UIModel.xml):




<DCControl

         id="SameAsSourceLOVAttributeName"

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

         SubType="DCLovButton | DCComboBox | DCListSingleSel | DCButtonGroup | DCSpinner"

         IterBinding="DataCollectionIteratorId"

         ApplyValidation="false"

         ListOperMode="0"

         ListIter="OrdersView1Iterator"

         AllowSearch="false"

         TestFlag="false" >

         <AttrNames>

            <Item Value="MySelectedTargetAttribute" />

         </AttrNames>

         <ListAttrNames>

            <Item Value="MySelectedLOVSourceAttribute" />

         </ListAttrNames>

         <ListDisplayAttrNames>

            <Item Value="MySelectedDisplayAttribute1" />

            <Item Value="MySelectedDisplayAttribute2" />

            ...

         </ListDisplayAttrNames>

</DCControl>    

To insert a control to display the updated LOV target attribute value:

  1. In the top portion of the Data Control Palette, select the attribute which you previously selected as the LOV binding's target attribute.

  2. From the Drag and Drop As list select the UI component that you want to insert to display the updated attribute value.

  3. Drag the selected attribute from the Data Control Palette into the open panel.

To modify the number of rows to display in the LOV:

  1. With the document open in the Visual Editor, choose View | Structure to open the Structure window.

  2. Click UI Model tab icon (UI Model) in the Structure window toolbar and expand the node to display the list of bindings.

  3. Select the iterator binding which you selected for the LOV's source data collection and choose View | Property Inspector to open the Property Inspector.

  4. In the Range Size field of the Property Inspector, edit the value and press Enter. You can increase the value from the default value of 10 rows.

    Note, the value -1 and 0 have specific meaning: the value -1 returns all available objects from the collection, while the value 0 will return the same number of objects as the collection uses to retrieve from its data source.

For additional information about working with range size, see Limiting Row Fetches Using an ADF Iterator Binding.


About the ADF Bindings and Swing Controls
About LOV Dialog Support in JClient

 

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