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