Customizing an ADF Action Binding

You can customize an ADF action binding on this UI control that you insert from the Data Control Palette:

An action binding lets users initiate actions on the attributes and collections of the specific business service. Actions are defined by the business service's class methods and will appear in the Operations folders displayed in the Data Control Palette.

You use the action binding editor to select a data collection or data control and corresponding action. Or, when you use the Data Control Palette to insert the action as a button, the action binding editor displays your selections.

Note: If the custom method accepts parameters, the actual value for parameters may be specified through the Property Inspector. The action binding editor does not support entering value for the method arguments.

For certain business services, the ADF data control for that business service may support standard actions. For example, in the case of ADF Business Components, these standard actions are available:

When users initiate the action, the bound data collection is immediately updated. The UI reflects the change through any control bindings that use the same data collection as the action binding.

To set an action binding:

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

  2. In the top portion of the Data Control Palette, expand the Operations folder for the desired data collection or data control.

    Note: The Data Control Palette hierarchy represents operations (such as Create and Delete) that apply to a specific data collection in the Operations folder below the data collection. When supported by the ADF data control for your business service, you can also select operations (such as Commit and Rollback) that apply to all data collections in the current document's binding context in the Operations folder at the top branch of the hierarchy.

  3. Select the desired action from the expanded Operations folder.

  4. From the Data Control Palette, add the button control to the data panel.

    When working with web pages, you can choose to insert the button with or without an HTML form element. The form element submits the action for handling with the page request. If your web page already has a form element, select the button without a form and insert it into your page's existing form.

  5. From the Structure window, display the action binding editor for the desired control.

  6. In the Data Collection list, select the collection on which you want to perform the action.

    Hint: Add other UI controls to your data panel to display the results of the action on the data collection. Those controls need only set a control binding on the same data collection as the action binding to reflect the action in the UI.

  7. In Select an Action, select the action to perform on the selected data collection.

  8. The Select an Iterator field should be left empty if you have selected a custom method, such as Commit or Rollback, which are actions on the ADF data control and do not require an iterator.

    If the Select an Iterator list already displays a named iterator to access the selected data collection, you may leave the selection unchanged, or if you have selected one of the predefined actions provided by the business service data collection (for example, Next, Next Set, Previous, and Previous Set), 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. Click OK to save the binding settings.

  10. Open the Property Inspector to define any method parameter values.

    Alternatively, you can create a JClient form that allows the user to supply the parameters of the method.

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

myButton.setModel((ButtonModel)panelBinding.bindUIControl("DataControlId", myButton));

When the action binding is a custom method, the following meta-data for the new binding appears in the binding definition file (UIModel.xml ). Note, the method argument definitions appear undefined until you use the Property Inspector to specify the values.




<DCControl

         id="sameAsMethodName"

         SubType="DCMethodAction"

         Action="999"

         DataControl="ClassName"

         InstanceName="ClassName.dataProvideer"

         MethodName="methodName"

         ReturnName="ClassName.methodResults.ClassNameDataControl_dataProvider_methodName_result"

         RequiresUpdateMode="false" >

		 <Contents >

            <NamedData

               NDName="Arg0"

               NDType="java.lang.String"

               NDValue="%null%" >

            </NamedData>

         </Contents>

</DCControl>    

Note: By default when you create an action binding for the same method more than once, the return location of the method is the same. This means if you want to create unique action bindings for the same method, you must edit the ReturnName attribute to supply a unique name for each binding. Normally, you will leave the location the same for duplicate usages of the same action binding (where each usage specifies different parameter values). This permits all bound controls in the binding context to find the result under the same return name.

When the action binding is a standard method, meta-data for the new binding appears in the binding definition file (UIModel.xml ):




<DCControl

         id="SameAsActionName"

         SubType="DCAction"

         DTClass="oracle.adf.dt.objects.JUDTCtrlDataControlAction"

         Action="ActionNameIdentifier"

         DataControl="BusinessServiceDataControlName"

</DCControl>    

About the ADF Bindings and Swing Controls
Supplying Method Parameters for an Action Binding
Binding a Method with Parameters in a JClient Form

 

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