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


001:        /* 
002:         * $Id: JGraphEditor.java,v 1.1.1.1 2005/08/04 11:21:58 gaudenz Exp $
003:         * Copyright (c) 2001-2005, Gaudenz Alder
004:         * 
005:         * All rights reserved.
006:         * 
007:         * See LICENSE file for license details. If you are unable to locate
008:         * this file please contact info (at) jgraph (dot) com.
009:         */
010:        package com.jgraph;
011:
012:        import java.io.File;
013:        import java.net.MalformedURLException;
014:        import java.net.URL;
015:
016:        import com.jgraph.editor.JGraphEditorFactory;
017:        import com.jgraph.editor.JGraphEditorKit;
018:        import com.jgraph.editor.JGraphEditorModel;
019:        import com.jgraph.editor.JGraphEditorSettings;
020:
021:        /**
022:         * Defines the structure of an JGraph editor.
023:         */
024:        public class JGraphEditor {
025:
026:            /**
027:             * Global static product identifier.
028:             */
029:            public static final String VERSION = "JGraphEditor (v6.0.4.0)";
030:
031:            /**
032:             * Holds the settings.
033:             */
034:            protected JGraphEditorSettings settings;
035:
036:            /**
037:             * Holds the document model.
038:             */
039:            protected JGraphEditorModel model;
040:
041:            /**
042:             * Holds the editor kit.
043:             */
044:            protected JGraphEditorKit kit;
045:
046:            /**
047:             * Holds the UI factory.
048:             */
049:            protected JGraphEditorFactory factory;
050:
051:            /**
052:             * Constructs an empty editor.
053:             */
054:            public JGraphEditor() {
055:                this (null);
056:            }
057:
058:            /**
059:             * Constructs a new editor for the specified settings and model.
060:             * 
061:             * @param settings
062:             *            The settings to use for the editor.
063:             */
064:            public JGraphEditor(JGraphEditorSettings settings) {
065:                this (settings, null, null, null);
066:            }
067:
068:            /**
069:             * Constructs a new editor for the specified settings and model.
070:             * 
071:             * @param settings
072:             *            The settings to use for the editor.
073:             * @param model
074:             *            The model to use as the document model.
075:             * @param kit
076:             *            The kit to be used to store the actions and tools.
077:             * @param factory
078:             *            The factory to be used to creat the user interface.
079:             */
080:            public JGraphEditor(JGraphEditorSettings settings,
081:                    JGraphEditorModel model, JGraphEditorKit kit,
082:                    JGraphEditorFactory factory) {
083:                this .settings = settings;
084:                this .model = model;
085:                this .kit = kit;
086:                this .factory = factory;
087:            }
088:
089:            /**
090:             * Implements an application exit. This implementation invokes
091:             * {@link JGraphEditorSettings#shutdown()}. Subclassers should call the
092:             * superclass method as the first step. Note: This method is never called
093:             * from within the framework.
094:             */
095:            public void exit(int code) {
096:                getSettings().shutdown();
097:            }
098:
099:            /**
100:             * @return Returns the settings.
101:             */
102:            public JGraphEditorSettings getSettings() {
103:                return settings;
104:            }
105:
106:            /**
107:             * @param settings
108:             *            The settings to set.
109:             */
110:            public void setSettings(JGraphEditorSettings settings) {
111:                this .settings = settings;
112:            }
113:
114:            /**
115:             * @return Returns the factory.
116:             */
117:            public JGraphEditorFactory getFactory() {
118:                return factory;
119:            }
120:
121:            /**
122:             * @param factory
123:             *            The factory to set.
124:             */
125:            public void setFactory(JGraphEditorFactory factory) {
126:                this .factory = factory;
127:            }
128:
129:            /**
130:             * @return Returns the kit.
131:             */
132:            public JGraphEditorKit getKit() {
133:                return kit;
134:            }
135:
136:            /**
137:             * @param kit
138:             *            The kit to set.
139:             */
140:            public void setKit(JGraphEditorKit kit) {
141:                this .kit = kit;
142:            }
143:
144:            /**
145:             * @return Returns the model.
146:             */
147:            public JGraphEditorModel getModel() {
148:                return model;
149:            }
150:
151:            /**
152:             * @param model
153:             *            The model to set.
154:             */
155:            public void setModel(JGraphEditorModel model) {
156:                this .model = model;
157:            }
158:
159:            /**
160:             * Returns true if the specified value is a URL, that is, if it starts with
161:             * one of http://, mailto:, ftp://, file:, https://, webdav:// or
162:             * webdavs://.
163:             * 
164:             * @param value
165:             *            The value that represents a potential URL.
166:             * @return Returns true if <code>value</code> is a URL.
167:             */
168:            public static boolean isURL(Object value) {
169:                return (value != null && (value.toString()
170:                        .startsWith("http://")
171:                        || value.toString().startsWith("mailto:")
172:                        || value.toString().startsWith("ftp://")
173:                        || value.toString().startsWith("file:")
174:                        || value.toString().startsWith("https://")
175:                        || value.toString().startsWith("webdav://") || value
176:                        .toString().startsWith("webdavs://")));
177:            }
178:
179:            /**
180:             * Returns a URL representation for the specified file or an empty string if
181:             * there was an exception. This method silently ignores exceptions.
182:             * 
183:             * @param file
184:             *            The file to return the URL for.
185:             * @return Returns the URL representation of <code>file</code> or an empty
186:             *         string.
187:             */
188:            public static String toURL(File file) {
189:                String result = "";
190:                try {
191:                    result = file.toURL().toString();
192:                } catch (MalformedURLException e) {
193:                    // ignore
194:                }
195:                return result;
196:            }
197:
198:            /**
199:             * Returns a URL representation for the specified string or null if there
200:             * was an exception. This method silently ignores exceptions.
201:             * 
202:             * @param s
203:             *            The string to return the URL for.
204:             * @return Returns the URL representation of <code>string</code> or null.
205:             */
206:            public static URL toURL(String s) {
207:                try {
208:                    return new URL(String.valueOf(s));
209:                } catch (MalformedURLException e) {
210:                    // ignore
211:                }
212:                return null;
213:            }
214:
215:            public static void main(String[] args) {
216:                System.out.println(VERSION);
217:            }
218:
219:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.