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


001:        /*
002:         *  $Header: /cvs/j3dfly/J3dEditor/src/org/jdesktop/j3dedit/scenegraph/SGNodeComponent.java,v 1.1 2005/04/20 22:20:41 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.scenegraph;
019:
020:        import java.util.ArrayList;
021:
022:        /**
023:         *
024:         * Represents a Java3D NodeComponent
025:         *
026:         * @author  paulby
027:         * @version $id$
028:         */
029:        public class SGNodeComponent extends SGObject {
030:
031:            private ArrayList referencedBy;
032:
033:            /**
034:             * Creates a node component and registers it with SceneGraphControl
035:             */
036:            public SGNodeComponent(javax.media.j3d.NodeComponent nc,
037:                    org.jdesktop.j3dedit.J3dEditContext editContext) {
038:                super (editContext);
039:
040:                if (nc == null)
041:                    throw new RuntimeException("NodeComponent is null " + this );
042:
043:                j3dNode = nc;
044:                referencedBy = new ArrayList();
045:                editContext.getSceneGraphControl().addNodeComponent(this );
046:            }
047:
048:            /**
049:             * Set the Java3D which is represented by this object
050:             *
051:             * Store the capability bits for the node
052:             */
053:            public void setJ3dNode(javax.media.j3d.NodeComponent node) {
054:                if (node == null) {
055:                    System.out.println("Null node component " + this );
056:                    Thread.dumpStack();
057:                }
058:                j3dNode = node;
059:                capabilities.storeCapabilities(node);
060:            }
061:
062:            /**
063:             * Get the Java3D node represented by this object
064:             */
065:            public javax.media.j3d.NodeComponent getJ3dNode() {
066:                return (javax.media.j3d.NodeComponent) j3dNode;
067:            }
068:
069:            /**
070:             * Return the Locale to which this node is connected
071:             */
072:            public javax.media.j3d.Locale getLocale() {
073:                throw new RuntimeException("Not Implemented");
074:            }
075:
076:            /**
077:             * Is this node live
078:             */
079:            public boolean isLive() {
080:                return context.getLocale().getLive();
081:            }
082:
083:            /**
084:             * Change the live state of this node, this may change the live
085:             * state of other nodes in the graph, but in general the minimum
086:             * change will be made
087:             */
088:            public void setLive(boolean live) {
089:                context.getLocale().setLive(live);
090:            }
091:
092:            /**
093:             * Add node to the list of objects that reference this node component
094:             **
095:             * @param node The Node or NodeComponent to add
096:             */
097:            public void addReferencedBy(SGObject node) {
098:                referencedBy.add(node);
099:            }
100:
101:            /**
102:             * Remove node from the list of objects that reference this node component.
103:             * Once the node is not referenced by any other objects it will be destroyed
104:             *
105:             * @param node The Node or NodeComponent to remove
106:             */
107:            public void removeReferencedBy(SGObject node) {
108:                if (!referencedBy.remove(node))
109:                    org.jdesktop.j3dfly.utils.gui.ErrorManager
110:                            .getDefault()
111:                            .notify(
112:                                    new RuntimeException(
113:                                            "Removing non-existant Reference"),
114:                                    org.jdesktop.j3dfly.utils.gui.ErrorHandler.INFORMATIONAL);
115:
116:                // TODO CHeck what other java 'pointers' we need to clear to enable GC
117:                if (referencedBy.size() == 0) {
118:                    getContext().getSceneGraphControl().removeNodeComponent(
119:                            this );
120:                    j3dNode = null; // This MUST be after removeNodeComponent
121:                }
122:            }
123:
124:            /**
125:             * Returns the set of SGObjects that reference this node component
126:             */
127:            public SGObject[] getReferencedBy() {
128:                return (SGObject[]) referencedBy
129:                        .toArray(new SGObject[referencedBy.size()]);
130:            }
131:
132:            /**
133:             * Returns the number of objects that reference this node component
134:             */
135:            public int getReferencedByCount() {
136:                return referencedBy.size();
137:            }
138:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.