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