Source Code Cross Referenced for JGraphpadDemo.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: JGraphpadDemo.java,v 1.1 2006/01/31 15:33:25 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.awt.Window;
013:        import java.io.IOException;
014:        import java.net.MalformedURLException;
015:        import java.util.Hashtable;
016:        import java.util.List;
017:        import java.util.Map;
018:
019:        import javax.xml.parsers.ParserConfigurationException;
020:
021:        import org.xml.sax.SAXException;
022:
023:        import com.jgraph.editor.JGraphEditorFile;
024:        import com.jgraph.editor.JGraphEditorKit;
025:        import com.jgraph.editor.JGraphEditorModel;
026:        import com.jgraph.pad.action.JGraphpadFileAction;
027:
028:        /**
029:         * @author Administrator
030:         * 
031:         */
032:        public class JGraphpadDemo extends JGraphpad {
033:
034:            /**
035:             * 
036:             */
037:            private static final String MESSAGE = "This demo does not allow to open or save files.";
038:
039:            /**
040:             * Issues a warning message in the online demo.
041:             */
042:            public Window createApplication(List files, Map args)
043:                    throws ParserConfigurationException, SAXException,
044:                    IOException {
045:                args.put(ARG_JGOODIESLOOKANDFEEL, "");
046:                Window wnd = super .createApplication(null, args);
047:                System.err.println(MESSAGE);
048:                return wnd;
049:            }
050:
051:            /**
052:             * Creates a model that does not allow to add files.
053:             */
054:            protected JGraphEditorModel createModel() {
055:                JGraphEditorModel model = new JGraphEditorModel() {
056:                    public Object addFile(String uri) {
057:                        throw new RuntimeException(MESSAGE);
058:                    }
059:                };
060:                configureModel(model);
061:                return model;
062:            }
063:
064:            /**
065:             * Replaces some actions with empty implementations.
066:             */
067:            protected void addActions(JGraphEditor editor, JGraphEditorKit kit) {
068:                super .addActions(editor, kit);
069:                kit.addBundle(new AllActions(editor));
070:            }
071:
072:            /**
073:             * Replaces file open / save action with different actions.
074:             * 
075:             */
076:            public static class JGraphpadDemoFileAction extends
077:                    JGraphpadFileAction {
078:
079:                /**
080:                 * @param name
081:                 * @param editor
082:                 */
083:                public JGraphpadDemoFileAction(String name, JGraphEditor editor) {
084:                    super (name, editor);
085:                }
086:
087:                /**
088:                 * Replaces the saveFile action with an error message.
089:                 */
090:                protected void doSaveFile(JGraphEditorFile file,
091:                        boolean forceFilenameDialog, boolean urlDialog)
092:                        throws IOException {
093:                    throw new RuntimeException(MESSAGE);
094:                }
095:
096:                /**
097:                 * Replaces the open action with an error message.
098:                 */
099:                public void doSave(String filename, byte[] data)
100:                        throws Exception {
101:                    throw new RuntimeException(MESSAGE);
102:                }
103:
104:                /**
105:                 * Replaces the saveFile action with an error message.
106:                 */
107:                protected void doOpenFile(String filename)
108:                        throws MalformedURLException, IOException {
109:                    throw new RuntimeException(MESSAGE);
110:                }
111:
112:            }
113:
114:            /**
115:             * Bundle of all actions in this class.
116:             */
117:            public static class AllActions extends
118:                    JGraphpadFileAction.AllActions {
119:
120:                /**
121:                 * Constructs the action bundle for the specified editor.
122:                 * 
123:                 * @param editor
124:                 *            The enclosing editor for this bundle.
125:                 */
126:                public AllActions(JGraphEditor editor) {
127:                    super (editor);
128:                    actionClose = new JGraphpadDemoFileAction(
129:                            JGraphpadFileAction.NAME_CLOSE, editor);
130:                    actionCloseAll = new JGraphpadDemoFileAction(
131:                            JGraphpadFileAction.NAME_CLOSE, editor);
132:                    actionOpen = new JGraphpadDemoFileAction(
133:                            JGraphpadFileAction.NAME_OPEN, editor);
134:                    actionSave = new JGraphpadDemoFileAction(
135:                            JGraphpadFileAction.NAME_SAVE, editor);
136:                    actionSaveAs = new JGraphpadDemoFileAction(
137:                            JGraphpadFileAction.NAME_SAVEAS, editor);
138:                    actionSaveAll = new JGraphpadDemoFileAction(
139:                            JGraphpadFileAction.NAME_SAVEALL, editor);
140:                }
141:
142:                /*
143:                 * (non-Javadoc)
144:                 */
145:                public void update() {
146:                    actionOpen.setEnabled(false);
147:                    actionSave.setEnabled(false);
148:                    actionSaveAs.setEnabled(false);
149:                    actionSaveAll.setEnabled(false);
150:                    actionUploadAs.setEnabled(false);
151:                }
152:
153:            }
154:
155:            //
156:            // Main
157:            //
158:
159:            /**
160:             * Constructs and displays a new application window.
161:             * 
162:             * @param args
163:             *            The command line arguments to pass to the application.
164:             */
165:            public static void main(String[] args) {
166:                try {
167:                    new JGraphpadDemo()
168:                            .createApplication(null, new Hashtable());
169:                } catch (Exception e) {
170:                    e.printStackTrace();
171:                }
172:            }
173:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.