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