Binding a Method with Parameters in a JClient Form

You can use the Data Control Palette to insert a button that will allow the user to initiate an action defined by a method of your business service. If your business service is ADF Business Components, many standard actions are predefined (such as Create, Delete, Next, Previous, Commit, and Rollback). However, when your business service is a JavaBean class, you must define a public method and register the bean as an ADF data control. The method that you create, may define arguments whose values can be supplied by the JClient form user.

Alternatively, you can supply the parameter values of the method in the Property Inspector.

To populate the Data Control Palette with your JavaBean's methods:

  1. Define the JavaBean that you want your Oracle ADF application to access. The business services appear in your model project.

  2. Register the business services in your model project with the ADF data controls. If the Data Control Palette is already open, the business services hierarchy appears in the top portion of the palette.

To create a JClient Form with method bindings:

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

  2. Choose View | Component Palette and insert a JTextField from the Swing page of the palette.

  3. Repeat the previous step for each argument that the method defines. The user will define the parameters of the method using the text fields you insert.

  4. Choose View | Data Control Palette to open the palette.

    The Data Control Palette opens with the previously registered business services displayed in the top portion of the tool.

  5. In the top portion of the Data Control Palette, expand the Operations folder for the data collection or data control that displays the desired custom method.

    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.

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

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

  8. Add a focusListener to the text field and modify its focusLost method in the data panel's .java file, using the following code to pass the parameter to the method:

    
    private void jTextField1_focusLost(FocusEvent e) 
    
      { 
    
        JUCtrlActionBinding action = (JUCtrlActionBinding)panelBinding.getCtrlBinding(jButton1); 
    
        ArrayList arg1 = new ArrayList(); 
    
        arg1.add(jTextField1.getText()); 
    
        action.setParams(arg1); 
    
      
    
      }	  
    
    	          
  9. Repeat the previous step to create an event handler for each text field that supplies a method parameter.


Customizing an ADF Action Binding
Supplying Method Parameters for an Action Binding

 

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