Shuttle Control in OA Framework


Shuttle Control in OA Framework

While working on various business scenarios, we may come across multiple situations wherein we need to select specific values from the list and require moving to another list which will be considered as final list.  OA framework provides shuttle control to fulfill the same. For e.g.  In Jdeveloper, while attaching view object to the application module we need to select correct view object from view object definition list in left side panel and move it to right side panel/list so as to include view object definition into the  application module. Well, to achieve such operations Oracle application framework provides such option by means of shuttle control.  Shuttle Control allows user to move values from one list region to other.
Design:  Select page region and right click -> new region set region style property of this region to shuttle.  After setting region style you will get shuttle region with default leading list. You may provide trailing list to shuttle region by selecting shuttle region right click -> trailing list. By default leading and trailing lists will be empty.  You may add values into leading and trailing list by specifying view object instance and VO attribute.
Adding values into the shuttle control:  Shuttle Control may have leading and trailing list. There are 2 different ways to add values to Leading and/or trailing list in shuttle control.

1)      By using View Object: By specifying pick list view object instance, display attribute and value attribute for leading list will populate values fetched from VO. By default shuttle control have leading list.



2)      Manually adding static values.

There might be a scenario wherein you may need to add independent (Raw text) values without fetching from view objects to shuttle region’s lists.  OA framework provides function to add values dynamically to shuttle control’s leading and/or trailing list. For adding static values to shuttle’s leading and trailing list, OA framework provides standard function to achieve the same. However user needs to specify default picklist view instance, view display and value attribute for leading and trailing list.
Code manually adds static text/ values.
/* First to find shuttle region in your page */
OADefaultShuttleBean shuttle = (OADefaultShuttleBean)webBean.findChildRecursive("ShuttleBean");
shuttle.prepareForRendering(pageContext);

/* Let control of leading list in shuttle control */
OADefaultListBean leading =  (OADefaultListBean)shuttle.getLeading();
leading.setListCacheEnabled(false);

/* Here I am displaying list of table columns in leading list */
Serializable TabName[] = {TableName,UserId};
ArrayList ar = (ArrayList)am.invokeMethod("SetColums",TabName);
System.out.println("Last index of array :"+ar.size());

/*Cleaning leading list*/
leading.clearIndexedChildren();

for (int i = 0; i < ar.size(); i++ )
{
      System.out.println("Element from Array :"+ar.get(i).toString());
      leading.addOption(ar.get(i).toString());
 }
    
AM Method: setColums()
   public ArrayList SetColums(String TableName,String UserId)
   {
       System.out.println("-----Inside SetColums------");
       tableColsVOImpl vo = this.gettableColsVO1();
       ArrayList array = new ArrayList();
       String Where =" table_name = '"+TableName+"'";
      System.out.println("Where Clause :"+Where);
       String Query = "select * from all_tab_cols where table_name like '"+TableName+"'"+ " AND OWNER = '" + UserId + "'"+" ORDER BY INTERNAL_COLUMN_ID";
       vo.setQuery(Query);
       //vo.setWhereClause(null);
       //vo.setWhereClause(Where);
       vo.executeQuery();
       System.out.println("Query ::"+vo.getQuery());

     /* getting a row */
       OARow row = (OARow)vo.next();
       while (row != null)
       {
              /*finally adding to array */
array.add(row.getAttribute(2)); /*get column name*/
            System.out.println("Column we fetched is :"+row.getAttribute(2));
            row = (OARow)vo.next();
       }    
       return array;
   }

   


 In above example, the values in leading list will be set dynamically based on table name.
For more details please refer Jdev guide -> shuttle.

Comments

  1. you have clearly explained about the process thus it is very much interesting and i got more information from your blog.For more information about oracle fusion please visit our website.

    Oracle Fusion Training Institute

    ReplyDelete

Post a Comment

Popular posts from this blog

Search on Master-detail table in OAF

Implement 3-level master detail hierarchy using table region in OA framework.