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


001:        /*
002:         *  $Header: /cvs/j3dfly/J3dEditor/src/org/jdesktop/j3dedit/scenegrapheditor/InterposerListener.java,v 1.1 2005/04/20 22:20:44 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;
019:
020:        import javax.media.j3d.BranchGroup;
021:        import javax.media.j3d.Group;
022:        import javax.media.j3d.Locale;
023:
024:        import org.jdesktop.j3dedit.interposerext.InterposerListenerInterface;
025:
026:        import org.jdesktop.j3dedit.J3dEditContext;
027:        import org.jdesktop.j3dedit.interposer.InterposerLocale;
028:        import org.jdesktop.j3dedit.scenegraph.SGGroup;
029:        import org.jdesktop.j3dfly.utils.developmenttools.DevelopmentLocale;
030:
031:        /**
032:         *
033:         * @author  Paul Byrne
034:         * @version $Id: InterposerListener.java,v 1.1 2005/04/20 22:20:44 paulby Exp $
035:         */
036:        public class InterposerListener implements  InterposerListenerInterface {
037:
038:            private final static boolean DEBUG_CALLS = false;
039:
040:            private J3dEditContext context;
041:
042:            /** Creates a new instance of InterposerListener */
043:            public InterposerListener() {
044:            }
045:
046:            public void setContext(J3dEditContext context) {
047:                this .context = context;
048:            }
049:
050:            public void localeAddBranchGraph(Object locale, Object bg) {
051:                if (DEBUG_CALLS)
052:                    System.out.println("localeAddBranchGraph " + locale + "   "
053:                            + bg);
054:
055:                if (context == null) {
056:                    System.out
057:                            .println("Context is null in localeAddBranchGraph*************");
058:                    return;
059:                }
060:
061:                DevelopmentLocale interposerLocale = getInterposerLocale((Locale) locale);
062:
063:                if (interposerLocale == null) {
064:                    System.out.println("MULTIPLE LOCALES*********************");
065:                    interposerLocale = new InterposerLocale(
066:                            (javax.media.j3d.Locale) locale);
067:                    context.addLocale(interposerLocale);
068:                    interposerLocale
069:                            .setSceneGraphChangeListeners(((InterposerLocale) context
070:                                    .getLocale(0))
071:                                    .getSceneGraphChangeListeners());
072:                }
073:
074:                // Need the if check because the locale may be a DevelopmentLocale
075:                if (interposerLocale instanceof  InterposerLocale)
076:                    interposerLocale.addBranchGraph((BranchGroup) bg);
077:            }
078:
079:            private DevelopmentLocale getInterposerLocale(Locale realLocale) {
080:                if (realLocale == null)
081:                    return null;
082:
083:                if (realLocale instanceof  DevelopmentLocale)
084:                    return (DevelopmentLocale) realLocale;
085:
086:                Locale locale;
087:
088:                for (int i = 0; i < context.numLocales(); i++) {
089:                    locale = context.getLocale(i);
090:                    if (locale instanceof  InterposerLocale
091:                            && ((InterposerLocale) locale).getActualLocale() == realLocale)
092:                        return (InterposerLocale) locale;
093:                }
094:
095:                return null;
096:            }
097:
098:            public void localeRemoveBranchGraph(Object locale, Object bg) {
099:                if (DEBUG_CALLS)
100:                    System.out.println("localeRemoveBranchGraph " + bg);
101:
102:                DevelopmentLocale interposerLocale = getInterposerLocale((Locale) locale);
103:                if (interposerLocale != null
104:                        && interposerLocale instanceof  InterposerLocale) {
105:                    interposerLocale.removeBranchGraph((BranchGroup) bg);
106:                }
107:            }
108:
109:            public void groupAddChild(Object group, Object child) {
110:                // Only interested in add's to live nodes.
111:                if (!((Group) group).isLive())
112:                    return;
113:
114:                if (DEBUG_CALLS)
115:                    System.out.println("groupAddChild " + child);
116:
117:                DevelopmentLocale locale = getLocale(group);
118:                if (locale == null)
119:                    return;
120:                // This method is called before before the actual addChild
121:                // takes place, so group is live, but child is not live
122:                locale.notifyGroupAddChild((Group) group, (BranchGroup) child);
123:            }
124:
125:            public void groupSetChild(Object group, Object child, int index) {
126:                if (!((Group) group).isLive())
127:                    return;
128:
129:                if (DEBUG_CALLS)
130:                    System.out.println("groupSetChild " + child);
131:
132:                DevelopmentLocale locale = getLocale(group);
133:                if (locale == null)
134:                    return;
135:
136:                locale.notifyGroupSetChild((Group) group, (BranchGroup) child,
137:                        index);
138:            }
139:
140:            public void groupRemoveAllChildren(Object group) {
141:                if (!((Group) group).isLive())
142:                    return;
143:
144:                if (DEBUG_CALLS)
145:                    System.out.println("groupRemoveAllChildren " + group);
146:
147:                DevelopmentLocale locale = getLocale(group);
148:                if (locale == null)
149:                    return;
150:
151:                locale.notifyGroupRemoveAllChildren((Group) group);
152:            }
153:
154:            public void groupRemoveChild(Object group, Object child) {
155:                if (!((Group) group).isLive())
156:                    return;
157:
158:                if (DEBUG_CALLS)
159:                    System.out.println("groupRemoveChild " + child);
160:
161:                DevelopmentLocale locale = getLocale(group);
162:                if (locale == null)
163:                    return;
164:
165:                locale.notifyGroupRemoveChild((Group) group,
166:                        (BranchGroup) child);
167:            }
168:
169:            public void groupRemoveChild(Object group, int childIndex) {
170:                if (!((Group) group).isLive())
171:                    return;
172:
173:                if (DEBUG_CALLS)
174:                    System.out.println("groupAddChild "
175:                            + ((Group) group).getChild(childIndex));
176:
177:                DevelopmentLocale locale = getLocale(group);
178:                if (locale == null)
179:                    return;
180:
181:                // TODO - figure out which child is being removed
182:                locale.notifyGroupRemoveChild((Group) group,
183:                        (BranchGroup) ((Group) group).getChild(childIndex));
184:            }
185:
186:            private DevelopmentLocale getLocale(Object node) {
187:                Locale l = context.getSceneGraphControl().getLocale(
188:                        (javax.media.j3d.Node) node);
189:
190:                return getInterposerLocale(l);
191:            }
192:
193:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.