?? treeicons.jsp
字號:
<%@ page import="com.jenkov.prizetags.tree.impl.TreeNode,
com.jenkov.prizetags.tree.impl.Tree,
com.jenkov.prizetags.tree.itf.*"%>
<%@ taglib uri="/WEB-INF/treetag.tld" prefix="tree" %>
<%@ taglib uri="/WEB-INF/requesttags.tld" prefix="request" %>
<%
if(session.getAttribute("example") == null){
ITree tree = new Tree();
tree.addExpandListener(new IExpandListener(){
public void nodeExpanded(ITreeNode node, ITree tree){
System.out.println("node " + node.getName() + " was expanded");
}
});
tree.addCollapseListener(new ICollapseListener(){
public void nodeCollapsed(ITreeNode node, ITree tree){
System.out.println("node " + node.getName() + " was collapsed");
}
});
tree.addSelectListener(new ISelectListener(){
public void nodeSelected(ITreeNode node, ITree tree){
System.out.println("node " + node.getName() + " was active");
}
});
tree.addUnSelectListener(new IUnSelectListener(){
public void nodeUnselected(ITreeNode node, ITree tree){
System.out.println("node " + node.getName() + " was unselected");
}
});
ITreeNode movies = new TreeNode("moviesId" , "Movies" , "movies");
ITreeNode thrillers = new TreeNode("thrillersId" , "Thrillers" , "thrillers");
ITreeNode thrillersNew = new TreeNode("newThrillId" , "New Thrillers", "newThrill");
ITreeNode thrillersOld = new TreeNode("oldThrillId" , "Old Thrillers", "oldThrill");
ITreeNode fantasy = new TreeNode("fantasyId" , "Fantasy" , "fantasy");
ITreeNode comedy = new TreeNode("comedyId" , "Comedies" , "comedies");
ITreeNode cartoons = new TreeNode("cartoonsId" , "Cartoons" , "cartoons");
ITreeNode comedySub = new TreeNode("comedySub" , "Comedy Sub" , "comedies");
ITreeNode comedySubSub = new TreeNode("comedySubSub" , "Comedy Sub Sub","comedies");
ITreeNode basicInstinct = new TreeNode("basicInstinctId" , "Basic Instinct" , "thriller");
ITreeNode theFirm = new TreeNode("theFirmId" , "The Firm" , "thriller");
ITreeNode lordOfTheRings= new TreeNode("lordOfTheRingsId" , "Lord of The Rings", "fantasy");
ITreeNode dumbNDumber = new TreeNode("dumbNDumberId" , "Dumb'n Dumber" , "comedy");
ITreeNode lionKing = new TreeNode("lionKingId" , "Lion King" , "cartoon");
ITreeNode snowWhite = new TreeNode("snowWhiteId" , "Snow White" , "cartoon");
movies.addChild(thrillers);
movies.addChild(fantasy);
movies.addChild(comedy);
movies.addChild(cartoons);
thrillers.addChild(basicInstinct);
thrillers.addChild(thrillersNew);
thrillers.addChild(thrillersOld);
thrillersNew.addChild(theFirm);
thrillersOld.addChild(basicInstinct);
fantasy .addChild(lordOfTheRings);
cartoons .addChild(lionKing);
cartoons .addChild(snowWhite);
//comedy .addChild(dumbNDumber);
comedy .addChild(comedySub);
comedySub.addChild(comedySubSub);
tree.setRoot(movies);
tree.expand(movies.getId());
tree.expand(cartoons.getId());
tree.select(fantasy.getId());
session.setAttribute("example", tree);
}
%>
<html>
<body>
This is the JSP page that displays an html tree
<br/>
<br/>
<br/>
<table cellspacing="0" cellpadding="0" border="0">
<tree:tree tree="example" node="example.node" >
<tr><td
><table cellspacing="0" cellpadding="0" border="0">
<tr><td
><tree:nodeIndent node="example.node" indentationType="type"
><tree:nodeIndentVerticalLine indentationType="type" ><img src="images/Ikoner/emptywhite.gif"></tree:nodeIndentVerticalLine
><tree:nodeIndentBlankSpace indentationType="type" ><img src="images/Ikoner/emptywhite.gif"></tree:nodeIndentBlankSpace
></tree:nodeIndent
></td>
<tree:nodeMatch node="example.node"
expanded="false"
hasChildren="true"
isLastChild="false"
><td><a href="<request:requestUri/>?expand=<tree:nodeId node="example.node"/>"
><img src="images/Ikoner/grey/greyClosed.gif" border="0"></a
><img src="images/Ikoner/grey/greyFolder.gif"></td>
</tree:nodeMatch
><tree:nodeMatch node="example.node"
expanded="true"
hasChildren="true"
isLastChild="false"
><td><a href="<request:requestUri/>?collapse=<tree:nodeId node="example.node"/>"
><img src="images/Ikoner/grey/greyOpen.gif" border="0"></a
><img src="images/Ikoner/grey/greyFolder.gif"></td>
</tree:nodeMatch
><tree:nodeMatch node="example.node"
expanded="false"
hasChildren="true"
isLastChild="true"
><td><a href="<request:requestUri/>?expand=<tree:nodeId node="example.node"/>"
><img src="images/Ikoner/grey/greyClosed.gif" border="0"></a
><img src="images/Ikoner/grey/greyFolder.gif"></td>
</tree:nodeMatch
><tree:nodeMatch node="example.node"
expanded="true"
hasChildren="true"
isLastChild="true"
><td><a href="<request:requestUri/>?collapse=<tree:nodeId node="example.node"/>"
><img src="images/Ikoner/grey/greyClosed.gif" border="0"></a
><img src="images/Ikoner/grey/greyFolder.gif"></td>
</tree:nodeMatch
><tree:nodeMatch node="example.node"
expanded="false"
hasChildren="false"
isLastChild="false"
><td><img src="images/Ikoner/emptywhite.gif"
><img src="images/Ikoner/grey/greyText.gif"></td>
</tree:nodeMatch
><tree:nodeMatch node="example.node"
expanded="false"
hasChildren="false"
isLastChild="true"
><td><img src="images/Ikoner/emptywhite.gif"
><img src="images/Ikoner/grey/greyText.gif"></td>
</tree:nodeMatch
><td valign="top">
<tree:nodeMatch node="example.node" selected="true">
<a href="<request:requestUri/>?selected=<tree:nodeId node="example.node"/>">
<span style="Font-Size: 12px;"><b><tree:nodeName node="example.node"/></b></span></a>
</tree:nodeMatch>
<tree:nodeMatch node="example.node" selected="false">
<a href="<request:requestUri/>?selected=<tree:nodeId node="example.node"/>">
<span style="Font-Size: 12px;"><tree:nodeName node="example.node"/></span></a>
</tree:nodeMatch>
<!--
<tree:nodeMatch node="example.node" type="comedy"> (Comedy)</tree:nodeMatch>
<tree:nodeMatch node="example.node" type="thriller"> (Thriller)</tree:nodeMatch>
<tree:nodeMatch node="example.node" type="fantasy"> (Fantasy)</tree:nodeMatch>
<tree:nodeMatch node="example.node" type="cartoon">
<tree:nodeType node="example.node"/>
</tree:nodeMatch>
<tree:nodeMatch node="example.node" hasChildren="true">hasChildren works</tree:nodeMatch>
<tree:nodeMatch node="example.node" type="com*">wildcard works</tree:nodeMatch>
<tree:nodeMatch node="example.node" isFirstChild="true" isLastChild="true"> (First + Last) </tree:nodeMatch>
<tree:nodeMatch node="example.node" isFirstChild="false" isLastChild="false"> (Middle) </tree:nodeMatch>
-->
</td>
</tr>
</table></td></tr>
</tree:tree>
</table>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -