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


001:        /*
002:         *  $Header: /cvs/j3dfly/J3dFly/src/org/jdesktop/j3dfly/plugins/VPOrbitBehaviorPlugin.java,v 1.1 2005/04/20 21:04:46 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 Java 3D(tm) Fly Through.
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.j3dfly.plugins;
019:
020:        import org.jdesktop.j3dfly.J3dFlyContext;
021:        import org.jdesktop.j3dfly.J3dFlyController;
022:        import org.jdesktop.j3dfly.event.VPBehaviorPluginEvent;
023:        import org.jdesktop.j3dfly.event.CollisionEnableEvent;
024:        import org.jdesktop.j3dfly.utils.vpbehaviors.VPDefaultCollision;
025:        import org.jdesktop.j3dfly.utils.vpbehaviors.VPDriveCollision;
026:
027:        import javax.media.j3d.BoundingSphere;
028:        import javax.vecmath.Point3d;
029:
030:        import com.sun.j3d.utils.behaviors.vp.OrbitBehavior;
031:
032:        /**
033:         * This is a Template for a J3dFly Plugin.
034:         *
035:         * To make it easy to generate comlex menu's for a plugin this code
036:         * 'tricks' Netbeans into thinking this is a GUI component and hence
037:         * allows the Netbeans GUI editor to be used to edit the menu.
038:         *
039:         * @author  Paul Byrne
040:         * @version $Revision: 1.1 $
041:         */
042:        public class VPOrbitBehaviorPlugin extends VPBehaviorPlugin {
043:
044:            private java.lang.ref.SoftReference panelReference = null;
045:
046:            /** Creates new form PluginTemplate */
047:            public VPOrbitBehaviorPlugin() {
048:                super ();
049:            }
050:
051:            /** This method is called from within the constructor to
052:             * initialize the form.
053:             * WARNING: Do NOT modify this code. The content of this method is
054:             * always regenerated by the Form Editor.
055:             */
056:            private void initComponents() {//GEN-BEGIN:initComponents
057:                menuBar = new javax.swing.JMenuBar();
058:                pluginMenu = new javax.swing.JMenu();
059:
060:                pluginMenu.setText("Menu");
061:                menuBar.add(pluginMenu);
062:
063:            }//GEN-END:initComponents
064:
065:            /**
066:             * Returns the control panel for this plugin, or null if there
067:             * is no control panel
068:             */
069:            public javax.swing.JPanel getControlPanel() {
070:
071:                // Uncomment this code and change XXXX to instantiate the panel for
072:                // this Plugin if it has one, otherwise return null
073:
074:                //if (panelReference==null || panelReference.get()==null )
075:                //    panelReference = new java.lang.ref.SoftReference( new XXXXX() );
076:
077:                //return (javax.swing.JPanel)panelReference.get();
078:
079:                return null;
080:            }
081:
082:            public String getMenuString() {
083:                return "Orbit";
084:            }
085:
086:            /**
087:             * Install the plugin and add it's menu item to the menu
088:             */
089:            public void installPlugin(PluginPreference pluginPref,
090:                    J3dFlyContext j3dflyContext) {
091:                super .installPlugin(pluginPref, j3dflyContext);
092:                pluginPref.getContext().getEventProcessor().postEvent(
093:                        new VPBehaviorPluginEvent(this ,
094:                                VPBehaviorPluginEvent.INSTALLED));
095:            }
096:
097:            /**
098:             * Uninstall this plugin
099:             */
100:            public void uninstallPlugin() {
101:                super .uninstallPlugin();
102:                pluginPref.getContext().getEventProcessor().postEvent(
103:                        new VPBehaviorPluginEvent(this ,
104:                                VPBehaviorPluginEvent.UNINSTALLED));
105:            }
106:
107:            /**
108:             * Returns the class of the plugin preference.
109:             *
110:             * Plugins that require more preference information should provide a
111:             * subclass of PluginPrefernece that contains all the extra preference
112:             * data. This class must be Serializable.
113:             */
114:            public Class getPluginPreferenceClass() {
115:                return VPOrbitBehaviorPluginPreference.class;
116:            }
117:
118:            /**
119:             * Called to set this behavior to be active or inactive.
120:             * 
121:             * Only one VP Behavior can be active at a given time. This is managed
122:             * by J3dFlyController
123:             */
124:            public void setActive(boolean active) {
125:                super .setActive(active);
126:
127:                J3dFlyController control = pluginPref.getContext().getJ3dFly()
128:                        .getController();
129:
130:                if (active) {
131:                    OrbitBehavior orbit = new com.sun.j3d.utils.behaviors.vp.OrbitBehavior(
132:                            pluginPref.getContext().getUniverse().getCanvas(),
133:                            OrbitBehavior.REVERSE_ROTATE
134:                                    | OrbitBehavior.REVERSE_TRANSLATE);
135:                    orbit.setSchedulingBounds(new BoundingSphere(new Point3d(),
136:                            Double.POSITIVE_INFINITY));
137:                    BoundingSphere worldBounds = pluginPref.getContext()
138:                            .getJ3dFly().getController().getWorldBounds();
139:                    if (worldBounds != null) {
140:                        Point3d center = new Point3d();
141:                        worldBounds.getCenter(center);
142:                        orbit.setRotationCenter(center);
143:                    }
144:                    pluginPref.getContext().getUniverse().getViewingPlatform()
145:                            .setViewPlatformBehavior(orbit);
146:
147:                    pluginPref.getContext().getEventProcessor().postEvent(
148:                            new VPBehaviorPluginEvent(this ,
149:                                    VPBehaviorPluginEvent.ACTIVATED));
150:                } else {
151:                    pluginPref.getContext().getEventProcessor().postEvent(
152:                            new VPBehaviorPluginEvent(this ,
153:                                    VPBehaviorPluginEvent.DEACTIVATED));
154:                }
155:            }
156:
157:            /**
158:             * Return the Icon for the toolbar button
159:             */
160:            public javax.swing.Icon getToolbarIcon() {
161:                return new javax.swing.ImageIcon(getClass().getResource(
162:                        "/org/jdesktop/j3dfly/icons/orbitIcon.gif"));
163:            }
164:
165:            /**
166:             * Return the tooltip string for the Menu and Toolbar
167:             */
168:            public String getTooltipText() {
169:                return "Orbit Behavior";
170:            }
171:
172:            public static class VPOrbitBehaviorPluginPreference extends
173:                    PluginPreference {
174:                public VPOrbitBehaviorPluginPreference() {
175:                    super ();
176:                }
177:
178:                public VPOrbitBehaviorPluginPreference(boolean enabled,
179:                        boolean installed) {
180:                    super (enabled, installed);
181:                }
182:
183:                public J3dFlyPlugin instantiatePlugin() {
184:                    return new VPOrbitBehaviorPlugin();
185:                }
186:
187:                /**
188:                 * Return a description of this plugin
189:                 */
190:                public String getDescription() {
191:                    return "A Viewing Platform Orbit behavior";
192:                }
193:
194:                /**
195:                 * Return the name of the Plugin for this prefernece.
196:                 * This is the name that will appear in the list of plugins
197:                 */
198:                public String getName() {
199:                    return "VP Orbit Behavior";
200:                }
201:
202:            }
203:
204:            // Variables declaration - do not modify//GEN-BEGIN:variables
205:            private javax.swing.JMenuBar menuBar;
206:            private javax.swing.JMenu pluginMenu;
207:            // End of variables declaration//GEN-END:variables
208:
209:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.