Source Code Cross Referenced for ManipulationManagement.java in  » Testing » jacareto » jacareto » comp » manipulation » 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 » Testing » jacareto » jacareto.comp.manipulation 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Jacareto Copyright (c) 2002-2005
003:         * Applied Computer Science Research Group, Darmstadt University of
004:         * Technology, Institute of Mathematics & Computer Science,
005:         * Ludwigsburg University of Education, and Computer Based
006:         * Learning Research Group, Aachen University. All rights reserved.
007:         *
008:         * Jacareto is free software; you can redistribute it and/or
009:         * modify it under the terms of the GNU General Public
010:         * License as published by the Free Software Foundation; either
011:         * version 2 of the License, or (at your option) any later version.
012:         *
013:         * Jacareto is distributed in the hope that it will be useful,
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
016:         * General Public License for more details.
017:         *
018:         * You should have received a copy of the GNU General Public
019:         * License along with Jacareto; if not, write to the Free
020:         * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
021:         *
022:         */
023:
024:        package jacareto.comp.manipulation;
025:
026:        import jacareto.comp.Components;
027:        import jacareto.comp.glasspanes.DrawingPane;
028:        import jacareto.comp.glasspanes.GlassPaneCompound;
029:        import jacareto.comp.glasspanes.GlassPaneManager;
030:        import jacareto.system.Environment;
031:        import jacareto.system.EnvironmentMember;
032:
033:        import java.awt.Component;
034:        import java.awt.Window;
035:
036:        import java.util.Iterator;
037:        import java.util.Set;
038:        import java.util.Vector;
039:
040:        import javax.swing.JDialog;
041:        import javax.swing.JFrame;
042:
043:        /**
044:         * <p>
045:         * This class manages the manipulation modes for components. It can be drawn on windows, components
046:         * can be selected and directly manipulated, and so on...
047:         * </p>
048:         *
049:         * @author <a href="mailto:cspannagel@web.de">Christian Spannagel</a>
050:         * @version 1.01
051:         */
052:        public class ManipulationManagement extends EnvironmentMember {
053:            public static final int USE_COMPONENTS = 0;
054:            public static final int SELECT_COMPONENTS = 1;
055:            public static final int DRAW_ON_COMPONENTS = 2;
056:
057:            /** The actual manipulation mode. */
058:            private int mode;
059:
060:            /** The components. */
061:            private Components components;
062:
063:            /** The event listeners. */
064:            private Vector listeners;
065:
066:            /** The drawing tool component. */
067:            private Component drawingToolsComponent;
068:
069:            /**
070:             * Creates a new instance. The default mode is {@link #USE_COMPONENTS}.
071:             *
072:             * @param env the environment
073:             * @param components the components instance
074:             * @param drawingToolsComponent the component which contains the drawing tools
075:             */
076:            public ManipulationManagement(Environment env,
077:                    Components components, Component drawingToolsComponent) {
078:                super (env);
079:                setComponents(components);
080:                this .drawingToolsComponent = drawingToolsComponent;
081:                listeners = new Vector(5, 5);
082:                setMode(USE_COMPONENTS);
083:            }
084:
085:            /**
086:             * Sets the manipulation mode.
087:             *
088:             * @param mode the new mode
089:             */
090:            public void setMode(int mode) {
091:                if (this .mode == mode) {
092:                    return;
093:                }
094:
095:                int oldMode = this .mode;
096:                this .mode = mode;
097:
098:                //getCleverPHL ().getDrawingFrame ().close ();
099:                GlassPaneManager glassPaneManager = components
100:                        .getGlassPaneManager();
101:                glassPaneManager.setVisible(
102:                        GlassPaneCompound.COMPONENT_SELECTION_PANE,
103:                        (mode == SELECT_COMPONENTS));
104:
105:                GlassPaneCompound[] compounds = glassPaneManager
106:                        .getGlassPaneCompounds();
107:
108:                for (int i = 0; i < compounds.length; i++) {
109:                    DrawingPane drawingPane = (DrawingPane) compounds[i]
110:                            .getGlassPane(GlassPaneCompound.DRAWING_PANE);
111:                    drawingPane
112:                            .setMode((mode == DRAW_ON_COMPONENTS) ? DrawingPane.DRAW
113:                                    : DrawingPane.SHOW);
114:                    drawingPane.setVisible(true);
115:                }
116:
117:                if (mode == DRAW_ON_COMPONENTS) {
118:                    components.allToFront();
119:
120:                    // To be replaced by a general mechanism for activating windows
121:                    Window activeWindow = null;
122:                    Set includedRoots = components.getIncludedRoots();
123:                    Iterator it = includedRoots.iterator();
124:
125:                    while (it.hasNext()) {
126:                        Object root = it.next();
127:
128:                        if ((root instanceof  JFrame)
129:                                || (root instanceof  JDialog)) {
130:                            activeWindow = (Window) root;
131:
132:                            break;
133:                        }
134:                    }
135:
136:                    if (activeWindow != null) {
137:                        drawingToolsComponent.setVisible(true);
138:                        activeWindow.toFront();
139:                    } else {
140:                        setMode(oldMode);
141:
142:                        return;
143:                    }
144:                } else {
145:                    drawingToolsComponent.setVisible(false);
146:                }
147:
148:                fireManipulationManagementEvent(new ManipulationManagementEvent(
149:                        this , ManipulationManagementEvent.MODE_CHANGED));
150:
151:                // Setting all panes invisible, just for debugging
152:
153:                /*glassPaneManager.setVisible (GlassPaneCompound.COMPONENT_SELECTION_PANE, false);
154:                glassPaneManager.setVisible (GlassPaneCompound.DRAWING_PANE, false);
155:                glassPaneManager.setVisible (GlassPaneCompound.MARK_MODE_PANE, false);
156:                glassPaneManager.setVisible (GlassPaneCompound.PSEUDO_MOUSE_PANE, false);  */
157:            }
158:
159:            /**
160:             * Returns the manipulation mode.
161:             *
162:             * @return the actual mode
163:             */
164:            public int getMode() {
165:                return mode;
166:            }
167:
168:            /**
169:             * Sets the glass pane manager.
170:             *
171:             * @param components the new glass pane manager
172:             */
173:            public void setComponents(Components components) {
174:                this .components = components;
175:            }
176:
177:            /**
178:             * Returns the components.
179:             *
180:             * @return the components
181:             */
182:            public Components getComponents() {
183:                return components;
184:            }
185:
186:            /**
187:             * Adds a listener
188:             *
189:             * @param listener the new listener
190:             */
191:            public void addManipulationManagementListener(
192:                    ManipulationManagementListener listener) {
193:                if (!listeners.contains(listener)) {
194:                    listeners.add(listener);
195:                }
196:            }
197:
198:            /**
199:             * Removes a listener
200:             *
201:             * @param listener the listener to be removed
202:             */
203:            public void removeManipulationManagementListener(
204:                    ManipulationManagementListener listener) {
205:                if (listeners.contains(listener)) {
206:                    listeners.remove(listener);
207:                }
208:            }
209:
210:            /**
211:             * Fires an event.
212:             *
213:             * @param event the event to be fired
214:             */
215:            protected void fireManipulationManagementEvent(
216:                    ManipulationManagementEvent event) {
217:                Iterator it = listeners.iterator();
218:
219:                while (it.hasNext()) {
220:                    ((ManipulationManagementListener) it.next())
221:                            .manipulationManagementChanged(event);
222:                }
223:            }
224:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.