Customizing an ADF Bounded Range Binding

You can set an ADF bounded range binding on these UI controls that you insert from the Data Control Palette:

The behavior of the bounded range control binding depends on the type of control used. Users may view and, in some cases, edit the value of a single attribute defined by a data collection. You use the bounded range binding editor to select the data collection and attribute, then define the range of permissible values. You must know what values the bound attribute takes in order to supply a meaningful range.

Note: In an ADF Business Components project, you can make attribute values updateable by setting a control hint on the attribute. In that case, users will be able to edit the updateable attribute's values directly.

To set an range binding:

  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 bounded range binding editor for the desired control.

  5. In bounded range binding editor, select the Data Collection that contains the attributes you want to display in the table.

  6. In the Attributes list, select a single attribute to display as the value of the control.

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

  8. In the case of a ProgressBar, ScrollBar, or Slider control, you can specify a Minimum and a Maximum value. These correspond to the start and end values supported by the control.

  9. In the case of the Slider and ScrollBar control, you can specify the Increment Value or interval between tick marks. Each tick mark corresponds to a possible value that the user could apply to the bound attribute.

    Note: In the case of the slider and scrollbar, attribute values are calculated by adding the control's minimum value to the product of the increment value and index of the selected tick mark. For example, if the minimum value is 20, the increment value is 10, and the user has selected the 3rd tick mark in the control, then the attribute value would be 20 + (10 x 3) = 50.

  10. 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:

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

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




<DCControl

         id="SameAsAttributeName"

         DefClass="oracle.jbo.uicli.jui.JUScrollBarAttrDef | JUSliderAttrDef | JUProgressBarAttrDef"

         SubType="DCScrollBarAttr | DCSliderAttr | DCProgressBarAttr"

         IterBinding="DataCollectionIteratorId"

         ApplyValidation="false"

         Horizontal="false"

         Min="0"

         Max="100"

         Ext="1" >

         <AttrNames>

            <Item Value="MySelectedAttribute" />

         </AttrNames>

</DCControl>    

About the ADF Bindings and Swing Controls

 

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