Please disable your adblock and script blockers to view this page

Search this blog

Showing posts with label Shuttle Component. Show all posts
Showing posts with label Shuttle Component. Show all posts

Friday 2 May 2014

Pre-populate selected values in viewObject based shuttle component (multiple selection)- Oracle ADF

Hello All,
This post talks about a common development requirement
while using shuttle component sometimes we need to show some values on selected side of af:selectManyShuttle , so to do this normally we use a custom shuttle component that is populated from managed bean code
but when i have all data in a viewObject so why should i iterate viewObject to get all data in managed bean and then set some values in an arrayList to populate selected shuttle values.
it is time consuming and requires lot of coding, so for viewObject based shuttle we can do it in efficient way.

  • In this example I'm using Departments table of HR schema to populate af:selectManyShuttle, i think you all know how to create a shuttle in ADF
  • So next is to populate selected shuttle values on some event, created a fusion web application using Departments table

  • It's time to drop Departments ViewObject on page as shuttle component

  • <af:selectManyShuttle value="#{bindings.Departments1.inputValue}" label="#{bindings.Departments1.label}"
                                          id="sms1" size="15" binding="#{pageFlowScope.ShuttleSelectBean.shuttleBind}"
                        <f:selectItems value="#{bindings.Departments1.items}" id="si1"/>
                        <f:validator binding="#{bindings.Departments1.validator}"/>

  • So suppose on a button click i want to set selected values in shuttle, so i have created a actionEvent for button in managed bean and binding of af:selectManyShuttle, so basic structure of page is like this

  • See the code of actionEvent , create an arrayList and add all values in it that you want to set as selected values and then just set the value in shuttle using binding

  •     /**Method to set selected values in af:selectManyShuttle
         * @param actionEvent
        public void selectValuesShuttle(ActionEvent actionEvent) {
            DCIteratorBinding iter = (DCIteratorBinding) getBindingsCont().get("Departments1Iterator");
            ViewObject vo = iter.getViewObject();
            RowSetIterator rsi = vo.createRowSetIterator(null);
            ArrayList listVal = new ArrayList(20);
            while (rsi.hasNext()) {
                Row nextRow =;
                if (nextRow.getAttribute("DepartmentId") != null) {
            shuttleBind.resetValue();// Reset Shuttle Component
            System.out.println("Setting values -" + listVal);
            shuttleBind.setValue(listVal.toArray()); // Setting selected values 

  • Now run this page and test your shuttle component

  • Cheers- Happy Coding

  • But this method works only when you have to set values on some action or other event after page load, because before page load , binding of shuttle component will not be accessible
  • So if you have a requirement of setting selected values on page load then you must use a list defined in managed bean and bind it to  value property of shuttle component, value property denotes selected values of shuttle 

  • And just write same code on getter of List, in this case selected values in shuttle are populated on page load

  •     List pageLoad = new ArrayList(20);
        public void setPageLoad(List pageLoad) {
            this.pageLoad = pageLoad;
        public List getPageLoad() {
            DCIteratorBinding iter = (DCIteratorBinding) getBindingsCont().get("Departments1Iterator");
            ViewObject vo = iter.getViewObject();
            RowSetIterator rsi = vo.createRowSetIterator(null);
            while (rsi.hasNext()) {
                Row nextRow =;
                if (nextRow.getAttribute("DepartmentId") != null) {
            return pageLoad;

    Cheers- Use both method as per your requirement :-) Download Sample App

Friday 20 December 2013

Clear Selected Values of shuttle component (Reset shuttle) programmatically-Oracle ADF

Hello All ,
you have heard about shuttle component in ADF,  it works for multiple selection
to use it -refer my previous blog post
Shuttle Component in Oracle ADF (Allow Multiple Selection)

Sometimes we need to reset shuttle (clear selected values) through our code (managed bean)
so in this post I'm going to explain how to do this with simple piece of code
  • I have created a simple jspx page and placed Departments (HR Schema) view-object on this page as an af:selectManyShuttle
  • Created managed bean for a link to clear selected indices of shuttle, see code

  •     public BindingContainer getBindings() {
            return BindingContext.getCurrent().getCurrentBindingsEntry();
        /**Method to Clear selected value of shuttle (Reset Shuttle)
         * @param actionEvent
        public void resetShuttleAction(ActionEvent actionEvent) {
            BindingContainer bc = this.getBindings();
            JUCtrlListBinding listBindings = (JUCtrlListBinding)bc.get("DepartmentsView1");

  • Now see how it works- when user click on this link ,it will clear all selected indices of shuttle

Wednesday 21 November 2012

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

Hello All

Hope you all are doing well :) 

Shuttle component supports multiple selections at Runtime, when we need to select multiple records at runtime then we can use Shuttle Component.

Now we see how to use shuttle component (af:selectManyShuttle) in Oracle ADF

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 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 selected attribute of this shuttle component
    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++) {

    When you run this it should look like this and your Shuttle is ready
    Get selected value of shuttle component ADF