Source Code Cross Referenced for Node.java in  » Portal » Open-Portal » ob » 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 » Portal » Open Portal » ob.tree 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Stingray Software Objective Blend
003:         * Copyright (C) 1996 Stingray Software, Inc.
004:         * All Rights Reserved
005:         *
006:         * This source code is only intended as a supplement to
007:         * the Stingray Objective Blend product.  See the Objective
008:         * Blend html help documentation for detailed information regarding
009:         * using OB classes.
010:         *
011:         * Author : Kerry Smith
012:         * Description : Node.java - class used to manipulate an individual node in the tree
013:         *
014:         * CHANGELOG:
015:         * 7/09/96 	LFW	Created
016:         * 3/12/97  JDK1.1
017:         *
018:         */
019:
020:        package ob.tree;
021:
022:        import java.awt.*;
023:        import com.sun.portal.log.common.PortalLogger;
024:        import java.util.*;
025:        import ob.listbox.*;
026:
027:        /**
028:         * The Node class is used to describe various properties associated with an individual
029:         * level of the tree.  It inherits from TreeNodeX and TreeNode to provide much of the
030:         * sibling/parent node navigation.  The Node class itself is responsible for many of the
031:         * properties of the node itself
032:         * @see ob.tree.TreeNodeX
033:         * @see ob.tree.TreeNode
034:         * @see ob.tree.TreeBase
035:         */
036:
037:        public class Node extends TreeNodeX {
038:            //boolean m_bHangingIndent;
039:            //String m_strBeforeIndent;
040:            //String m_strAfterIndent;
041:            //int m_cxTextBeforeIndent;
042:            boolean m_bVisible = false;
043:            String m_pszText = null;
044:            int m_nImage = -1;
045:            int m_nExpandedImage = -1;
046:            int m_nChildren = 0;
047:            boolean m_bExpanded = false;
048:            Font m_fonFont = null;
049:            Vector m_arrTreeSubItems = new Vector();
050:
051:            /**
052:             * constructor
053:             * @param label the label for the tree node
054:             * @param image reference to the image displayed when the node is not expanded
055:             * @param expImg reference to the image displayed when the node is expanded
056:             */
057:            public Node(String label, int image, int expImg) {
058:                m_pszText = label;
059:                m_nImage = image;
060:                m_nExpandedImage = expImg;
061:            }
062:
063:            /**
064:             * appends a sub item to the node.  In a multiple column tree control,
065:             * the leftmost column is the "main" item, while individual items can be
066:             * stored in the columns to the right as subitems.
067:             * @param s the String to create the subitem with
068:             */
069:            public void addSubItem(String s) {
070:                m_arrTreeSubItems.addElement(new ListSubItem(s));
071:            }
072:
073:            /**
074:             * retrieves all the subitems of the Node in a Vector list
075:             * @return subitems as type Vector
076:             */
077:            public Vector getSubItems() {
078:                return m_arrTreeSubItems;
079:            }
080:
081:            /**
082:             * adds a new sub item to the node
083:             * @param s subitem to add
084:             * @see ob.listbox.ListSubItem
085:             */
086:            public void addSubItem(ListSubItem s) {
087:                m_arrTreeSubItems.addElement(s);
088:            }
089:
090:            ///BINA
091:            /// These methods were added to add subitems of machine to the 
092:            /// array and removing those by the parent treeitem
093:            public void addSubItem(Node item) {
094:                m_arrTreeSubItems.addElement(item);
095:            }
096:
097:            public void removeSubItem(int nIndex) {
098:                m_arrTreeSubItems.removeElementAt(nIndex);
099:            }
100:
101:            public void removeSubItem(Node item) {
102:                m_arrTreeSubItems.removeElement(item);
103:            }
104:
105:            public void removeAllSubItems() {
106:                m_arrTreeSubItems.removeAllElements();
107:            }
108:
109:            ///BINA
110:
111:            /**
112:             *  constructor
113:             */
114:            public Node() {
115:                this ("", -1, -1);
116:            }
117:
118:            /**
119:             * retrieves the font associated with the node
120:             * @return node font as type Font
121:             */
122:            public Font getFont() {
123:                return m_fonFont;
124:            }
125:
126:            /**
127:             * sets the font associated with the node
128:             * @param f font to set for the node
129:             */
130:            public void setFont(Font f) {
131:                m_fonFont = f;
132:            }
133:
134:            /**
135:             * sets the text for the node
136:             * @param s text as type String
137:             */
138:            public void setText(String s) {
139:                m_pszText = s;
140:
141:            }
142:
143:            /**
144:             * sets the visible state of the node
145:             * @param bVisible true if item should be visible, otherwise false
146:             */
147:            public void setVisible(boolean bVisible) {
148:                m_bVisible = bVisible;
149:            }
150:
151:            /**
152:             * retrieves the text of the node
153:             * @return text as type String
154:             */
155:            public String getText() {
156:
157:                return m_pszText;
158:            }
159:
160:            /**
161:             * sets the unexpanded image
162:             * @param i reference to the unexpanded image
163:             */
164:            public void setImage(int i) {
165:                m_nImage = i;
166:            }
167:
168:            /**
169:             * retrieves the current image displayed
170:             * @return reference to the currently displayed image as type int
171:             */
172:            public int getImage() {
173:                if (isExpanded())
174:                    return m_nExpandedImage;
175:                return m_nImage;
176:            }
177:
178:            /**
179:             * sets the reference to the expanded image
180:             * @param i reference to the expanded image
181:             */
182:            public void setExpandedImage(int i) {
183:                m_nExpandedImage = i;
184:            }
185:
186:            /**
187:             * retrieves the expanded image reference
188:             * @return expanded image reference as type int
189:             */
190:            public int getExpandedImage() {
191:                return m_nExpandedImage;
192:            }
193:
194:            /**
195:             * determines whether the node is currently expanded or not
196:             * @return true if expanded, otherwise false
197:             */
198:            public boolean isExpanded() {
199:                return m_bExpanded;
200:            }
201:
202:            /**
203:             * expands the node if currently closed, otherwise collapses
204:             * @param bExpand true if you wish to expand, otherwise collapse
205:             */
206:            public void expand(boolean bExpand) {
207:                if (bExpand)
208:                    m_bExpanded = true;
209:                else
210:                    m_bExpanded = false;
211:            }
212:
213:            /**
214:             * determines whether the node is currently visible
215:             * @return true if visible, otherwise false
216:             */
217:            boolean isVisible() {
218:                // assume visible until proved otherwise;
219:                Node pNode = this ;
220:                if (!m_bVisible)
221:                    return false;
222:                while (pNode.getParent() != null) {
223:                    pNode = (Node) pNode.getParent();
224:                    if (!pNode.isExpanded() || !pNode.m_bVisible)
225:                        return false;
226:                }
227:                return true;
228:            }
229:
230:            ///// added by BINA
231:            public Node getNodeChild(int index) {
232:                int nChild = m_arrTreeSubItems.size();
233:                if (index >= 0 && index < nChild) {
234:                    return (Node) m_arrTreeSubItems.elementAt(index);
235:                } else {
236:                    return null;
237:                }
238:            }
239:
240:            ///// added by BINA
241:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.