Source Code Cross Referenced for NodeEditorPanel.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/NodeEditorPanel.java,v 1.1 2005/04/20 22:21:01 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 java.awt.Frame;
021:        import javax.swing.JPanel;
022:        import javax.media.j3d.Node;
023:        import java.io.*;
024:
025:        import org.jdesktop.j3dedit.scenegraph.SGNode;
026:        import org.jdesktop.j3dedit.scenegraph.SGObject;
027:
028:        /**
029:         * Superclass for all node Editors
030:         * @author Paul Byrne
031:         * @version	1.10, 01/18/02
032:         */
033:        public abstract class NodeEditorPanel extends JPanel {
034:
035:            /**
036:             * Reference to node which is being edited
037:             */
038:            protected SGNode node;
039:
040:            /*
041:             * Frame containing this panel
042:             */
043:            protected EditorPanelContainer parentFrame;
044:
045:            protected static int[] readCapabilities;
046:
047:            protected static int[] writeCapabilities;
048:
049:            /**
050:             * Title that will appear in the frame containing this panel
051:             */
052:            protected String frameTitle;
053:
054:            /**
055:             * Set true each time user changes GUI values
056:             */
057:            private boolean updateFlag;
058:            protected boolean readOnly;
059:
060:            /**
061:             * Users name for this node
062:             */
063:            private String nodeName = null;
064:
065:            public NodeEditorPanel() {
066:                super ();
067:            }
068:
069:            public String getTitle() {
070:                return frameTitle;
071:            }
072:
073:            /**
074:             * Set the panel to be read only, user can navigate the contents but
075:             * can not make any changes.
076:             * 
077:             * Default action is to call setEnabled on all components in this
078:             * container
079:             */
080:            public void setReadOnly(boolean readOnly) {
081:                this .readOnly = readOnly;
082:
083:                for (int i = 0; i < getComponentCount(); i++)
084:                    getComponent(i).setEnabled(!readOnly);
085:            }
086:
087:            /**
088:             * Return the readOnly flag
089:             */
090:            public boolean getReadOnly() {
091:                return readOnly;
092:            }
093:
094:            /**
095:             * Start editing this node
096:             * Set the GUI components
097:             */
098:            public void startEdit(SGNode node, EditorPanelContainer frame) {
099:                this .node = node;
100:                parentFrame = frame;
101:                parentFrame.setTitle(frameTitle);
102:
103:                setControls();
104:            }
105:
106:            /**
107:             * Finish editing this node
108:             *
109:             * This will cause any SGObjectExtraData to be set in this nodes SGObject.
110:             */
111:            public void finishEdit() {
112:                node.setSGObjectExtraData(updateSGObjectExtraData(node
113:                        .getSGObjectExtraData()));
114:                parentFrame = null;
115:            }
116:
117:            /**
118:             * Set the capabilities of this node to the correct values
119:             * depending on the Editor mode.
120:             *
121:             * Node must not be live
122:             */
123:            public void setEditorCapabilities(Node node) {
124:                if (org.jdesktop.j3dedit.scenegrapheditor.PropertiesDialog.performanceLevel == org.jdesktop.j3dedit.scenegrapheditor.PropertiesDialog.READ_WRITE_ALLOWED) {
125:                    setReadWriteCapabilityBits(node);
126:                } else if (org.jdesktop.j3dedit.scenegrapheditor.PropertiesDialog.performanceLevel == org.jdesktop.j3dedit.scenegrapheditor.PropertiesDialog.READ_ALLOWED) {
127:                    setReadCapabilityBits(node);
128:                }
129:                // Don't set any capability bits for NONE_ALLOWED
130:            }
131:
132:            /**
133:             * Set the GUI controls to represent node
134:             * Store the state of the node so any subsequent changes
135:             * can be reset
136:             */
137:            protected abstract void setControls();
138:
139:            /**
140:             * Permanently apply the changes to the node
141:             */
142:            public abstract void applyChanges();
143:
144:            /**
145:             * Reset the changes to the state when setControls or applyChanges
146:             * was last called
147:             */
148:            public abstract void resetChanges();
149:
150:            protected abstract void setReadCapabilityBits(
151:                    javax.media.j3d.Node node);
152:
153:            protected abstract void setReadWriteCapabilityBits(
154:                    javax.media.j3d.Node node);
155:
156:            /**
157:             * Called by NodeState when the user applies changes
158:             * or when changes need applying
159:             */
160:            protected void setUpdateRequired(boolean update) {
161:
162:                if (parentFrame == null || updateFlag == update)
163:                    return;
164:
165:                updateFlag = update;
166:
167:                if (update)
168:                    parentFrame.setTitle(frameTitle + " (*)");
169:                else
170:                    parentFrame.setTitle(frameTitle);
171:
172:            }
173:
174:            /**
175:             * Returns true if the user has changed the state using the GUI
176:             */
177:            protected boolean getUpdateRequired() {
178:                return updateFlag;
179:            }
180:
181:            /**
182:             * If orig is not null then update it with the new information in the panel
183:             * If orig is null, and there is new information then create and return a
184:             * new SGObjectExtraData object
185:             */
186:            protected SGObjectExtraData updateSGObjectExtraData(
187:                    SGObjectExtraData orig) {
188:                return orig;
189:            }
190:
191:            /** Return the class which will store the extra data for this node type
192:             */
193:            public static Class getExtraDataClass() {
194:                return SGObjectExtraData.class;
195:            }
196:
197:            /**
198:             * Return a new SGObjectExtraData object of the correct type
199:             */
200:
201:            public SGObjectExtraData newSGObjectExtraData() {
202:                try {
203:                    return (SGObjectExtraData) getExtraDataClass()
204:                            .newInstance();
205:                } catch (Exception e) {
206:                    e.printStackTrace();
207:                    return null;
208:                }
209:            }
210:
211:            /**
212:             * Called by EditorFrame
213:             */
214:            public void setNodeName(String str) {
215:                nodeName = str;
216:                node.setNodeName(str);
217:            }
218:
219:            /**
220:             * Called by EditorFrame
221:             */
222:            public String getNodeName() {
223:                return nodeName;
224:            }
225:
226:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.