|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.click.extras.tree.Tree.CookieHandler
Please note this class is only meant for developers of this control, not users.
This class implements a cookie based javascript handler. Cookies in the browser tracks the expand and collapse state of the nodes. When a request is made to the server the cookies is processed and the state of the nodes are modified accordingly. There are two cookies used to track the state:
Field Summary | |
protected String |
collapsedCookieName
Name of cookie responsible for tracking the expanded node id's. |
protected String |
expandedCookieName
Name of cookie responsible for tracking the expanded node id's. |
protected Tree.JavascriptRenderer |
javascriptRenderer
Variable holding a javascript renderer. |
Constructor Summary | |
protected |
Tree.CookieHandler(Context context)
Creates and initializes a new CookieHandler. |
Method Summary | |
protected Set |
asSet(String value,
String delim)
Returns the specified string value as a set, tokenizing the string based on the specified delimiter. |
void |
destroy()
Called to indicate the user request cycle is complete. |
Tree.JavascriptRenderer |
getJavascriptRenderer()
Returns the javascript renderer associated with this handler. |
void |
init(Context context)
Initialize the handler state from the current cookies. |
void |
nodeCollapsed(Tree tree,
TreeNode node,
Context context,
boolean oldValue)
Removes the specified node from the cookie handler tracker. |
void |
nodeDeselected(Tree tree,
TreeNode node,
Context context,
boolean oldValue)
Invoked when user deselected the specified node. |
void |
nodeExpanded(Tree tree,
TreeNode node,
Context context,
boolean oldValue)
Adds the specified node to the cookie handler tracker. |
void |
nodeSelected(Tree tree,
TreeNode node,
Context context,
boolean oldValue)
Invoked when user selected the specified node. |
protected String |
prepareCookieValue(String value)
Does some preparation on the cookie value like decoding and stripping of unneeded characters. |
boolean |
renderAsExpanded(TreeNode treeNode)
Currently this implementation just calls Tree.isExpandedParent(TreeNode) . |
protected void |
setCookie(String value,
String name)
Sets a cookie with the specified name and value to the http response. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final String expandedCookieName
protected final String collapsedCookieName
protected Tree.JavascriptRenderer javascriptRenderer
Constructor Detail |
protected Tree.CookieHandler(Context context)
context
- provides access to the http request, and sessionMethod Detail |
public void init(Context context)
init
in interface Tree.JavascriptHandler
context
- provides access to the http request, and sessionpublic boolean renderAsExpanded(TreeNode treeNode)
Tree.isExpandedParent(TreeNode)
.
CookieHandler uses cookies to sync any state change on
the browser with the server, so the handler will not
contain any state outside of the treeNode.
renderAsExpanded
in interface Tree.JavascriptHandler
treeNode
- the specified treeNode to check if it is part of the
users selected paths
renderAsExpanded(TreeNode)
public void destroy()
Tree.JavascriptHandler
destroy
in interface Tree.JavascriptHandler
destroy()
public Tree.JavascriptRenderer getJavascriptRenderer()
Tree.JavascriptHandler
getJavascriptRenderer
in interface Tree.JavascriptHandler
getJavascriptRenderer()
public void nodeExpanded(Tree tree, TreeNode node, Context context, boolean oldValue)
nodeExpanded
in interface TreeListener
tree
- tree the operation was made onnode
- node that was expandedcontext
- provides access to Context
oldValue
- contains the previous value of expanded stateTreeListener.nodeExpanded(Tree, TreeNode, Context, boolean)
public void nodeCollapsed(Tree tree, TreeNode node, Context context, boolean oldValue)
nodeCollapsed
in interface TreeListener
tree
- tree the operation was made onnode
- node that was collapsedcontext
- provides access to Context
oldValue
- contains the previous value of selected stateTreeListener.nodeCollapsed(Tree, TreeNode, Context, boolean)
public void nodeSelected(Tree tree, TreeNode node, Context context, boolean oldValue)
TreeListener
nodeSelected
in interface TreeListener
tree
- tree the operation was made onnode
- node that was selectedcontext
- provides access to Context
oldValue
- contains the previous value of selected stateTreeListener.nodeSelected(Tree, TreeNode, Context, boolean)
public void nodeDeselected(Tree tree, TreeNode node, Context context, boolean oldValue)
TreeListener
nodeDeselected
in interface TreeListener
tree
- tree the operation was made onnode
- node that was selectedcontext
- provides access to Context
oldValue
- contains the previous value of selected stateTreeListener.nodeDeselected(Tree, TreeNode, Context, boolean)
protected void setCookie(String value, String name)
value
- the cookie's valuename
- the cookie's nameprotected String prepareCookieValue(String value)
value
- the cookie's value to prepare
protected Set asSet(String value, String delim)
value
- value to return as setdelim
- delimiter used to tokenize the value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |