Source Code Cross Referenced for MouseDragEditor.java in  » Testing » jacareto » jacareto » 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 » Testing » jacareto » jacareto.editor 
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.editor;
025:
026:        import jacareto.struct.MouseDrag;
027:        import jacareto.struct.StructureElement;
028:        import jacareto.system.Environment;
029:        import jacareto.system.Language;
030:        import jacareto.toolkit.swing.IntegerTextField;
031:
032:        import java.awt.Component;
033:        import java.awt.GridBagConstraints;
034:        import java.awt.GridBagLayout;
035:
036:        import javax.swing.JLabel;
037:        import javax.swing.JPanel;
038:        import javax.swing.JTextField;
039:        import javax.swing.border.EmptyBorder;
040:
041:        /**
042:         * An editor for mouse drags.
043:         *
044:         * @author <a href="mailto:cspannagel@web.de">Christian Spannagel</a>
045:         * @version 1.01
046:         */
047:        public class MouseDragEditor extends Editor {
048:            /** The element to edit. */
049:            private StructureElement element;
050:
051:            /** The panel. */
052:            private JPanel editorPanel;
053:
054:            /** The grid bag constraints. */
055:            private GridBagConstraints c;
056:
057:            /** The text field for the source name. */
058:            private JTextField sourceField;
059:
060:            /** The text field for the stop x position. */
061:            private IntegerTextField startXField;
062:
063:            /** The text field for the stop y position. */
064:            private IntegerTextField startYField;
065:
066:            /** The text field for the stop x position. */
067:            private IntegerTextField stopXField;
068:
069:            /** The text field for the stop y position. */
070:            private IntegerTextField stopYField;
071:
072:            /**
073:             * Create a new mouse motion editor.
074:             *
075:             * @param env the environment
076:             */
077:            public MouseDragEditor(Environment env) {
078:                super (env);
079:
080:                Language language = getLanguage();
081:
082:                // The panel with the text fields
083:                editorPanel = new JPanel();
084:                editorPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
085:                editorPanel.setLayout(new GridBagLayout());
086:
087:                // The source field label
088:                c = new GridBagConstraints();
089:                c.gridx = 0;
090:                c.gridy = 0;
091:                c.weightx = 40;
092:                c.ipadx = 5;
093:                c.ipady = 5;
094:                c.anchor = GridBagConstraints.WEST;
095:
096:                JLabel sourceFieldLabel = new JLabel(language
097:                        .getString("Events.Event.Source")
098:                        + ":");
099:                editorPanel.add(sourceFieldLabel, c);
100:
101:                // The source field
102:                c.gridx = 1;
103:                c.weightx = 60;
104:                sourceField = new JTextField("", 20);
105:                sourceField.setEditable(false);
106:                sourceField.setBackground(editorPanel.getBackground());
107:                editorPanel.add(sourceField, c);
108:                sourceFieldLabel.setLabelFor(sourceField);
109:
110:                // The start x field label
111:                c.gridx = 0;
112:                c.gridy = 1;
113:
114:                JLabel startXFieldLabel = new JLabel(language
115:                        .getString("Structures.MouseDrag.StartX")
116:                        + ":");
117:                editorPanel.add(startXFieldLabel, c);
118:
119:                // The start x field
120:                c.gridx = 1;
121:                startXField = new IntegerTextField(0, 5);
122:                startXField.setEditable(false);
123:                startXField.setBackground(editorPanel.getBackground());
124:                editorPanel.add(startXField, c);
125:                startXFieldLabel.setLabelFor(startXField);
126:
127:                // The start y field label
128:                c.gridx = 0;
129:                c.gridy = 2;
130:
131:                JLabel startYFieldLabel = new JLabel(language
132:                        .getString("Structures.MouseDrag.StartY")
133:                        + ":");
134:                editorPanel.add(startYFieldLabel, c);
135:
136:                // The start y field
137:                c.gridx = 1;
138:                startYField = new IntegerTextField(0, 5);
139:                startYField.setEditable(false);
140:                startYField.setBackground(editorPanel.getBackground());
141:                editorPanel.add(startYField, c);
142:                startYFieldLabel.setLabelFor(startYField);
143:
144:                // The stop x field label
145:                c.gridx = 0;
146:                c.gridy = 3;
147:
148:                JLabel stopXFieldLabel = new JLabel(language
149:                        .getString("Structures.MouseDrag.StopX")
150:                        + ":");
151:                editorPanel.add(stopXFieldLabel, c);
152:
153:                // The stop x field
154:                c.gridx = 1;
155:                stopXField = new IntegerTextField(0, 5);
156:                stopXField.setEditable(false);
157:                stopXField.setBackground(editorPanel.getBackground());
158:                editorPanel.add(stopXField, c);
159:                stopXFieldLabel.setLabelFor(stopXField);
160:
161:                // The stop y field label
162:                c.gridx = 0;
163:                c.gridy = 4;
164:
165:                JLabel stopYFieldLabel = new JLabel(language
166:                        .getString("Structures.MouseDrag.StopY")
167:                        + ":");
168:                editorPanel.add(stopYFieldLabel, c);
169:
170:                // The stop y field
171:                c.gridx = 1;
172:                stopYField = new IntegerTextField(0, 5);
173:                stopYField.setEditable(false);
174:                stopYField.setBackground(editorPanel.getBackground());
175:                editorPanel.add(stopYField, c);
176:                stopYFieldLabel.setLabelFor(stopYField);
177:            }
178:
179:            /**
180:             * Returns whether this editor is responsible for a given structure element. This editor is
181:             * responsible for all mouse drag elements.
182:             *
183:             * @param element the structure element
184:             *
185:             * @return <code>true</code> if <i>element</i> is a mouse event recordable and not
186:             *         <code>null</code>, otherwise <code>false</code>
187:             */
188:            public boolean handlesElement(StructureElement element) {
189:                return (element != null) && (element instanceof  MouseDrag);
190:            }
191:
192:            /**
193:             * Returns the actual structure element to be edited.
194:             *
195:             * @return DOCUMENT ME!
196:             */
197:            public StructureElement getElement() {
198:                return element;
199:            }
200:
201:            /**
202:             * Sets the element to edit.
203:             *
204:             * @param element DOCUMENT ME!
205:             */
206:            public void setElement(StructureElement element) {
207:                this .element = element;
208:
209:                MouseDrag drag = (MouseDrag) element;
210:                startXField.setValue(drag.getStartX());
211:                startYField.setValue(drag.getStartY());
212:                stopXField.setValue(drag.getStopX());
213:                stopYField.setValue(drag.getStopY());
214:                sourceField.setText(drag.getSourceName());
215:                sourceField.setCaretPosition(0);
216:            }
217:
218:            /**
219:             * Returns the component of the editor.
220:             *
221:             * @return the editor component
222:             */
223:            public Component getComponent() {
224:                return editorPanel;
225:            }
226:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.