Source Code Cross Referenced for HtmlTreeRenderer.java in  » Content-Management-System » openedit » com » openedit » webui » tree » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Content Management System » openedit » com.openedit.webui.tree 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:        Copyright (c) 2003 eInnovation Inc. All rights reserved
003:
004:        This library is free software; you can redistribute it and/or modify it under the terms
005:        of the GNU Lesser General Public License as published by the Free Software Foundation;
006:        either version 2.1 of the License, or (at your option) any later version.
007:
008:        This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
009:        without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
010:        See the GNU Lesser General Public License for more details.
011:         */
012:
013:        /*
014:         * Created on May 29, 2003
015:         */
016:        package com.openedit.webui.tree;
017:
018:        /**
019:         * This is a placeholder for a future version
020:         *
021:         */
022:        public abstract class HtmlTreeRenderer extends BaseTreeRenderer {
023:            protected boolean expandingAll = false;
024:
025:            public HtmlTreeRenderer(WebTree inWebTree) {
026:                fieldWebTree = inWebTree;
027:            }
028:
029:            public HtmlTreeRenderer() {
030:
031:            }
032:
033:            public String renderAsString() {
034:                StringBuffer js = new StringBuffer();
035:
036:                // Ensure the root node is always expanded.
037:                Object obj = getWebTree().getModel().getRoot();
038:                expandNode(obj);
039:
040:                js.append("<div class=\"dtree\" id='" + getWebTree().getName()
041:                        + "'>");
042:                js.append(renderFolder(getWebTree().getModel().getRoot(), 0,
043:                        true)); //line levels and blank levels
044:                js.append("</div>");
045:                return js.toString();
046:            }
047:
048:            public String renderAsString(String inNodeId) {
049:                StringBuffer js = new StringBuffer();
050:                WebTreeModel model = getWebTree().getModel();
051:                int levels = 0;
052:                Object child = model.getChildById(inNodeId);
053:                if (child != null) {
054:                    Object parent = model.getParent(child);
055:                    while (parent != null) {
056:                        levels++;
057:                        parent = model.getParent(parent);
058:                    }
059:                    js.append(renderFolder(child, levels, false)); //line levels and blank levels
060:                }
061:                return js.toString();
062:            }
063:
064:            protected String renderFolder(Object inNode, int level,
065:                    boolean entire) {
066:                //	Use null for our folder icon, and the JavaScript tree will substitute either folder.gif or
067:                //	folderopen.gif, depending on whether the node is open or closed.
068:                StringBuffer js = new StringBuffer();
069:                String id = getWebTree().getModel().getId(inNode);
070:                String name = toName(inNode);
071:                String path = toUrl(inNode);
072:                //		String post = "";
073:                //		if( isLast)
074:                //		{
075:                //			post = "bottom";
076:                //		}
077:                String selected = "node";
078:                String treeRow = "";
079:                if (getSelectedNode() == inNode) {
080:                    selected = "nodeSel";
081:                    treeRow = "class='dTreeNodeSel' ";
082:                }
083:
084:                String icon = customIconSet(inNode);
085:                if (icon == null) {
086:                    icon = "";
087:                }
088:
089:                boolean folder = !getWebTree().getModel().isLeaf(inNode);
090:                if (folder) {
091:                    js.append("<div id='" + getWebTree().getName() + "treerow"
092:                            + id + "'>");
093:                    //			if (entire)
094:                    //			{
095:                    //				js.append("<div style='padding-left: " + (1)*18 + "px;margin-left: "+ (-1)*18 + "px;'>");
096:                    //			}
097:                    //			else
098:                    //			{
099:                    js.append("<div " + treeRow + "  id='"
100:                            + getWebTree().getName() + "treeitem" + id
101:                            + "' style='padding-left: " + (level) * 18
102:                            + "px;' >");
103:                    //			}
104:                    //indent(js,level);
105:                    boolean expanded = hasBeenExpanded(inNode);
106:                    boolean shouldexpand = false;
107:                    js.append("<a class='node' href='#" + path
108:                            + "' onclick=\"return " + getWebTree().getName()
109:                            + ".toggleNode('" + path + "','");
110:                    js.append(getWebTree().getId());
111:                    js.append("','" + id + "');\" >");
112:
113:                    if (expanded) {
114:                        //if( level > 0)
115:                        if (inNode != getWebTree().getModel().getRoot()) {
116:                            js
117:                                    .append("<img alt='' src='"
118:                                            + getHome()
119:                                            + "/openedit/images/tree/down.gif' id='jpageTree"
120:                                            + id + "' />");
121:                        }
122:                        js
123:                                .append("<img alt='' src='" + getHome()
124:                                        + "/openedit/images/tree/" + icon
125:                                        + "folderopen.gif' id='ipageTree" + id
126:                                        + "' />");
127:                    } else //if ( hasChildren )
128:                    {
129:                        shouldexpand = true;
130:                        if (inNode != getWebTree().getModel().getRoot()) {
131:                            js
132:                                    .append("<img alt='' src='"
133:                                            + getHome()
134:                                            + "/openedit/images/tree/right.gif' id='jpageTree"
135:                                            + id + "' /><img alt='' src='"
136:                                            + getHome()
137:                                            + "/openedit/images/tree/" + icon
138:                                            + "folder.gif' id='ipageTree" + id
139:                                            + "' />");
140:
141:                        }
142:                    }
143:                    js.append("</a><a title='" + path + "' href='#" + path
144:                            + "' onclick=\"");
145:                    if (shouldexpand) {
146:                        js.append("return " + getWebTree().getName()
147:                                + ".jumpAndOpenNode('" + path + "','");
148:                        js.append(getWebTree().getId());
149:                        js.append("','" + id + "');\"");
150:                    } else {
151:                        js.append("	return " + getWebTree().getName()
152:                                + ".jumpToNode('" + path + "','" + id
153:                                + "');\" ");
154:                        //js.append("	return jumpAndOpenNode('" + path + "','" + id + "');\" ");
155:                    }
156:                    js.append(" id='" + getWebTree().getName() + "spageTree"
157:                            + id + "'>" + name + "</a>");
158:                    js.append("</div>\n");
159:                    if (expanded) {
160:                        int c = getWebTree().getModel().getChildCount(inNode);
161:                        for (int i = 0; i < c; i++) {
162:                            Object childNode = getWebTree().getModel()
163:                                    .getChild(inNode, i);
164:                            js
165:                                    .append(renderFolder(childNode, level + 1,
166:                                            entire));
167:                        }
168:                    }
169:                    js.append("</div>\n");
170:                    //js.append("\n	</div>\n");
171:                } else {
172:                    //			if (entire)
173:                    //			{
174:                    //				js.append("\n<div " + treeRow +  "style='padding-left: " + (2)*18 + "px;' id='treerow" + id + "'>");
175:                    //			} 
176:                    //			else {
177:                    js.append("\n<div " + treeRow + "style='padding-left: "
178:                            + (level + 1) * 18 + "px;' id='"
179:                            + getWebTree().getName() + "treeitem" + id + "'>");
180:                    //			}
181:                    //indent(js,level+2);
182:                    js.append("<a title='" + path + "' href='#" + path
183:                            + "' onclick=\"return " + getWebTree().getName()
184:                            + ".jumpToNode('" + path + "','" + id + "');\"  >");
185:                    js.append("<img src='" + getHome()
186:                            + "/openedit/images/tree/" + icon
187:                            + "page.gif' id='" + getWebTree().getName()
188:                            + "ipageTree" + id + "' alt=''  />" + name
189:                            + "</a></div>");
190:                }
191:                return js.toString();
192:            }
193:
194:            public void indent(StringBuffer str, int level) {
195:                str.append("<img src=\"" + getHome()
196:                        + "/openedit/images/tree/empty.gif\" width='" + (level)
197:                        * 11 + "' height='1' alt=\"\" />");
198:            }
199:
200:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.