// in the node name, could remove this code if encode URL
// and later request.getParameter() could deal with = and &
// character in parameter values.
String encodedNodeName = URLEncoder.encode(node.getName());
PortletURL treeActionUrl = renderResponse.createActionURL();
treeActionUrl.setParameter("node", node.getName());
String treeAction = treeActionUrl.toString();
// String action = replace(getAction(), "${name}", encodedNodeName);
// String updateTreeAction =
// replace(getAction(), "tree=${name}", "select=" + encodedNodeName);
// updateTreeAction =
// ((HttpServletResponse) pageContext.getResponse()).
// encodeURL(updateTreeAction);
out.print(" <td>");
//add an anchor so that we can return to this node
out.print("<a name=\"");
out.print(node.getName());
out.print("\">");
if ((action != null) && !node.isLeaf()) {
out.print("<a href=\"");
out.print(response.encodeURL(treeAction));
out.print("\">");
}
out.print("<img src=\"");
out.print(images);
out.print("/");
if (node.isLeaf()) {
if (node.isLast())
out.print(IMAGE_LINE_LAST);
else
out.print(IMAGE_LINE_MIDDLE);
out.print("\" alt=\"");
} else if (node.isExpanded()) {
if (node.isLast())
out.print(IMAGE_HANDLE_DOWN_LAST);
else
out.print(IMAGE_HANDLE_DOWN_MIDDLE);
out.print("\" alt=\"close node");
} else {
if (node.isLast())
out.print(IMAGE_HANDLE_RIGHT_LAST);
else
out.print(IMAGE_HANDLE_RIGHT_MIDDLE);
out.print("\" alt=\"expand node");
}
out.print("\" border=\"0\">");
if ((action != null) && !node.isLeaf())
out.print("</a>");
out.println("</td>");
// Calculate the hyperlink for this node (if any)
String hyperlink = null;
String nodeAction = node.getAction();
if(nodeAction == null && node.isExpandWhenClicked())
{
hyperlink = treeAction;
}
if (nodeAction != null)
{
if(node.getAction().equals("portlet_url"))
{
PortletURL actionUrl = renderResponse.createActionURL();
actionUrl.setParameter("select_node", node.getName());
hyperlink = ((HttpServletResponse) pageContext.getResponse()).encodeURL(actionUrl.toString());
}
else
{
hyperlink = ((HttpServletResponse) pageContext.getResponse()).
encodeURL(node.getAction());