Source Code Cross Referenced for VideoClipRecordableEditor.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.VideoClipRecordable;
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.VideoClipFileFilter;
033:
034:        import java.awt.Component;
035:        import java.awt.GridBagConstraints;
036:        import java.awt.GridBagLayout;
037:        import java.awt.Insets;
038:        import java.awt.event.ActionEvent;
039:        import java.awt.event.ActionListener;
040:
041:        import javax.swing.JButton;
042:        import javax.swing.JCheckBox;
043:        import javax.swing.JFileChooser;
044:        import javax.swing.JLabel;
045:        import javax.swing.JPanel;
046:        import javax.swing.JTextField;
047:        import javax.swing.SwingConstants;
048:        import javax.swing.SwingUtilities;
049:        import javax.swing.event.DocumentEvent;
050:
051:        /**
052:         * Editor for video clips.
053:         *
054:         * @author Oliver Specht
055:         * @version $revision$
056:         */
057:        public class VideoClipRecordableEditor extends Editor {
058:            /** The structure element to edit. */
059:            private StructureElement element;
060:
061:            /** The editor's component. */
062:            private JPanel editorPanel;
063:
064:            /** The text field for the name. */
065:            private JTextField filenameField;
066:
067:            /** The text fields for the window coordinates. */
068:            private IntegerTextField locationXField;
069:            private IntegerTextField locationYField;
070:            private IntegerTextField widthField;
071:            private IntegerTextField heightField;
072:            private JCheckBox sizeCheckBox;
073:
074:            /**
075:             * Create a new video clip recordable editor.
076:             *
077:             * @param env the environment
078:             */
079:            public VideoClipRecordableEditor(Environment env) {
080:                super (env);
081:
082:                Language language = getLanguage();
083:
084:                editorPanel = new JPanel();
085:                editorPanel.setLayout(new GridBagLayout());
086:
087:                // The filename field label
088:                GridBagConstraints c = new GridBagConstraints();
089:                c.gridx = 0;
090:                c.gridy = 0;
091:                c.weightx = 30;
092:
093:                //c.ipady = 3;
094:                //c.ipadx = 5;
095:                c.insets = new Insets(5, 5, 5, 5);
096:                c.anchor = GridBagConstraints.WEST;
097:
098:                JLabel filenameFieldLabel = new JLabel(language
099:                        .getString("General.Filename")
100:                        + ":");
101:                editorPanel.add(filenameFieldLabel, c);
102:
103:                // The filename field
104:                c.gridx = 1;
105:                c.weightx = 60;
106:                filenameField = new JTextField(20);
107:                filenameField.getDocument().addDocumentListener(
108:                        new TextValueListener() {
109:                            public void textValueChanged(DocumentEvent e) {
110:                                if (isUpdateOnChange && (getElement() != null)) {
111:                                    ((VideoClipRecordable) getElement())
112:                                            .setFilename(filenameField
113:                                                    .getText());
114:                                }
115:                            }
116:                        });
117:                editorPanel.add(filenameField, c);
118:                filenameFieldLabel.setLabelFor(filenameField);
119:
120:                // The choose button
121:                JButton chooseButton = new JButton(language
122:                        .getString("General.Choose")
123:                        + "...");
124:                chooseButton.addActionListener(new ActionListener() {
125:                    public void actionPerformed(ActionEvent event) {
126:                        JFileChooser chooser = new JFileChooser(".");
127:
128:                        // chooser.setFileSelectionMode (JFileChooser.FILES_AND_DIRECTORIES);
129:                        chooser
130:                                .setDialogTitle(getLanguage()
131:                                        .getString(
132:                                                "Editors.VideoClipRecordableEditor.FileChooser.Title"));
133:                        chooser
134:                                .setFileFilter(new VideoClipFileFilter(
135:                                        getLanguage()
136:                                                .getString(
137:                                                        "Editors.VideoClipRecordableEditor.FileChooser.FileFilterDescription")));
138:
139:                        int returnVal = chooser.showDialog(SwingUtilities
140:                                .getWindowAncestor(editorPanel), getLanguage()
141:                                .getString("General.Open"));
142:
143:                        if (returnVal == JFileChooser.APPROVE_OPTION) {
144:                            String filename = chooser.getSelectedFile()
145:                                    .getAbsolutePath();
146:
147:                            if (isUpdateOnChange && (getElement() != null)) {
148:                                ((VideoClipRecordable) getElement())
149:                                        .setFilename(filename);
150:
151:                                if (((VideoClipRecordable) getElement())
152:                                        .determineDuration()) {
153:                                    filenameField.setText(filename);
154:                                }
155:                            }
156:                        }
157:                    }
158:                });
159:                c.gridy = 1;
160:                c.gridx = 0;
161:                c.gridwidth = 2;
162:                c.anchor = GridBagConstraints.CENTER;
163:                editorPanel.add(chooseButton, c);
164:
165:                JLabel locationXLabel = new JLabel(language
166:                        .getString("General.Coordinates.X")
167:                        + ":", SwingConstants.RIGHT);
168:                c.gridx = 0;
169:                c.gridy = 2;
170:                c.gridwidth = 1;
171:                c.anchor = GridBagConstraints.WEST;
172:                editorPanel.add(locationXLabel, c);
173:
174:                locationXField = new IntegerTextField(4);
175:                locationXField.getDocument().addDocumentListener(
176:                        new TextValueListener() {
177:                            public void textValueChanged(DocumentEvent e) {
178:                                if (isUpdateOnChange && (getElement() != null)) {
179:                                    ((VideoClipRecordable) getElement())
180:                                            .setX(locationXField.getValue());
181:                                }
182:                            }
183:                        });
184:                c.gridx = 1;
185:                editorPanel.add(locationXField, c);
186:
187:                JLabel locationYLabel = new JLabel(language
188:                        .getString("General.Coordinates.Y")
189:                        + ":", SwingConstants.RIGHT);
190:                c.gridx = 0;
191:                c.gridy = 3;
192:                editorPanel.add(locationYLabel, c);
193:
194:                locationYField = new IntegerTextField(4);
195:                locationYField.getDocument().addDocumentListener(
196:                        new TextValueListener() {
197:                            public void textValueChanged(DocumentEvent e) {
198:                                if (isUpdateOnChange && (getElement() != null)) {
199:                                    ((VideoClipRecordable) getElement())
200:                                            .setY(locationYField.getValue());
201:                                }
202:                            }
203:                        });
204:                c.gridx = 1;
205:                editorPanel.add(locationYField, c);
206:
207:                // The size components
208:                sizeCheckBox = new JCheckBox(
209:                        language
210:                                .getString("Recordables.VideoClipRecordable.Attributes.AutomaticSizeDetection"));
211:                sizeCheckBox.addActionListener(new ActionListener() {
212:                    public void actionPerformed(ActionEvent e) {
213:                        if (getElement() != null) {
214:                            ((VideoClipRecordable) getElement())
215:                                    .setAutomaticSizeDetection(sizeCheckBox
216:                                            .isSelected());
217:                            widthField.setEnabled(!sizeCheckBox.isSelected());
218:                            heightField.setEnabled(!sizeCheckBox.isSelected());
219:                        }
220:                    }
221:                });
222:                c.gridx = 0;
223:                c.gridy = 4;
224:                c.gridwidth = 2;
225:                editorPanel.add(sizeCheckBox, c);
226:
227:                JLabel widthLabel = new JLabel(language
228:                        .getString("General.Width")
229:                        + ":", SwingConstants.RIGHT);
230:                c.gridx = 0;
231:                c.gridy = 5;
232:                c.gridwidth = 1;
233:                editorPanel.add(widthLabel, c);
234:
235:                widthField = new IntegerTextField(4);
236:                widthField.getDocument().addDocumentListener(
237:                        new TextValueListener() {
238:                            public void textValueChanged(DocumentEvent e) {
239:                                if (isUpdateOnChange && (getElement() != null)) {
240:                                    ((VideoClipRecordable) getElement())
241:                                            .setWidth(widthField.getValue());
242:                                }
243:                            }
244:                        });
245:                c.gridx = 1;
246:                editorPanel.add(widthField, c);
247:
248:                JLabel heightLabel = new JLabel(language
249:                        .getString("General.Height")
250:                        + ":", SwingConstants.RIGHT);
251:                c.gridx = 0;
252:                c.gridy = 6;
253:                editorPanel.add(heightLabel, c);
254:
255:                heightField = new IntegerTextField(4);
256:                heightField.getDocument().addDocumentListener(
257:                        new TextValueListener() {
258:                            public void textValueChanged(DocumentEvent e) {
259:                                if (isUpdateOnChange && (getElement() != null)) {
260:                                    ((VideoClipRecordable) getElement())
261:                                            .setHeight(heightField.getValue());
262:                                }
263:                            }
264:                        });
265:                c.gridx = 1;
266:                editorPanel.add(heightField, c);
267:            }
268:
269:            /**
270:             * Returns whether this editor is responsible for a given structure element. This editor is
271:             * responsible for video clip recordables.
272:             *
273:             * @param element the structure element
274:             *
275:             * @return <code>true</code> if <i>element</i> is an video clip recordable and not
276:             *         <code>null</code>, otherwise <code>false</code>
277:             */
278:            public boolean handlesElement(StructureElement element) {
279:                return (element != null)
280:                        && (element instanceof  VideoClipRecordable);
281:            }
282:
283:            /**
284:             * Returns the actual structure element to be edited.
285:             *
286:             * @return DOCUMENT ME!
287:             */
288:            public StructureElement getElement() {
289:                return element;
290:            }
291:
292:            /**
293:             * Sets the structure element to edit.
294:             *
295:             * @param element DOCUMENT ME!
296:             */
297:            public void setElement(StructureElement element) {
298:                this .element = element;
299:
300:                VideoClipRecordable aRecordable = (VideoClipRecordable) element;
301:                filenameField.setText(aRecordable.getFilename());
302:                locationXField.setValue(aRecordable.getX());
303:                locationYField.setValue(aRecordable.getY());
304:                widthField.setValue(aRecordable.getWidth());
305:                heightField.setValue(aRecordable.getHeight());
306:                sizeCheckBox.setSelected(aRecordable
307:                        .hasAutomaticSizeDetection());
308:                widthField.setEnabled(!sizeCheckBox.isSelected());
309:                heightField.setEnabled(!sizeCheckBox.isSelected());
310:            }
311:
312:            /**
313:             * Returns the component of the editor.
314:             *
315:             * @return the editor component
316:             */
317:            public Component getComponent() {
318:                return editorPanel;
319:            }
320:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.