Source Code Cross Referenced for DependTree.java in  » Development » jdepend-2.9 » jdepend » swingui » 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 » Development » jdepend 2.9 » jdepend.swingui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package jdepend.swingui;
002:
003:        import java.awt.*;
004:        import javax.swing.*;
005:        import javax.swing.tree.*;
006:        import javax.swing.event.*;
007:
008:        import jdepend.framework.JavaPackage;
009:
010:        /**
011:         * The <code>DependTree</code> class defines the graphical tree for displaying
012:         * the packages and their hierarchical dependencies.
013:         * 
014:         * @author <b>Mike Clark</b>
015:         * @author Clarkware Consulting, Inc.
016:         */
017:
018:        public class DependTree extends JPanel implements  TreeSelectionListener {
019:
020:            private JTree tree;
021:
022:            private DependTreeModel model;
023:
024:            /**
025:             * Constructs a <code>DependTree</code> with an empty tree model.
026:             */
027:            public DependTree() {
028:                this (new DependTreeModel(new AfferentNode(null,
029:                        new JavaPackage(""))));
030:            }
031:
032:            /**
033:             * Constructs a <code>DependTree</code> with the specified tree model.
034:             * 
035:             * @param model Depend tree model.
036:             */
037:            public DependTree(DependTreeModel model) {
038:
039:                setBorder(BorderFactory.createTitledBorder(model.getRoot()
040:                        .toString()));
041:
042:                setModel(model);
043:
044:                setLayout(new BorderLayout());
045:
046:                JScrollPane pane = createScrollPane();
047:
048:                add(pane, "Center");
049:            }
050:
051:            /**
052:             * Sets the tree model.
053:             * 
054:             * @param model Tree model.
055:             */
056:            public void setModel(DependTreeModel model) {
057:                this .model = model;
058:                setBorder(BorderFactory.createTitledBorder(model.getRoot()
059:                        .toString()));
060:                getTree().setModel(this .model);
061:
062:            }
063:
064:            /**
065:             * Returns the tree model.
066:             * 
067:             * @return Tree model.
068:             */
069:            public DependTreeModel getModel() {
070:                return (DependTreeModel) getTree().getModel();
071:            }
072:
073:            /**
074:             * Registers the specified listener with this tree.
075:             * 
076:             * @param l Tree selection listener.
077:             */
078:            public void addTreeSelectionListener(TreeSelectionListener l) {
079:                getTree().addTreeSelectionListener(l);
080:            }
081:
082:            /**
083:             * Callback method triggered whenever the value of the tree selection
084:             * changes.
085:             * 
086:             * @param te Event that characterizes the change.
087:             */
088:            public void valueChanged(TreeSelectionEvent te) {
089:
090:                TreePath path = te.getNewLeadSelectionPath();
091:
092:                if (path != null) {
093:                    Object o = path.getLastPathComponent();
094:                }
095:            }
096:
097:            /**
098:             * Creates and returns a scroll pane.
099:             * 
100:             * @return Scroll pane.
101:             */
102:            private JScrollPane createScrollPane() {
103:                JScrollPane pane = new JScrollPane(getTree());
104:                return pane;
105:            }
106:
107:            /**
108:             * Creates and returns a peered tree.
109:             * 
110:             * @return Tree.
111:             */
112:            private JTree createTree() {
113:
114:                JTree tree = new JTree();
115:                tree.setShowsRootHandles(false);
116:                tree.setFont(new Font("Dialog", Font.PLAIN, 12));
117:                tree.addTreeSelectionListener(this );
118:                tree.setRootVisible(false);
119:                tree.setLargeModel(true);
120:
121:                return tree;
122:            }
123:
124:            /*
125:             * Returns the peered tree. @return A non-null tree.
126:             */
127:            private JTree getTree() {
128:                if (tree == null) {
129:                    tree = createTree();
130:                }
131:
132:                return tree;
133:            }
134:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.