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


001:        /* 
002:         * $Id: JGraphEditorKit.java,v 1.3 2006/06/05 19:48: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.editor;
011:
012:        import java.util.ArrayList;
013:        import java.util.Hashtable;
014:        import java.util.Iterator;
015:        import java.util.List;
016:        import java.util.Map;
017:
018:        /**
019:         * Holds references to actions and mouse tools and updates their states.
020:         */
021:        public class JGraphEditorKit {
022:
023:            /**
024:             * Holds the (name, action) and (name, tool) pairs respectively.
025:             */
026:            protected Map actions = new Hashtable(), tools = new Hashtable();
027:
028:            /**
029:             * Holds all action bundles.
030:             */
031:            protected List bundles = new ArrayList(2);
032:
033:            /**
034:             * Adds the specified action to the kit.
035:             * 
036:             * @param action
037:             *            The action to add.
038:             * @return Returns the previous action for the same name.
039:             * 
040:             * @see JGraphEditorAction#getName()
041:             */
042:            public Object addAction(JGraphEditorAction action) {
043:                if (action != null)
044:                    return actions.put(action.getName(), action);
045:                return null;
046:            }
047:
048:            /**
049:             * Adds all actions in the specified bundle and stores a reference to the
050:             * bundle for later update of the actions.
051:             * 
052:             * @param bundle
053:             *            The bundle to add the actions from.
054:             */
055:            public void addBundle(JGraphEditorAction.Bundle bundle) {
056:                JGraphEditorAction[] a = bundle.getActions();
057:                for (int i = 0; i < a.length; i++)
058:                    addAction(a[i]);
059:                bundles.add(bundle);
060:            }
061:
062:            /**
063:             * Returns the action for the specified name or <code>null</code> if no
064:             * such action exists.
065:             * 
066:             * @param name
067:             *            The name that identifies the action.
068:             * @return Returns the action with the name <code>name</code> or
069:             *         <code>null</code>.
070:             */
071:            public JGraphEditorAction getAction(String name) {
072:                if (name != null)
073:                    return (JGraphEditorAction) actions.get(name);
074:                return null;
075:            }
076:
077:            /**
078:             * Adds the specified tool to the kit.
079:             * 
080:             * @param tool
081:             *            The tool to add.
082:             * @return Returns the previous tool for the same name.
083:             * 
084:             * @see JGraphEditorTool#getName()
085:             */
086:            public Object addTool(JGraphEditorTool tool) {
087:                if (tool != null) {
088:                    return tools.put(tool.getName(), tool);
089:                }
090:                return null;
091:            }
092:
093:            /**
094:             * Returns the tool for the specified name or <code>null</code> if no such
095:             * tool exists.
096:             * 
097:             * @param name
098:             *            The name that identifies the tool.
099:             * @return Returns the tool with the name <code>name</code> or
100:             *         <code>null</code>.
101:             */
102:            public JGraphEditorTool getTool(String name) {
103:                if (name != null)
104:                    return (JGraphEditorTool) tools.get(name);
105:                return null;
106:            }
107:
108:            /**
109:             * This is messaged from the application when the kit should update the
110:             * state of its actions and tools. This implementation updates all
111:             * registered bundles.
112:             * 
113:             * @see JGraphEditorAction.Bundle#update()
114:             */
115:            public void update() {
116:                Iterator it = bundles.iterator();
117:                while (it.hasNext())
118:                    ((JGraphEditorAction.Bundle) it.next()).update();
119:            }
120:
121:            /**
122:             * @return Returns the actions.
123:             */
124:            public Map getActions() {
125:                return actions;
126:            }
127:
128:            /**
129:             * @param actions The actions to set.
130:             */
131:            public void setActions(Map actions) {
132:                this .actions = actions;
133:            }
134:
135:            /**
136:             * @return Returns the bundles.
137:             */
138:            public List getBundles() {
139:                return bundles;
140:            }
141:
142:            /**
143:             * @param bundles The bundles to set.
144:             */
145:            public void setBundles(List bundles) {
146:                this .bundles = bundles;
147:            }
148:
149:            /**
150:             * @return Returns the tools.
151:             */
152:            public Map getTools() {
153:                return tools;
154:            }
155:
156:            /**
157:             * @param tools The tools to set.
158:             */
159:            public void setTools(Map tools) {
160:                this.tools = tools;
161:            }
162:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.