<%@ page import="com.jenkov.prizetags.tree.itf.ITree,
                 com.jenkov.prizetags.tree.itf.ITreeNode"%><html>

<head>
   <link rel="stylesheet" href="/prizetagsdemo/stylesheet.css" type="text/css">
</head>

<body>

Node Details:

<br/><br/><br/>


<table>

<tr><td>Expanded   nodeId </td><td>&nbsp;&nbsp;&nbsp;</td><td><%=request.getParameter("expand")%></td></tr>
<tr><td>Collapsed  nodeId</td><td>&nbsp;&nbsp;&nbsp;</td><td><%=request.getParameter("collapse")%></td></tr>
<tr><td>Selected   nodeId </td><td>&nbsp;&nbsp;&nbsp;</td><td><%=request.getParameter("select")%></td></tr>
<tr><td>Unselected nodeId</td><td>&nbsp;&nbsp;&nbsp;</td><td><%=request.getParameter("unSelect")%></td></tr>

<%
    String param = "expand";
    if(request.getParameter(param) == null) { param = "collapse"; }
    if(request.getParameter(param) == null) { param = "select";   }
    if(request.getParameter(param) == null) { param = "unSelect"; }

    String nodeId = request.getParameter(param);
    ITree tree = (ITree) session.getAttribute("tree.model");

    ITreeNode node   = null;
    if(tree != null) node = tree.findNode(nodeId);

    ITreeNode parent = null;
    if(node != null) parent = node.getParent();
%>
<tr><td>Parent nodeId</td><td>&nbsp;&nbsp;&nbsp;</td><td><%=parent%></td></tr>



</table>


<br/><br/>
<% if(request.getParameter("select") != null){ %>
<a target="left" href="tree.jsp?unselect=<%=request.getParameter("select")%>"
  >Unselect node: <%=request.getParameter("select")%></a>

<% } %>

</body>