Shuttle Component in Oracle ADF (Allow Multiple Selection), Get Selected values from Shuttle Component

Sharing is Caring

Hello All

Hope you all are doing well 🙂 

In this post, I’ll talk about ADF Faces Shuttle component. Shuttle component supports multiple selections at runtime, when we need to select multiple records at runtime then we can use shuttle component in Oracle ADF

From Oracle Docs –

The selectManyShuttle provides a mechanism for selecting multiple values from a list of values by allowing the user to move items between two lists. The “value” attribute of the selectManyShuttle, like any other selectMany component, must be a List or array of values that correspond to a value of one of the contained SelectItems. If a value of one of the SelectItems is in the List or array, that item will appear in the trailing list. Looked at another way, you can change a selectManyListbox directly into a selectManyShuttle; instead of the “value” driving which items are selected in the list box, it affects which items appear in the trailing list of the shuttle.

Now we’ll see how to use shuttle component in Oracle ADF application and allow the user to select multiple values at a time.

Shuttle Component in Oracle ADF
Follow these steps-
  • Prepare model for Employees table of HR Schema(Create EO, VO and AM)
  • Now drag Employees ViewObject from DataControl to page and select multiple selection–>ADF Select Many Shuttle-
Drop ViewObject as ADF Select Many Shuttle

 

  • Now edit binding for this Shuttle Component, choose the attribute that you want to show and also base attribute
    Edit Shuttle binding and select base and display attribute
  • Now it will look like this, drag a button to get the selected attribute of this shuttle component
    af:selectManyShuttle
     
    Now write code on button’s actionEvent to get selected value from Shuttle-

    import oracle.adf.model.BindingContext;
    import oracle.binding.BindingContainer;
    
    /*****Generic Method to get BindingContainer of current page, fragment or region**/
    public BindingContainer getBindingsCont() {
    return BindingContext.getCurrent().getCurrentBindingsEntry();
    }

     public void getSelectedValue(ActionEvent actionEvent) {
          //Get Binding Continer of Page
            BindingContainer bc = this.getBindingsCont();
         //Get shuttle binding from pagedef
            JUCtrlListBinding listBindings = (JUCtrlListBinding)bc.get("Employees1");
        //Get Selected Values
            Object str[] = listBindings.getSelectedValues();
        //Iterate over selected values
            for (int i = 0; i < str.length; i++) {
                System.out.println(str[i]);
            }
        }

    When you run this it should look like this and your Shuttle is ready

    Shuttle component in Oracle ADF

Cheers 🙂 Happy Learning

Related Posts

An Oracle ACE, Blogger, Reviewer, Technical Lead working on Oracle ADF

0 thoughts on “Shuttle Component in Oracle ADF (Allow Multiple Selection), Get Selected values from Shuttle Component”

  1. guys my view object has parameter which is sent in the login page, just before the shuttle page appears but the shuttle is always empty unless i remove the query parameters and get a fixed query the shuttle works…..
    please help me

Leave a Reply

Your email address will not be published. Required fields are marked *