Customizing an ADF Attribute Binding

You can set an ADF attribute binding on these basic UI components that you insert from the Data Control Palette:

And on these UI components to display various kinds of content (besides text):

The behavior of the attribute 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 attribute binding editor to select the data collection and attribute.

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

  5. In the attribute binding editor, select the Data Collection that contains the attribute you want to display.

  6. In the Attribute 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. Click OK to save the binding settings.

JDeveloper adds the setModel() or setDocument() method in the jbInit() method to create the control binding. For example, after inserting a text field from the Data Control Palette, the method which references DataControlId to specify the meta-data, looks like this:

myTextField.setDocument((Document)panelBinding.bindUIControl("DataControlId", myTextField));

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




<DCControl

         id="SameAsAttributeName"

         <? Label only ?> 

         DefClass="oracle.jbo.uicli.jui.JULabelDef"

         SubType="DCTextField | DCLabel"

         IterBinding="DataCollectionIteratorId"

         ApplyValidation="false"

         <AttrNames>

            <Item Value="MySelectedAttribute" />

         </AttrNames>

</DCControl>    

About the ADF Bindings and Swing Controls
Using JClient Text Fields to Display Object Attributes

 

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