Source Code Cross Referenced for EnhancedEditor.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.record.EventObjectRecordable;
027:        import jacareto.struct.StructureElement;
028:        import jacareto.system.Environment;
029:        import jacareto.system.Language;
030:        import jacareto.toolkit.event.TextValueListener;
031:        import jacareto.toolkit.swing.IntegerTextField;
032:        import jacareto.toolkit.swing.LongTextField;
033:
034:        import java.awt.Component;
035:        import java.awt.GridBagConstraints;
036:        import java.awt.GridBagLayout;
037:
038:        import javax.swing.JComboBox;
039:        import javax.swing.JLabel;
040:        import javax.swing.JPanel;
041:        import javax.swing.JTextField;
042:        import javax.swing.border.EmptyBorder;
043:        import javax.swing.event.DocumentEvent;
044:        import javax.swing.*;
045:
046:        /**
047:         * <p>
048:         * An editor which offers some standard methods for adding GUI elements
049:         * </p>
050:         *
051:         * <p>
052:         * If a subclass overwrites the method {@link #setElement(StructureElement)}, it should call the
053:         * method of its superclass first.
054:         * </p>
055:         *
056:         *
057:         * @author <a href="mailto:cspannagel@web.de">Christian Spannagel</a>
058:         * @version 1.01
059:         */
060:        public abstract class EnhancedEditor extends Editor {
061:            /** The editor's component. */
062:            protected JPanel editorPanel;
063:
064:            /** The GridBagConstraints. */
065:            protected GridBagConstraints c;
066:
067:            /** The structure element to edit. */
068:            private StructureElement element;
069:
070:            /** The number of rows contained in the editor's panel. */
071:            private int rowCount;
072:
073:            /**
074:             * Create a new event object recordable editor.
075:             *
076:             * @param env the environment
077:             */
078:            public EnhancedEditor(Environment env) {
079:                super (env);
080:
081:                Language language = getLanguage();
082:                rowCount = 0;
083:
084:                // The panel with the text fields
085:                editorPanel = new JPanel();
086:                editorPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
087:                editorPanel.setLayout(new GridBagLayout());
088:
089:                // Init the constraints
090:                c = new GridBagConstraints();
091:                c.ipadx = 5;
092:                c.ipady = 5;
093:                c.anchor = GridBagConstraints.WEST;
094:            }
095:
096:            /**
097:             * Adds a text field row to the editor's component. The text field is editable by default.
098:             *
099:             * @param labelText the text of the label
100:             * @param length the number of columns of the text field
101:             *
102:             * @return the text field of that row
103:             */
104:            protected JTextField addTextFieldRow(String labelText, int length) {
105:                c.gridx = 0;
106:                c.weightx = 40;
107:                c.gridy = rowCount;
108:
109:                JLabel label = new JLabel(labelText + ":");
110:                editorPanel.add(label, c);
111:
112:                c.gridx = 1;
113:                c.weightx = 60;
114:
115:                JTextField result = new JTextField("", length);
116:                editorPanel.add(result, c);
117:                label.setLabelFor(result);
118:
119:                rowCount++;
120:
121:                return result;
122:            }
123:
124:            /**
125:             * Adds an integer text field row to the editor's component. The integer text field is editable
126:             * by default.
127:             *
128:             * @param labelText the text of the label
129:             * @param length the number of columns of the text field
130:             *
131:             * @return the integer text field of that row
132:             */
133:            protected IntegerTextField addIntegerTextFieldRow(String labelText,
134:                    int length) {
135:                c.gridx = 0;
136:                c.weightx = 40;
137:                c.gridy = rowCount;
138:
139:                JLabel label = new JLabel(labelText + ":");
140:                editorPanel.add(label, c);
141:
142:                c.gridx = 1;
143:                c.weightx = 60;
144:
145:                IntegerTextField result = new IntegerTextField(length);
146:                editorPanel.add(result, c);
147:                label.setLabelFor(result);
148:
149:                rowCount++;
150:
151:                return result;
152:            }
153:
154:            /**
155:             * Adds a long text field row to the editor's component. The long text field is editable by
156:             * default.
157:             *
158:             * @param labelText the text of the label
159:             * @param length the number of columns of the text field
160:             *
161:             * @return the long text field of that row
162:             */
163:            protected LongTextField addLongTextFieldRow(String labelText,
164:                    int length) {
165:                c.gridx = 0;
166:                c.weightx = 40;
167:                c.gridy = rowCount;
168:
169:                JLabel label = new JLabel(labelText + ":");
170:                editorPanel.add(label, c);
171:
172:                c.gridx = 1;
173:                c.weightx = 60;
174:
175:                LongTextField result = new LongTextField(length);
176:                editorPanel.add(result, c);
177:                label.setLabelFor(result);
178:
179:                rowCount++;
180:
181:                return result;
182:            }
183:
184:            /**
185:             * Adds a combobox row to the editor's component.
186:             *
187:             * @param labelText the text of the label
188:             *
189:             * @return the combo box of that row
190:             */
191:            protected JComboBox addComboBoxRow(String labelText) {
192:                c.gridx = 0;
193:                c.weightx = 40;
194:                c.gridy = rowCount;
195:
196:                JLabel label = new JLabel(labelText + ":");
197:                editorPanel.add(label, c);
198:
199:                c.gridx = 1;
200:                c.weightx = 60;
201:
202:                JComboBox result = new JComboBox();
203:                editorPanel.add(result, c);
204:                label.setLabelFor(result);
205:
206:                rowCount++;
207:
208:                return result;
209:            }
210:
211:            /**
212:             * Adds a checkbox row to the editor's component.
213:             *
214:             * @param labelText the text of the label
215:             *
216:             * @return the checkbox of that row
217:             */
218:            protected JCheckBox addCheckBoxRow(String labelText) {
219:                c.gridx = 0;
220:                c.weightx = 40;
221:                c.gridy = rowCount;
222:                c.gridwidth = 2;
223:
224:                JCheckBox result = new JCheckBox(labelText);
225:                editorPanel.add(result, c);
226:
227:                rowCount++;
228:
229:                return result;
230:            }
231:
232:            /**
233:             * Returns the actual structure element to be edited.
234:             *
235:             * @return DOCUMENT ME!
236:             */
237:            public StructureElement getElement() {
238:                return element;
239:            }
240:
241:            /**
242:             * Sets the structure element to edit.
243:             *
244:             * @param element DOCUMENT ME!
245:             */
246:            public void setElement(StructureElement element) {
247:                this .element = element;
248:            }
249:
250:            /**
251:             * Returns the component of the editor.
252:             *
253:             * @return the editor component
254:             */
255:            public Component getComponent() {
256:                return editorPanel;
257:            }
258:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.