Source Code Cross Referenced for WMLTreeUI.java in  » Swing-Library » Swinglets » com » javelin » swinglets » plaf » wml » 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 » Swing Library » Swinglets » com.javelin.swinglets.plaf.wml 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright Javelin Software, All rights reserved.
003:         */
004:
005:        package com.javelin.swinglets.plaf.wml;
006:
007:        import java.awt.*;
008:        import java.util.*;
009:        import java.io.*;
010:
011:        import javax.swing.tree.*;
012:
013:        import com.javelin.swinglets.*;
014:        import com.javelin.swinglets.tree.*;
015:        import com.javelin.swinglets.plaf.*;
016:
017:        /**
018:         * WMLTreeUI defines a look and feel for default WML. 
019:         * 
020:         * @author Robin Sharp
021:         */
022:
023:        public class WMLTreeUI extends WMLComponentUI {
024:            /**
025:             * Render the UI on the PrintWriter
026:             */
027:            public void update(PrintWriter out, SComponent c) {
028:                if (!c.isVisible())
029:                    return;
030:
031:                STree tree = (STree) c;
032:
033:                TreePath path = tree.getSelectedPath();
034:                if (path == null) {
035:                    path = new TreePath(tree.getModel().getRoot());
036:                }
037:
038:                TreeNode node = (TreeNode) path.getLastPathComponent();
039:
040:                //Wind back when the leaf is selected
041:                if (node.getChildCount() == 0) {
042:                    path = new TreePath(tree.getModel().getRoot());
043:                    node = (TreeNode) path.getLastPathComponent();
044:                }
045:
046:                int row = tree.getRowForPath(path);
047:
048:                //Display the root/parent node.
049:                if (path.getPathCount() > 0) //1
050:                {
051:                    writeTreeNode(out, tree, node, true, row);
052:                }
053:
054:                //Display the children
055:                for (int index = 0; index < node.getChildCount(); index++) {
056:                    writeTreeNode(out, tree, (TreeNode) node.getChildAt(index),
057:                            false, ++row);
058:                }
059:
060:            }
061:
062:            protected void writeTreeNode(PrintWriter out, STree tree,
063:                    TreeNode treeNode, boolean parent, int row) {
064:                out.print("<anchor>");
065:
066:                out.println("<br/>");
067:                //TEXT
068:                if (parent) {
069:                    out.print(".. ");
070:                } else if (treeNode.getChildCount() > 0) {
071:                    //folder
072:                    out.print("+ ");
073:                } else {
074:                    //leaf
075:                    out.print("- ");
076:                }
077:
078:                out.print(treeNode.toString());
079:
080:                out.print("<go method=\"post\"");
081:                out.print(" href=\"");
082:                out.print(tree.getSwingletManager().getUrl());
083:                out.println("\">");
084:
085:                out.print("<postfield name=\"");
086:                out.print(row);
087:                out.print("\" value=\"");
088:                if (treeNode.getChildCount() > 0) {
089:                    out.print(STree.NODE);
090:                } else {
091:                    out.print(STree.LABEL);
092:                }
093:                out.println("\"/>");
094:
095:                out.print("<postfield name=\"");
096:                out.print(STree.VIRTUAL_TREE);
097:                out.print("\" value=\"true\"/>");
098:
099:                out.print("<postfield name=\"");
100:                out.print(SConstants.SOURCE_CONTAINER);
101:                out.print("\" value=\"");
102:                SContainer container = tree.getTopLevelAncestor();
103:                if (container == null)
104:                    out.print(tree.getName());
105:                else
106:                    out.print(container.getName());
107:                out.print("\"/>");
108:
109:                out.print("<postfield name=\"");
110:                out.print(SConstants.SOURCE_COMPONENT);
111:                out.print("\" value=\"");
112:                out.print(tree.getName());
113:                out.println("\"/>");
114:
115:                out.print("</go>");
116:                out.println("</anchor>");
117:            }
118:
119:            // PRIVATE //////////////////////////////////////////////////////////////////////////
120:
121:            protected int row;
122:            protected int depth;
123:
124:            private STreeCellRenderer treeCellRenderer; //Not used at the moment
125:
126:        }
127:
128:        /* OLD STUFF FOR - use on SMenus
129:        {
130:            if( !c.isVisible() ) return;
131:            
132:            STree tree = (STree)c;
133:              
134:            TreePath path = new TreePath( tree.getModel().getRoot() );
135:            out.print( "<select name=\"" );
136:            out.print( tree.getName() );
137:            out.println( "\" >" );
138:            
139:            if( tree.getModel().getRoot() == path.getLastPathComponent() &&
140:                tree.isRootVisible() )
141:            {
142:        		out.print( "<optgroup title=\"" );
143:            	out.print( path.getLastPathComponent().toString() );
144:        	    out.println( "\">" );
145:            }
146:            
147:            update( out, tree, path );    
148:
149:            if( tree.getModel().getRoot() == path.getLastPathComponent() &&
150:                tree.isRootVisible() )
151:            {
152:           		out.println( "</optgroup>" );
153:            }
154:
155:            out.println( "</select>" );
156:
157:        }
158:         */
159:        /**
160:         * Depth first update of all nodes and their descendents.
161:         */
162:        /*
163:         public void update( PrintWriter out, STree tree, TreePath path )
164:         {
165:         TreeNode node = (TreeNode)path.getLastPathComponent();       
166:        
167:         if( node.isLeaf() )
168:         {
169:         out.print( "<option value=\"" );
170:         out.print( row );
171:         out.print( "\">" );
172:         out.print( node.toString() );
173:         out.println( "</option>" );
174:         }
175:         else
176:         {
177:         out.print( "<optgroup title=\"" );
178:         out.print( node.toString() );
179:         out.println( "\">" );
180:        
181:         depth++;
182:         for( int index = 0; index < node.getChildCount(); index++  )
183:         {
184:         update( out, tree, path.pathByAddingChild( node.getChildAt( index ) ) );
185:         }
186:         depth--;
187:        
188:         out.println( "</optgroup>" );
189:         }
190:        
191:         row++;
192:         }
193:
194:         */
195:
196:        /*
197:         <select name="country_name" tabindex="2">
198:
199:         <optgroup title="Scandanavia">
200:         <option value="Denmark">Denmark</option>
201:         <option value="Finland">Finland</option>
202:         <option value="Norway">Norway</option>
203:         <option value="Sweden">Sweden</option>
204:         </optgroup>
205:
206:         <optgroup title="Europe">
207:         <option value="France">France</option>
208:         <option value="Germany">Germany</option>
209:         <option value="Italy">Italy</option>
210:         <option value="Spain">Spain</option>
211:         </optgroup>
212:         <option value="England">England</option>
213:         </select>
214:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.