Oracle UIX API Reference
Release 2.1.22.0.0
B12196-01

oracle.cabo.ui.data.tree
Class ClientStateTreeDataProxy

java.lang.Object
  |
  +--oracle.cabo.ui.data.tree.BaseTreeDataProxy
        |
        +--oracle.cabo.ui.data.tree.ClientStateTreeDataProxy
All Implemented Interfaces:
TreeDataProxy

public class ClientStateTreeDataProxy
extends BaseTreeDataProxy

An implementation of TreeDataProxy interface which automatically provides links on the client for managing its own state, which consists of the expanded/collapsed state of the tree and optionally (depending on which constructor is used) the currently selected node in the tree.

This proxy will automatically store the expanded/collapsed state of the tree and handle passing this information to the renderer. It will also set up the links on each node so that clicking on a link will expand or collapse the corresponding node.

This is a "forgetful" tree proxy. In order to provide a compact encoding of the client expanded/collapsed state of the tree that can be passed through a URL, any nodes that are not visible are collapsed.

If you pass in null for the tree state, then the proxy will attempt to pull the default expanded/collapsed state from the node data. So, to have a tree opened up to a specific node by default, then in the data nodes, you need only to set the nodes along the default nodes path to the root to be expanded.

Selection will be handled by the proxy if the constructor that takes a selection parameter is used. While selection of nodes occurs on the client, without going back to the server, the proxy also supports selection of nodes over the server so that selection is not forgotten when the tree HTML must be refreshed. Currently the proxy only supports single selection. A node will remain selected (until a new selection is made) even if it is not visible.

If you wish to have the tree state handled by a servlet at _servletLocation, then the code for telling the tree to use a proxy (in init) looks like:

   _exampleTree.setAttributeValue(UIConstants.PROXY_ATTR,
                                  new DataBoundValue("my namespace",
                                                     "Tree Data",
                                                     "treeProxy"));
and in doGet, you simply need to get the right parameters from the servlet request and create a ClientStateTreeDataProxy using them:
 String treeState = request.getParameter(UIConstants.STATE_PARAM);
 String selection = request.getParameter(UIConstants.SELECTION_PARAM);
 String node = request.getParameter(UIConstants.NODE_PARAM);

 ClientStateTreeDataProxy myProxy = new ClientStateTreeDataProxy(_servletLocation,
                                                                 treeState,
                                                                 node,
                                                                 selection);
 DictionaryData treeData = new DictionaryData("treeProxy", myProxy);
 context.setDataObject("my namespace", "Tree Data", treeData);


Constructor Summary
ClientStateTreeDataProxy(java.lang.String submitURL, java.lang.String state, java.lang.String node)
          Create a ClientStateTreeDataProxy to be used with tree data that has a shared static structure and static data.
ClientStateTreeDataProxy(java.lang.String submitURL, java.lang.String state, java.lang.String node, java.lang.String selection)
          Create a ClientStateTreeDataProxy to be used with tree data that has a shared static structure and static data.
 
Method Summary
 void doPostRender(RenderingContext context, UINode node)
          Puts together the default state, if necessary.
 java.lang.String getCollapseDestination(RenderingContext context, DataObject node, int index)
          Returns a collapse destination which contains new client state.
 java.lang.String getExpandable(RenderingContext context, DataObject node, int index)
          Returns whether or not a node is expanded or collapsed according to the client state specified at the construction of the proxy.
 java.lang.String getExpandDestination(RenderingContext context, DataObject node, int index)
          Returns an expand destination which contains new client state.
 boolean isSelected(RenderingContext context, DataObject node, java.lang.String nodeID)
          Is this node selected?
 boolean selectionEnabled(RenderingContext context)
          Is selection enabled?
 void setFormName(RenderingContext context, java.lang.String formName)
          Use a URL or form submission for destinations?
 
Methods inherited from class oracle.cabo.ui.data.tree.BaseTreeDataProxy
getChildren, sharedInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientStateTreeDataProxy

public ClientStateTreeDataProxy(java.lang.String submitURL,
                                java.lang.String state,
                                java.lang.String node,
                                java.lang.String selection)
Create a ClientStateTreeDataProxy to be used with tree data that has a shared static structure and static data. Use this constructor if you want the Proxy to handle selection state.

Parameters:
submitURL - the URL of the servlet containing the TreeBean and proxy. This should be null when using form submission. When not using form submission, null will be substituted for the "default" URL - generally the current page.
state - an encoding the current state of the tree This cannot be created manually by a client; the only legal values are null and the parameter sent in a servlet request (or PageEvent).
node - an encoding of the node that modifies the current state This cannot be created manually by a client; the only legal values are null and the parameter sent in a servlet request (or PageEvent).
selection - an encoding that identifies the currently selected node. This cannot be created manually by a client; the only legal values are null and the parameter sent in a servlet request (or PageEvent).

ClientStateTreeDataProxy

public ClientStateTreeDataProxy(java.lang.String submitURL,
                                java.lang.String state,
                                java.lang.String node)
Create a ClientStateTreeDataProxy to be used with tree data that has a shared static structure and static data. Use this constructor if you do not want the proxy to handle selection state.

Parameters:
submitURL - the URL of the servlet containing the TreeBean and proxy. This should be null when using form submission. When not using form submission, null will be substituted for the "default" URL - generally the current page.
state - an encoding the current state of the tree This cannot be created manually by a client; the only legal values are null and the parameter sent in a servlet request (or PageEvent).
node - an encoding of the node that modifies the current state This cannot be created manually by a client; the only legal values are null and the parameter sent in a servlet request (or PageEvent).
Method Detail

doPostRender

public void doPostRender(RenderingContext context,
                         UINode node)
                  throws java.io.IOException
Puts together the default state, if necessary.
Overrides:
doPostRender in class BaseTreeDataProxy

getExpandDestination

public java.lang.String getExpandDestination(RenderingContext context,
                                             DataObject node,
                                             int index)
Returns an expand destination which contains new client state.
Overrides:
getExpandDestination in class BaseTreeDataProxy

getCollapseDestination

public java.lang.String getCollapseDestination(RenderingContext context,
                                               DataObject node,
                                               int index)
Returns a collapse destination which contains new client state.
Overrides:
getCollapseDestination in class BaseTreeDataProxy

getExpandable

public java.lang.String getExpandable(RenderingContext context,
                                      DataObject node,
                                      int index)
Returns whether or not a node is expanded or collapsed according to the client state specified at the construction of the proxy.
Overrides:
getExpandable in class BaseTreeDataProxy
Following copied from interface: oracle.cabo.ui.data.tree.TreeDataProxy
Parameters:
node - the tree node being examined.
index - the position of this node in the order in which the nodes of the tree are rendered.
Returns:
one of UIConstants.EXPANDABLE_NO, UIConstants.EXPANDABLE_EXPANDED or UIConstants.EXPANDABLE_COLLAPSED

selectionEnabled

public boolean selectionEnabled(RenderingContext context)
Description copied from interface: TreeDataProxy
Is selection enabled?
Overrides:
selectionEnabled in class BaseTreeDataProxy

isSelected

public boolean isSelected(RenderingContext context,
                          DataObject node,
                          java.lang.String nodeID)
Description copied from interface: TreeDataProxy
Is this node selected?
Overrides:
isSelected in class BaseTreeDataProxy

setFormName

public void setFormName(RenderingContext context,
                        java.lang.String formName)
Description copied from interface: TreeDataProxy
Use a URL or form submission for destinations?
Overrides:
setFormName in class BaseTreeDataProxy

Oracle UIX API Reference
Release 2.1.22.0.0
B12196-01

Copyright © 2002,2003, Oracle. All Rights Reserved.