- Rendering the ability to Expand All | Collapse All
- Auto-expanding the entire HGrid
An HGrid is what Oracle calls a tree structure with more complex features than a standard hierarchy tree. What we're concerned with is the client who asks, "Why can't I display the whole tree? It takes forever to expand every node!" There might be some HGrids that offer the ability to Expand/Collapse out of the box, but in Manager Self-Service, this must be enabled programmatically through an extension of the Controller class. First, browse to the page in question to see the standard functionality:
(N) Manager Self-Service -> My Employee Information
At a glance, we can see the first level of subordinates to the manager. In order to see the complete tree, one must click the plus signs. Suppose many levels are beneath these top level managers; clicking through each one could take forever. HGrids have the capability to Expand / Collapse and to auto-expand the tree, but this functionality is not currently available via personalizations. In order to change this part of the user interface, we must extend the delivered Controller class (CO) with our own custom code.
In order to understand how the page works and to identify which code needs to be extended, click the "About this Page" link in the lower left corner. There are many View Objects on this page; the Employment tab will be used in this example:
The OverviewDisplayCO Controller class file handles the user interface for this part of the page. In order to see what the default behavior is in this Controller, it must be retrieved from the server and decompiled. It's location is listed under the Business Component Reference Details heading on the About Page:
Expand the Business Component Reference Details and scroll down to the Controllers:
oracle.apps.per.selfservice.mgrviews.webui.OverviewDisplayCO is located on the middle tier at $JAVA_TOP/oracle/apps/per/selfservice/mgrviews/webui/OverviewDisplayCO.class. FTP to retrieve the file and decompile it. Find the ProcessRequest method:
// This line causes the HGrid to only display one level of subordinates:
hGridBean.setAutoExpansionMaxLevels(1);
// This line turns off the Expand All | Collapse All links:
hGridBean.setExpandAllEnabled(false);
In order to change this behavior, we need to do the following:
- extend the delivered controller class with our own
- FTP this file to the $JAVA_TOP on the middle tier
- Personalize the page to execute our controller class instead of the delivered one
These steps are detailed on the previous entry "Controller class extension in Oracle Applications" For brevity's sake, the extended CO code is shown below. This will be placed under the custom application hack.oracle.apps.per.selfservice.mgrviews.webui.on the middle tier. The custom CO will be called hackOverviewDisplayCO, naturally.
package hack.oracle.apps.per.selfservice.mgrviews.webui;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.per.selfservice.mgrviews.webui.OverviewDisplayCO;
import oracle.apps.fnd.framework.webui.beans.table.OAHGridBean;
/**
* Controller for ...
*/
public class hackOverviewDisplayCO extends OverviewDisplayCO
{
public static final String RCS_ID="$Header$";
public static final boolean RCS_ID_RECORDED =
VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
/**
* Layout and page setup logic for a region.
* @param pageContext the current OA page context
* @param webBean the web bean corresponding to the region
*/
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
OAHGridBean oaHgrid = (OAHGridBean)webBean.findIndexedChildRecursive("SupHierarchy");
//
if (oaHgrid != null)
{
oaHgrid.setExpandAllEnabled(true);
oaHgrid.setAutoExpansionMaxLevels(99); // int.MAX_VALUE
}
}
/**
* Procedure to handle form submissions for form elements in
* a region.
* @param pageContext the current OA page context
* @param webBean the web bean corresponding to the region
*/
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);
}
}
Once the code is deployed to the middle tier, bounce Apache. Then browse to the page and personalize the Controller Class property to point at the new CO:
(N) Manager Self-Service -> My Employee Information -> Click "Personalize Page" in the upper right corner
Replace Inherit with hack.oracle.apps.per.selfservice.mgrviews.webui.hackOverviewDisplayCO:
If the changes are not yet visible, try clicking Home and then browsing to Manager Self-Service -> My Employee Information again: