Source Code Cross Referenced for EditorFrame.java in  » 6.0-JDK-Modules » java-3d » org » jdesktop » j3dedit » scenegrapheditor » nodeeditors » 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 » 6.0 JDK Modules » java 3d » org.jdesktop.j3dedit.scenegrapheditor.nodeeditors 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  $Header: /cvs/j3dfly/J3dEditor/src/org/jdesktop/j3dedit/scenegrapheditor/nodeeditors/EditorFrame.java,v 1.1 2005/04/20 22:20:59 paulby Exp $
003:         *
004:         *                         Sun Public License Notice
005:         *
006:         *  The contents of this file are subject to the Sun Public License Version
007:         *  1.0 (the "License"). You may not use this file except in compliance with
008:         *  the License. A copy of the License is available at http://www.sun.com/
009:         *  
010:         *  The Original Code is the Java 3D(tm) Scene Graph Editor.
011:         *  The Initial Developer of the Original Code is Paul Byrne.
012:         *  Portions created by Paul Byrne are Copyright (C) 2002.
013:         *  All Rights Reserved.
014:         *  
015:         *  Contributor(s): Paul Byrne.
016:         *  
017:         **/
018:        package org.jdesktop.j3dedit.scenegrapheditor.nodeeditors;
019:
020:        import org.jdesktop.j3dfly.namecontrol.NameControl;
021:        import javax.swing.JOptionPane;
022:        import org.jdesktop.j3dedit.scenegraph.SGNode;
023:
024:        /**
025:         * @author Paul Byrne
026:         * @version	1.11, 01/18/02
027:         */
028:        public class EditorFrame extends javax.swing.JFrame implements 
029:                EditorPanelContainer {
030:
031:            private NodeEditorPanel editorPanel;
032:            private CapabilityPanel capabilityPanel = null;
033:            private boolean readOnly = false;
034:            private EditorManager editorManager;
035:
036:            private String origNodeName = null;
037:
038:            /** Creates new form EditorFrame 
039:             * The frame is disabled by default
040:             */
041:            public EditorFrame(EditorManager editorManager) {
042:                this .editorManager = editorManager;
043:                initComponents();
044:                setEnabled(false);
045:            }
046:
047:            /** This method is called from within the constructor to
048:             * initialize the form.
049:             * WARNING: Do NOT modify this code. The content of this method is
050:             * always regenerated by the FormEditor.
051:             */
052:            private void initComponents() {//GEN-BEGIN:initComponents
053:                jPanel1 = new javax.swing.JPanel();
054:                jLabel2 = new javax.swing.JLabel();
055:                sceneNameTF = new javax.swing.JTextField();
056:                jLabel1 = new javax.swing.JLabel();
057:                nodeNameTF = new javax.swing.JTextField();
058:                showCapabilitiesCB = new javax.swing.JCheckBox();
059:                jPanel2 = new javax.swing.JPanel();
060:                applyButton = new javax.swing.JButton();
061:                cancelButton = new javax.swing.JButton();
062:                detailsPanel = new javax.swing.JScrollPane();
063:                capabilityContainer = new javax.swing.JPanel();
064:
065:                addWindowListener(new java.awt.event.WindowAdapter() {
066:                    public void windowClosing(java.awt.event.WindowEvent evt) {
067:                        exitForm(evt);
068:                    }
069:                });
070:
071:                jLabel2.setText("Scene :");
072:                jPanel1.add(jLabel2);
073:
074:                sceneNameTF.setEditable(false);
075:                sceneNameTF.setText("              ");
076:                sceneNameTF
077:                        .setToolTipText("Name of the Scene containing this node");
078:                sceneNameTF.setMinimumSize(new java.awt.Dimension(80, 21));
079:                sceneNameTF.setPreferredSize(new java.awt.Dimension(80, 21));
080:                jPanel1.add(sceneNameTF);
081:
082:                jLabel1.setText("Node Name :");
083:                jPanel1.add(jLabel1);
084:
085:                nodeNameTF
086:                        .setToolTipText("The name for this node in the Java Source code");
087:                nodeNameTF.setMinimumSize(new java.awt.Dimension(80, 21));
088:                nodeNameTF.setPreferredSize(new java.awt.Dimension(80, 21));
089:                nodeNameTF
090:                        .addActionListener(new java.awt.event.ActionListener() {
091:                            public void actionPerformed(
092:                                    java.awt.event.ActionEvent evt) {
093:                                nodeNameTFActionPerformed(evt);
094:                            }
095:                        });
096:
097:                nodeNameTF.addFocusListener(new java.awt.event.FocusAdapter() {
098:                    public void focusLost(java.awt.event.FocusEvent evt) {
099:                        nodeNameTFFocusLost(evt);
100:                    }
101:                });
102:
103:                jPanel1.add(nodeNameTF);
104:
105:                showCapabilitiesCB.setText("Show Capabilities");
106:                showCapabilitiesCB
107:                        .addActionListener(new java.awt.event.ActionListener() {
108:                            public void actionPerformed(
109:                                    java.awt.event.ActionEvent evt) {
110:                                showCapabilitiesCBActionPerformed(evt);
111:                            }
112:                        });
113:
114:                jPanel1.add(showCapabilitiesCB);
115:
116:                getContentPane().add(jPanel1, java.awt.BorderLayout.NORTH);
117:
118:                applyButton.setText("Apply");
119:                applyButton
120:                        .addActionListener(new java.awt.event.ActionListener() {
121:                            public void actionPerformed(
122:                                    java.awt.event.ActionEvent evt) {
123:                                applyButtonActionPerformed(evt);
124:                            }
125:                        });
126:
127:                jPanel2.add(applyButton);
128:
129:                cancelButton.setText("Cancel");
130:                cancelButton
131:                        .addActionListener(new java.awt.event.ActionListener() {
132:                            public void actionPerformed(
133:                                    java.awt.event.ActionEvent evt) {
134:                                cancelButtonActionPerformed(evt);
135:                            }
136:                        });
137:
138:                jPanel2.add(cancelButton);
139:
140:                getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH);
141:
142:                detailsPanel.setMinimumSize(new java.awt.Dimension(350, 250));
143:                detailsPanel.setPreferredSize(new java.awt.Dimension(350, 250));
144:                getContentPane()
145:                        .add(detailsPanel, java.awt.BorderLayout.CENTER);
146:
147:                getContentPane().add(capabilityContainer,
148:                        java.awt.BorderLayout.EAST);
149:
150:            }//GEN-END:initComponents
151:
152:            private void nodeNameTFFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_nodeNameTFFocusLost
153:            // Add your handling code here:
154:                userChangedNodeName();
155:            }//GEN-LAST:event_nodeNameTFFocusLost
156:
157:            private void nodeNameTFActionPerformed(
158:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nodeNameTFActionPerformed
159:            // Add your handling code here:
160:                userChangedNodeName();
161:            }//GEN-LAST:event_nodeNameTFActionPerformed
162:
163:            /**
164:             * User has changed the node name
165:             */
166:            private void userChangedNodeName() {
167:                if (nodeNameTF.getText().length() == 0)
168:                    if (origNodeName != null) {
169:                        JOptionPane
170:                                .showMessageDialog(
171:                                        null,
172:                                        "Node Names cannot be set back to null in this version",
173:                                        "Illegal Name",
174:                                        JOptionPane.ERROR_MESSAGE);
175:                        nodeNameTF.setText(origNodeName);
176:                        return;
177:                    } else
178:                        return;
179:
180:                if (editorManager.getCurrentNode().getNodeName() != null
181:                        && editorManager.getCurrentNode().getNodeName().equals(
182:                                nodeNameTF.getText()))
183:                    return;
184:
185:                if (editorManager.getCurrentNode().getContext()
186:                        .getNameControl().isUnique(sceneNameTF.getText(),
187:                                nodeNameTF.getText())) {
188:                    editorManager.notifyNameChange(nodeNameTF.getText());
189:                    editorPanel.setNodeName(nodeNameTF.getText());
190:                    editorPanel.setUpdateRequired(true);
191:                    editorManager.getCurrentNode().repaint();
192:                } else {
193:                    // TODO Show the dialog in a SwingWorker
194:                    JOptionPane.showMessageDialog(null, "Name "
195:                            + nodeNameTF.getText() + " is not unqiue in scene "
196:                            + sceneNameTF.getText(), "Node name is not unique",
197:                            JOptionPane.ERROR_MESSAGE);
198:                    nodeNameTF.selectAll();
199:                }
200:            }
201:
202:            public void setNodeName(String nodeName) {
203:                origNodeName = nodeName;
204:                nodeNameTF.setText(origNodeName);
205:            }
206:
207:            public void setSceneName(String sceneName) {
208:                sceneNameTF.setText(sceneName);
209:            }
210:
211:            private void showCapabilitiesCBActionPerformed(
212:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showCapabilitiesCBActionPerformed
213:            // Add your handling code here:
214:                if (showCapabilitiesCB.isSelected()) {
215:                    if (capabilityPanel == null) {
216:                        capabilityPanel = new CapabilityPanel();
217:                    }
218:                    capabilityContainer.add(capabilityPanel);
219:                    validate();
220:                } else {
221:                    capabilityContainer.remove(capabilityPanel);
222:                    validate();
223:                }
224:            }//GEN-LAST:event_showCapabilitiesCBActionPerformed
225:
226:            protected void capabilityStartEdit(
227:                    org.jdesktop.j3dedit.scenegraph.SGObject obj) {
228:                if (capabilityPanel != null)
229:                    capabilityPanel.startEdit(obj);
230:            }
231:
232:            protected void capabilityFinishEdit() {
233:                if (capabilityPanel != null)
234:                    capabilityPanel.finishEdit();
235:            }
236:
237:            private void applyButtonActionPerformed(
238:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_applyButtonActionPerformed
239:            // Add your handling code here:
240:                editorManager.applyChanges();
241:            }//GEN-LAST:event_applyButtonActionPerformed
242:
243:            private void cancelButtonActionPerformed(
244:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
245:            // Add your handling code here:
246:                editorManager.resetChanges();
247:            }//GEN-LAST:event_cancelButtonActionPerformed
248:
249:            /** Exit the Application */
250:            private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
251:                System.exit(0);
252:            }//GEN-LAST:event_exitForm
253:
254:            public void setEnabled(boolean enabled) {
255:                super .setEnabled(enabled);
256:                applyButton.setEnabled(enabled);
257:                cancelButton.setEnabled(enabled);
258:                showCapabilitiesCB.setEnabled(enabled);
259:            }
260:
261:            public void showPanel(NodeEditorPanel panel) {
262:                editorPanel = panel;
263:                setTitle(panel.getTitle());
264:                panel.setNodeName(origNodeName);
265:                detailsPanel.setViewportView(panel);
266:                detailsPanel.validate();
267:            }
268:
269:            public void setReadOnly(boolean readOnly) {
270:                this .readOnly = readOnly;
271:                applyButton.setEnabled(!readOnly);
272:                cancelButton.setEnabled(!readOnly);
273:            }
274:
275:            /**
276:             * Set the title of the container
277:             */
278:            public void setTitle(String title) {
279:                super .setTitle(title);
280:            }
281:
282:            // Variables declaration - do not modify//GEN-BEGIN:variables
283:            private javax.swing.JPanel jPanel2;
284:            private javax.swing.JPanel jPanel1;
285:            private javax.swing.JCheckBox showCapabilitiesCB;
286:            private javax.swing.JTextField sceneNameTF;
287:            private javax.swing.JScrollPane detailsPanel;
288:            private javax.swing.JTextField nodeNameTF;
289:            private javax.swing.JButton cancelButton;
290:            private javax.swing.JPanel capabilityContainer;
291:            private javax.swing.JLabel jLabel2;
292:            private javax.swing.JLabel jLabel1;
293:            private javax.swing.JButton applyButton;
294:            // End of variables declaration//GEN-END:variables
295:
296:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.