Source Code Cross Referenced for TreeNode.java in  » Development » jrc-editor » org » zaval » awt » peer » 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 » jrc editor » org.zaval.awt.peer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         *     Caption: Zaval Java Resource Editor
003:         *     $Revision: 0.37 $
004:         *     $Date: 2002/03/28 9:24:42 $
005:         *
006:         *     @author:     Victor Krapivin
007:         *     @version:    1.3
008:         *
009:         * Zaval JRC Editor is a visual editor which allows you to manipulate 
010:         * localization strings for all Java based software with appropriate 
011:         * support embedded.
012:         * 
013:         * For more info on this product read Zaval Java Resource Editor User's Guide
014:         * (It comes within this package).
015:         * The latest product version is always available from the product's homepage:
016:         * http://www.zaval.org/products/jrc-editor/
017:         * and from the SourceForge:
018:         * http://sourceforge.net/projects/zaval0002/
019:         *
020:         * Contacts:
021:         *   Support : support@zaval.org
022:         *   Change Requests : change-request@zaval.org
023:         *   Feedback : feedback@zaval.org
024:         *   Other : info@zaval.org
025:         * 
026:         * Copyright (C) 2001-2002  Zaval Creative Engineering Group (http://www.zaval.org)
027:         * 
028:         * This program is free software; you can redistribute it and/or
029:         * modify it under the terms of the GNU General Public License
030:         * (version 2) as published by the Free Software Foundation.
031:         * 
032:         * This program is distributed in the hope that it will be useful,
033:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
034:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
035:         * GNU General Public License for more details.
036:         * 
037:         * You should have received a copy of the GNU General Public License
038:         * along with this program; if not, write to the Free Software
039:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
040:         * 
041:         */package org.zaval.awt.peer;
042:
043:        import org.zaval.awt.*;
044:
045:        import java.awt.*;
046:        import java.util.*;
047:
048:        public class TreeNode {
049:            public ImageResolver imgres = null;
050:
051:            public TreeNode sibling;
052:            public TreeNode child;
053:            public TreeNode parent;
054:            public String text;
055:            public String nameCollImage = null;
056:            public String nameExpImage = null;
057:            public Image collapsedImage = null;
058:            public Image expandedImage = null;
059:            public int depth = -1;
060:            public boolean isExpanded = false;
061:            public int numberOfChildren;
062:            public int contextMenu = -1;
063:            public Hashtable property = null;
064:            public boolean hidden = false;
065:            public String caption;
066:            public Image indicator;
067:
068:            //constructors
069:
070:            public void setResolver(ImageResolver imgres) {
071:                this .imgres = imgres;
072:            }
073:
074:            public TreeNode(String text) {
075:                this (text, null, null);
076:            }
077:
078:            public TreeNode(String text, String nameCollImage,
079:                    String nameExpImage) {
080:                property = new Hashtable();
081:                this .text = text;
082:                this .sibling = null;
083:                this .child = null;
084:                this .nameCollImage = nameCollImage;
085:                this .nameExpImage = nameExpImage;
086:
087:                if (nameCollImage != null && imgres != null)
088:                    this .collapsedImage = imgres.getImage(nameCollImage);
089:
090:                if (nameExpImage != null && imgres != null)
091:                    this .expandedImage = imgres.getImage(nameCollImage);
092:
093:                numberOfChildren = 0;
094:                caption = null;
095:            }
096:
097:            public void setDepth(int depth) {
098:                this .depth = depth;
099:            }
100:
101:            public int getDepth() {
102:                return depth;
103:            }
104:
105:            public boolean isExpanded() {
106:                return !hidden && isExpanded;
107:            }
108:
109:            public boolean isExpandable() {
110:                return !hidden && (child != null);
111:            }
112:
113:            public void expand() {
114:                if (isExpandable())
115:                    isExpanded = true;
116:            }
117:
118:            public void collapse() {
119:                isExpanded = false;
120:            }
121:
122:            public void toggle() {
123:                if (isExpanded) {
124:                    collapse();
125:                } else if (isExpandable()) {
126:                    expand();
127:                }
128:            }
129:
130:            public Image getImage() {
131:                return ((isExpanded && (expandedImage != null)) ? expandedImage
132:                        : collapsedImage);
133:            }
134:
135:            public Image getExpandedImage() {
136:                loadImages();
137:                return (expandedImage != null) ? expandedImage : collapsedImage;
138:            }
139:
140:            public Image getCollapsedImage() {
141:                loadImages();
142:                return collapsedImage;
143:            }
144:
145:            public String getNameImage() {
146:                if (getImage() != null)
147:                    return ((isExpanded && (expandedImage != null)) ? nameExpImage
148:                            : nameCollImage);
149:                return null;
150:            }
151:
152:            private void loadImages() {
153:                if (imgres == null)
154:                    return;
155:                if (nameCollImage != null && collapsedImage == null)
156:                    collapsedImage = imgres.getImage(nameCollImage);
157:                if (nameExpImage != null && expandedImage == null)
158:                    expandedImage = imgres.getImage(nameExpImage);
159:            }
160:
161:            public void setExpandedImage(String image) {
162:                this .nameCollImage = image;
163:                if (image != null && imgres != null)
164:                    this .collapsedImage = imgres.getImage(nameCollImage);
165:            }
166:
167:            public void setCollapsedImage(String image) {
168:                this .nameExpImage = image;
169:                if (image != null && imgres != null)
170:                    this .expandedImage = imgres.getImage(nameExpImage);
171:            }
172:
173:            public String getText() {
174:                return text;
175:            }
176:
177:            public void setText(String s) {
178:                text = s;
179:            }
180:
181:            public void setContextMenu(int index) {
182:                contextMenu = index;
183:            }
184:
185:            public int getContextMenu() {
186:                return contextMenu;
187:            }
188:
189:            public Object getProperty(String name) {
190:                return property.get(name);
191:            }
192:
193:            public String getStringProperty(String name) {
194:                return (String) getProperty(name);
195:            }
196:
197:            public int getIntProperty(String name) {
198:                return Integer.parseInt((String) getProperty(name));
199:            }
200:
201:            public void setProperty(String name, Object value) {
202:                property.put(name, value);
203:            }
204:
205:            public void setStringProperty(String name, String value) {
206:                setProperty(name, value);
207:            }
208:
209:            public void setIntProperty(String name, int value) {
210:                setProperty(name, "" + value);
211:            }
212:
213:            public int getNumberOfChildren() {
214:                return numberOfChildren;
215:            }
216:
217:            public void setHide(boolean b) {
218:                hidden = b;
219:            }
220:
221:            public boolean getHide() {
222:                return hidden;
223:            }
224:
225:            public String getCaption() {
226:                return caption == null ? text : caption;
227:            }
228:
229:            public void setCaption(String c) {
230:                caption = c;
231:            }
232:
233:            public void setCollapsedImage(Image image) {
234:                this .collapsedImage = image;
235:            }
236:
237:            public void setExpandedImage(Image image) {
238:                this .expandedImage = image;
239:            }
240:
241:            public void setIndicator(String name) {
242:                if (name == null || imgres == null)
243:                    indicator = null;
244:                else
245:                    indicator = imgres.getImage(name);
246:            }
247:
248:            public Image getIndicator() {
249:                return indicator;
250:            }
251:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.