|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.wewebu.ow.server.ui.OwEventTarget
com.wewebu.ow.server.ui.OwView
com.wewebu.ow.server.ui.OwTreeView
public abstract class OwTreeView
Generic Tree View base class. Implements a template pattern to render
arbitrary object tree structures. Just overwrite the getName and
getDisplayName functions to render your special object nodes.
To be implemented for the tree objects.
Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.
For licensing information read the license.txt file or
go to: http://wiki.alfresco.com
Nested Class Summary | |
---|---|
static interface |
OwTreeView.OwTreeViewEventListner
Base class for event listeners to OwTreeView. |
class |
OwTreeView.OwTreeViewNode
|
Field Summary | |
---|---|
protected OwSort |
childrenSort
The children sort criteria. |
static int |
DISPLAY_MODE_REGISTER_NODES
display mode for rendering of the treenodes |
static int |
DISPLAY_MODE_TREE_NODES
display mode for rendering of the treenodes (default) |
protected OwTreeView.OwTreeViewEventListner |
m_eventlistner
eventlistener for the tree view |
protected OwTreeView.OwTreeViewNode |
m_focusNode
currently focus node of null if nothing is focused |
protected Map |
m_nodeMap
map containing all nodes mapped by their ID |
protected OwTreeView.OwTreeViewNode |
m_root
root node |
protected OwTreeView.OwTreeViewNode |
m_selectedNode
currently selected node of null if nothing is selected |
protected String |
m_strDesignURL
URL to the design dir |
protected String |
m_strPath
current navigated path |
protected static String |
NODE_ID_KEY
|
static String |
PATH_DELIMITER
delimiter used to build the path |
Fields inherited from class com.wewebu.ow.server.ui.OwView |
---|
CURRENT_MODULE_KEY, FORMULAR_PLACEHOLDER_END_DELIMITER, FORMULAR_PLACEHOLDER_START_DELIMITER, m_externalFormEventTarget |
Fields inherited from interface com.wewebu.ow.server.ui.OwBaseView |
---|
EMPTY_STRING |
Constructor Summary | |
---|---|
OwTreeView()
|
Method Summary | |
---|---|
void |
addNode(OwTreeView.OwTreeViewNode node_p)
add a node to the node map for fast access |
boolean |
canNavigate()
check if tree has been initialized with objects and can be browsed |
void |
clearSelection()
(overridable) Reset the current selection. |
protected abstract List |
createChildObjects(Object obj_p)
Create a list of child objects to the given object. Must be implemented by derived classes. |
protected OwTreeView.OwTreeViewNode |
createTreeViewNode(OwTreeView treeView_p,
Object obj_p)
overridable factory method check of node has subnodes to be overwritten by the derived class |
protected abstract void |
expandParents(Object theObject_p)
Expand the parents of the current object |
OwSort |
getChildrenSort()
Get the currently set children sort criteria |
String |
getClientSideId()
Get the id used for client side scripts for calculate the height of the tree. |
protected String |
getCloseIconURL(Object obj_p,
OwTreeView.OwTreeViewNode node_p)
Get an URL for the close icon. Should be implemented by the derived class. |
OwTreeView.OwTreeViewNode |
getCurrentNode()
get the currently selected node |
protected String |
getDisplayHTML(Object obj_p,
OwTreeView.OwTreeViewNode node_p)
Returns HTML code to be used to display a node. If you override this method, you have to make sure that the HTML code is properly encoded! |
protected int |
getDisplayMode()
get the display mode of the view |
protected String |
getDisplayName(Object obj_p,
OwTreeView.OwTreeViewNode node_p)
Returns the text to be displayed as the name of the node. This text will be properly encoded before used. |
protected abstract String |
getName(Object obj_p,
OwTreeView.OwTreeViewNode node_p)
get the name for an object, used to build paths to be implemented by the derived class |
protected OwTreeView.OwTreeViewNode |
getNodeForObject(Object theObject_p)
|
protected OwTreeView.OwTreeViewNode |
getNodeFromID(String strID_p)
get node from node ID |
protected String |
getOpenIconURL(Object obj_p,
OwTreeView.OwTreeViewNode node_p)
get a URL to the open icon to be implemented by the derived class |
protected String |
getRegisterItemStyle()
get the style for the tree item |
protected String |
getSelectedRegisterItemStyle()
get the style for the selected tree item |
protected String |
getSelectedTreeItemStyle()
get the style for the selected tree item |
protected String |
getTreeItemStyle()
get the style for the tree item |
protected boolean |
hasPlusMinusIcon(Object obj_p,
OwTreeView.OwTreeViewNode node_p)
(overridable) check of node has subnodes to be overwritten by the derived class |
protected void |
init()
init the target after the context is set. |
boolean |
isEmpty()
check if tree view contains any node |
boolean |
isEnabled(Object obj_p,
OwTreeView.OwTreeViewNode node_p)
check if node is enabled, i.e. |
boolean |
isFocused(OwTreeView.OwTreeViewNode node_p)
check if given node is focused |
boolean |
isSelected(OwTreeView.OwTreeViewNode node_p)
check if given node is selected |
void |
navigate(Object obj_p,
String strPath_p)
init the tree and set the root object |
void |
navigate(String strPath_p)
navigate to the specified path NOTE: the tree must have already been initialized with the two parameter form of navigate |
void |
navigateToChild(Object theObject_p)
Navigate to an object that is already in the tree view. |
void |
navigateToId(String nodeId_p)
Navigate to the specific node id |
void |
navigateUp()
navigate up to the parent |
void |
onClickLabel(javax.servlet.http.HttpServletRequest request_p)
handles the navigate event i.e. |
void |
onClickPlusMinus(javax.servlet.http.HttpServletRequest request_p)
handles the navigate event i.e. |
protected void |
onRender(Writer w_p)
called when the view should create its HTML content to be displayed |
void |
openNode(OwTreeView.OwTreeViewNode node_p)
open the node content |
void |
refreshCurrentNode()
refresh the current node, i.e. |
void |
refreshNodeForObject(Object param_p)
Tries to find the node for the given object and then refresh it. |
protected void |
renderFolderIconLink(StringWriter nodeBuffer_p,
OwTreeView.OwTreeViewNode node_p)
Writes the link and icon for a folder tree node to a StringWriter |
protected void |
renderMinusIconLink(StringWriter nodeBuffer_p,
OwTreeView.OwTreeViewNode node_p)
Writes the link and icon for collapsing a sub tree (a.k.a. |
void |
renderNode(Writer writer_p,
OwTreeView.OwTreeViewNode node_p,
int depth_p)
render a treenode as node |
protected void |
renderNodeLink(StringWriter nodeBuffer_p,
OwTreeView.OwTreeViewNode node_p)
Writes the link for a tree node to a StringWriter |
protected void |
renderPlusIconLink(StringWriter nodeBuffer_p,
OwTreeView.OwTreeViewNode node_p)
Writes the link and icon for expanding a sub tree (a.k.a. |
void |
renderRegister(Writer writer_p,
OwTreeView.OwTreeViewNode node_p,
int depth_p)
render a treenode as register |
void |
setChildrenSort(OwSort childrenSort_p)
Set the children sort criteria. |
void |
setDisplayMode(int iMode_p)
set the display mode of the view |
void |
setEventListner(OwTreeView.OwTreeViewEventListner listner_p)
set an eventlistener for the tree view |
protected boolean |
useFormEventUrls()
use form event url's instead of get method's used to submit a neighbor form |
protected void |
writeTooltip(StringWriter nodeBuffer_p,
String tooltip_p)
Utility method for writing tooltip. |
Methods inherited from class com.wewebu.ow.server.ui.OwEventTarget |
---|
attach, disableRequestListener, enableRequestListener, getAjaxEventURL, getContext, getEventURL, getFormEventFunction, getFormEventURL, getID, onExternalRequest, onFormEvent, onRequest, updateExternalFormTarget |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PATH_DELIMITER
protected OwTreeView.OwTreeViewEventListner m_eventlistner
protected String m_strDesignURL
protected OwTreeView.OwTreeViewNode m_root
protected OwTreeView.OwTreeViewNode m_selectedNode
protected OwTreeView.OwTreeViewNode m_focusNode
protected String m_strPath
protected OwSort childrenSort
protected static final String NODE_ID_KEY
public static final int DISPLAY_MODE_TREE_NODES
public static final int DISPLAY_MODE_REGISTER_NODES
protected Map m_nodeMap
Constructor Detail |
---|
public OwTreeView()
Method Detail |
---|
protected boolean useFormEventUrls()
public void refreshCurrentNode() throws Exception
Exception
public OwTreeView.OwTreeViewNode getCurrentNode()
OwTreeView.OwTreeViewNode
public void navigateUp() throws Exception
Exception
public void navigate(String strPath_p) throws Exception
strPath_p
- String representing a path
Exception
public void navigateToId(String nodeId_p) throws Exception
nodeId_p
- String representing id of the node
Exception
public boolean canNavigate()
public void navigate(Object obj_p, String strPath_p) throws Exception
obj_p
- Root Object to be managed by the treestrPath_p
- String representing path
Exception
public boolean isEmpty()
public void setEventListner(OwTreeView.OwTreeViewEventListner listner_p)
listner_p
- OwTreeView.OwTreeViewEventListnerprotected void onRender(Writer w_p) throws Exception
onRender
in class OwView
w_p
- Writer object to write HTML to
Exception
protected abstract List createChildObjects(Object obj_p) throws Exception
obj_p
- Object which is managed by the tree view
Exception
protected String getCloseIconURL(Object obj_p, OwTreeView.OwTreeViewNode node_p) throws Exception
obj_p
- Object which is managed by the tree viewnode_p
- OwTreeViewNode
Exception
protected String getOpenIconURL(Object obj_p, OwTreeView.OwTreeViewNode node_p) throws Exception
obj_p
- Object which is managed by the tree viewnode_p
- OwTreeViewNode
Exception
protected String getDisplayName(Object obj_p, OwTreeView.OwTreeViewNode node_p) throws Exception
obj_p
- Object which is managed by the tree viewnode_p
- the node to return the text for
Exception
protected String getDisplayHTML(Object obj_p, OwTreeView.OwTreeViewNode node_p) throws Exception
obj_p
- Object which is managed by the tree viewnode_p
- the node to return the text for
Exception
public boolean isEnabled(Object obj_p, OwTreeView.OwTreeViewNode node_p) throws Exception
obj_p
- Object which is managed by the tree view
Exception
protected abstract String getName(Object obj_p, OwTreeView.OwTreeViewNode node_p) throws Exception
obj_p
- Object which is managed by the tree view
Exception
protected boolean hasPlusMinusIcon(Object obj_p, OwTreeView.OwTreeViewNode node_p) throws Exception
obj_p
- Object which is managed by the tree view
Exception
protected OwTreeView.OwTreeViewNode createTreeViewNode(OwTreeView treeView_p, Object obj_p)
treeView_p
- OwTreeViewobj_p
- template Object which is managed by the tree nodeprotected void init() throws Exception
init
in class OwView
Exception
public void setDisplayMode(int iMode_p)
iMode_p
- int mode as defined in DISPLAY_MODE_...protected int getDisplayMode()
public void renderRegister(Writer writer_p, OwTreeView.OwTreeViewNode node_p, int depth_p) throws Exception
writer_p
- Writer Objectnode_p
- OwTreeNode Node to renderdepth_p
- iterator depth
Exception
protected String getSelectedTreeItemStyle()
protected String getTreeItemStyle()
protected String getSelectedRegisterItemStyle()
protected String getRegisterItemStyle()
public boolean isSelected(OwTreeView.OwTreeViewNode node_p)
node_p
- OwTreeViewNode
public boolean isFocused(OwTreeView.OwTreeViewNode node_p)
node_p
- OwTreeViewNode to check
public void renderNode(Writer writer_p, OwTreeView.OwTreeViewNode node_p, int depth_p) throws Exception
writer_p
- Writer Objectnode_p
- OwTreeNode Node to renderdepth_p
- int iterator depth
Exception
protected void renderMinusIconLink(StringWriter nodeBuffer_p, OwTreeView.OwTreeViewNode node_p) throws Exception
nodeBuffer_p
- StringWriter to write the link and icon tonode_p
- OwTreeViewNode to write the collapse link for
Exception
protected void writeTooltip(StringWriter nodeBuffer_p, String tooltip_p)
nodeBuffer_p
- StringWriter
objecttooltip_p
- String text to use as the tooltipprotected void renderPlusIconLink(StringWriter nodeBuffer_p, OwTreeView.OwTreeViewNode node_p) throws Exception
nodeBuffer_p
- StringWriter to write the link and icon tonode_p
- OwTreeViewNode to write the expand link for
Exception
protected void renderFolderIconLink(StringWriter nodeBuffer_p, OwTreeView.OwTreeViewNode node_p) throws Exception
nodeBuffer_p
- StringWriter to write the link and icon tonode_p
- OwTreeViewNode to write the link for
Exception
protected void renderNodeLink(StringWriter nodeBuffer_p, OwTreeView.OwTreeViewNode node_p) throws Exception
nodeBuffer_p
- the StringWriter to write the link and icon tonode_p
- the the OwTreeViewNode to write the link for
Exception
protected OwTreeView.OwTreeViewNode getNodeFromID(String strID_p)
strID_p
- String node ID from OwTreeViewNode.getID()
public void addNode(OwTreeView.OwTreeViewNode node_p)
node_p
- OwTreeViewNode to addpublic void onClickPlusMinus(javax.servlet.http.HttpServletRequest request_p) throws Exception
request_p
-
Exception
public void onClickLabel(javax.servlet.http.HttpServletRequest request_p) throws Exception
request_p
-
Exception
public void openNode(OwTreeView.OwTreeViewNode node_p) throws Exception
node_p
- OwTreeViewNode whose content is to be shown
Exception
public String getClientSideId()
public void navigateToChild(Object theObject_p) throws Exception
theObject_p
-
Exception
protected abstract void expandParents(Object theObject_p) throws Exception
theObject_p
-
Exception
protected OwTreeView.OwTreeViewNode getNodeForObject(Object theObject_p)
public void clearSelection()
public void setChildrenSort(OwSort childrenSort_p)
childrenSort_p
- - the OwSort
criteria.public OwSort getChildrenSort()
OwSort
children criteria.public void refreshNodeForObject(Object param_p) throws Exception
param_p
-
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |