Source Code Cross Referenced for PortLabelCell.java in  » Graphic-Library » jgraph » com » jgraph » example » portlabels » 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 » com.jgraph.example.portlabels 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2005-2006, David Benson
003:         * 
004:         * See LICENSE file in distribution for licensing details of this source file
005:         */
006:        package com.jgraph.example.portlabels;
007:
008:        import java.util.Map;
009:
010:        import org.jgraph.graph.DefaultGraphCell;
011:        import org.jgraph.graph.DefaultPort;
012:        import org.jgraph.graph.ParentMap;
013:        import org.jgraph.graph.Port;
014:
015:        /**
016:         * Graph model cell that has a number of fixed offset ports on the left
017:         * and right hand sides. It provides a number of utility methods to add
018:         * and remove those ports.
019:         */
020:        public class PortLabelCell extends DefaultGraphCell {
021:
022:            /**
023:             * The number of ports on the left hand side of this cell
024:             */
025:            protected int numLeftPorts = 0;
026:
027:            /**
028:             * The number of ports on the right hand side of this cell
029:             */
030:            protected int numRightPorts = 0;
031:
032:            /**
033:             * Default constructor
034:             *
035:             */
036:            public PortLabelCell() {
037:                this (null);
038:            }
039:
040:            /**
041:             * Constructor with user object to set for cell. Whatever the user object
042:             * returns with toString will appear in the vertex label.
043:             * @param userObject the userObject to set
044:             */
045:            public PortLabelCell(Object userObject) {
046:                super (userObject);
047:            }
048:
049:            /**
050:             * Adds a port with the specified label to the left hand side of the vertex
051:             * at the specified position order
052:             * @param position this ports position in the order of port from top to bottom
053:             * @param portLabel the label to set for this port
054:             * @return the new Port created
055:             */
056:            public Port addLeftPort(int position, String portLabel,
057:                    Map nestedMap, ParentMap parentMap) {
058:                return addLeftPort(position, new DefaultPort(portLabel),
059:                        nestedMap, parentMap);
060:            }
061:
062:            /**
063:             * Adds a port to the left hand side of the vertex at the specified
064:             * position order
065:             * @param position this ports position in the order of port from top to bottom
066:             * @param port the instance of the new port
067:             * @return the the port
068:             */
069:            public Port addLeftPort(int position, Port port, Map nestedMap,
070:                    ParentMap parentMap) {
071:                if (position > numLeftPorts) {
072:                    throw new RuntimeException(
073:                            "Incorrect port position of left-hand side of cell");
074:                }
075:                return null;
076:            }
077:
078:            /**
079:             * Adds a port with the specified label to the right hand side of the vertex
080:             * at the specified position order
081:             * @param position this ports position in the order of port from top to bottom
082:             * @param portLabel the label to set for this port
083:             * @return the new Port created
084:             */
085:            public Port addRightPort(int position, String portLabel,
086:                    Map nestedMap, ParentMap parentMap) {
087:                return addRightPort(position, new DefaultPort(portLabel),
088:                        nestedMap, parentMap);
089:            }
090:
091:            /**
092:             * Adds a port to the right hand side of the vertex at the specified
093:             * position order
094:             * @param position this ports position in the order of port from top to bottom
095:             * @param port the instance of the new port
096:             * @return the the port
097:             */
098:            public Port addRightPort(int position, Port port, Map nestedMap,
099:                    ParentMap parentMap) {
100:                if (position > numRightPorts) {
101:                    throw new RuntimeException(
102:                            "Incorrect port position of right-hand side of cell");
103:                }
104:                return null;
105:            }
106:
107:            /**
108:             * Removes the left-hand side port at the specified position order
109:             * @param position the position order of the port to be removed
110:             */
111:            public void removeLeftPort(int position, Map nestedMap,
112:                    ParentMap parentMap) {
113:
114:            }
115:
116:            /**
117:             * Removes the left-hand side port at the specified position order
118:             * @param position the position order of the port to be removed
119:             */
120:            public void removeRightPort(int position, Map nestedMap,
121:                    ParentMap parentMap) {
122:
123:            }
124:
125:            /**
126:             * @return Returns the numLeftPorts.
127:             */
128:            public int getNumLeftPorts() {
129:                return numLeftPorts;
130:            }
131:
132:            /**
133:             * @param numLeftPorts The numLeftPorts to set.
134:             */
135:            public void setNumLeftPorts(int numLeftPorts) {
136:                this .numLeftPorts = numLeftPorts;
137:            }
138:
139:            /**
140:             * @return Returns the numRightPorts.
141:             */
142:            public int getNumRightPorts() {
143:                return numRightPorts;
144:            }
145:
146:            /**
147:             * @param numRightPorts The numRightPorts to set.
148:             */
149:            public void setNumRightPorts(int numRightPorts) {
150:                this.numRightPorts = numRightPorts;
151:            }
152:
153:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.