Source Code Cross Referenced for DefaultGraphCell.java in  » Graphic-Library » jgraph » org » jgraph » graph » 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 » Graphic Library » jgraph » org.jgraph.graph 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)AbstractGraphCell.java	1.0 03-JUL-04
003:         * 
004:         * Copyright (c) 2001-2006 Gaudenz Alder
005:         *  
006:         */
007:        package org.jgraph.graph;
008:
009:        import java.awt.geom.Point2D;
010:        import java.util.Collections;
011:        import java.util.List;
012:        import java.util.Map;
013:
014:        import javax.swing.tree.DefaultMutableTreeNode;
015:        import javax.swing.tree.MutableTreeNode;
016:
017:        /**
018:         * The default implementation for the GraphCell interface.
019:         *
020:         * @version 1.0 1/1/02
021:         * @author Gaudenz Alder
022:         */
023:
024:        public class DefaultGraphCell extends DefaultMutableTreeNode implements 
025:                GraphCell, Cloneable {
026:
027:            /** Hashtable for properties. Initially empty */
028:            protected AttributeMap attributes = null;
029:
030:            /**
031:             * Creates an empty cell.
032:             */
033:            public DefaultGraphCell() {
034:                this (null);
035:            }
036:
037:            /**
038:             * Creates a graph cell and initializes it with the specified user object.
039:             *
040:             * @param userObject an Object provided by the user that constitutes
041:             *                   the cell's data
042:             */
043:            public DefaultGraphCell(Object userObject) {
044:                this (userObject, null);
045:            }
046:
047:            /**
048:             * Constructs a cell that holds a reference to the specified user object
049:             * and contains the specified array of children and sets default values
050:             * for the bounds attribute.
051:             *
052:             * @param userObject reference to the user object
053:             * @param storageMap the storage attribute map for this cell
054:             */
055:            public DefaultGraphCell(Object userObject, AttributeMap storageMap) {
056:                this (userObject, storageMap, null);
057:
058:            }
059:
060:            /**
061:             * Creates a graph cell and initializes it with the specified user object.
062:             * The GraphCell allows children only if specified.
063:             *
064:             * @param userObject an Object provided by the user that constitutes
065:             *                   the cell's data
066:             * @param storageMap the storage attribute map for this cell
067:             * @param children array of children
068:             */
069:            public DefaultGraphCell(Object userObject, AttributeMap storageMap,
070:                    MutableTreeNode[] children) {
071:                super (userObject, true);
072:                setAttributes(storageMap);
073:                if (children != null)
074:                    for (int i = 0; i < children.length; i++)
075:                        add(children[i]);
076:            }
077:
078:            /**
079:             * Provides access to the children list to change ordering.
080:             * This method returns a <code>Collections.EMPTY_LIST</code>
081:             * if the list of childrenpoints to <code>null</code>.
082:             */
083:            public List getChildren() {
084:                if (children == null)
085:                    return Collections.EMPTY_LIST;
086:                return children;
087:            }
088:
089:            /**
090:             * Returns the properies of the cell.
091:             */
092:            public AttributeMap getAttributes() {
093:                return attributes;
094:            }
095:
096:            /**
097:             * Changes the <code>attributes</code> of the cell.
098:             * 
099:             * @deprecated Use getAttributes().applyMap
100:             */
101:            public Map changeAttributes(Map change) {
102:                return getAttributes().applyMap(change);
103:            }
104:
105:            /**
106:             * Sets the attributes.
107:             * @param attributes The attributes to set
108:             */
109:            public void setAttributes(AttributeMap attributes) {
110:                if (attributes == null)
111:                    attributes = new AttributeMap();
112:                this .attributes = attributes;
113:            }
114:
115:            /**
116:             * Utility method to create a port for this cell. This method adds
117:             * a floating port.
118:             * @return the port created
119:             */
120:            public Object addPort() {
121:                return addPort(null);
122:            }
123:
124:            /**
125:             * Utility method to create a port for this cell. The method adds a port
126:             * at a fixed relative offset within the cell. If the offset is null
127:             * then a floating port is added.
128:             * @param offset the offset of the port within the cell
129:             * @return the port created
130:             */
131:            public Object addPort(Point2D offset) {
132:                return addPort(offset, null);
133:            }
134:
135:            /**
136:             * Utility method to create a port for this cell. The method adds a port
137:             * at a fixed relative offset within the cell. If the offset is null
138:             * then a floating port is added.
139:             * @param offset the offset of the port within the cell
140:             * @param userObject the user object of the port cell
141:             * @return the port created
142:             */
143:            public Object addPort(Point2D offset, Object userObject) {
144:                DefaultPort port = new DefaultPort(userObject);
145:                if (offset == null) {
146:                    add(port);
147:                } else {
148:                    GraphConstants.setOffset(port.getAttributes(), offset);
149:                    add(port);
150:                }
151:                return port;
152:            }
153:
154:            /**
155:             * Create a clone of the cell. This method uses the superclass
156:             * implementation (which does not clone the children), then
157:             * uses clone on the attribute map. This method does not
158:             * clone the user object. You should override the 
159:             * cloneUserObject in the graph model to implement cloning
160:             * of custom user objects.
161:             *
162:             * @return Object  a clone of this object.
163:             */
164:            public Object clone() {
165:                DefaultGraphCell c = (DefaultGraphCell) super .clone();
166:                c.attributes = (AttributeMap) attributes.clone();
167:                return c;
168:            }
169:
170:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.