Source Code Cross Referenced for PluginPreference.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/PluginPreference.java,v 1.1 2005/04/20 21:04: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 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 java.beans.*;
022:
023:        /**
024:         * Base class for all Plugin Preferences. All the methods in PluginPreferences
025:         * which follow the Bean pattern naming convention will have their state
026:         * saved in the xml preference files.
027:         *
028:         * If you don't want the state of a property saved in the preference file then
029:         * either don't use the Bean naming pattern or mark the property as transient.
030:         * Note the transient keyword has no effect on the XMLEncoder,
031:         * instead you need to set the a Property of transient=True in the
032:         * property descriptor. THis is done automatically for this class
033:         * in the PluginPreferenceControl, however if you create a subclass
034:         * that uses transient data you will have to create a BeanInfo class
035:         * and set the appropriate properties.
036:         *
037:         * @author  Paul Byrne
038:         * @version $Revision: 1.1 $
039:         */
040:        public abstract class PluginPreference extends Object implements 
041:                java.io.Serializable {
042:
043:            /** When a plugin is enabled it's gui is active and
044:             * it has an effect on the scene graph. When it's not enabled it
045:             * should have NO effect on the scene graph.
046:             */
047:            protected boolean enabled = true;
048:
049:            /** An installed Plugin appears in the set of installed plugins and
050:             *  it GUI components will be installed, unless it's enabled it will
051:             *  have no effect on the scene graph
052:             */
053:            protected boolean installed = true;
054:
055:            /**
056:             * Should this plugin install itself in the menubar
057:             */
058:            protected boolean installInMenu = true;
059:
060:            /**
061:             * The plugin instantiated from these preferences
062:             */
063:            protected transient J3dFlyPlugin plugin = null;
064:
065:            protected transient J3dFlyContext context = null;
066:
067:            /**
068:             * Indicates where this Plugin was installed from
069:             * either SYSTEM, USER or FILE
070:             */
071:            protected transient int installedFrom;
072:            public static final int SYSTEM = 1;
073:            public static final int USER = 2;
074:            public static final int FILE = 3;
075:            public static final int LOADER = 4;
076:
077:            /** Creates new PluginPreference */
078:            public PluginPreference() {
079:                enabled = true;
080:                installed = true;
081:            }
082:
083:            public PluginPreference(boolean enabled, boolean installed) {
084:                this .enabled = enabled;
085:                this .installed = installed;
086:            }
087:
088:            /** Getter for property enabled.
089:             * @return Value of property enabled.
090:             */
091:            public boolean isEnabled() {
092:                return enabled;
093:            }
094:
095:            /** Setter for property enabled.
096:             * @param enabled New value of property enabled.
097:             */
098:            public void setEnabled(boolean enabled) {
099:                this .enabled = enabled;
100:                if (plugin != null)
101:                    plugin.setEnabled(enabled);
102:            }
103:
104:            /** Getter for property installed.
105:             * @return Value of property installed.
106:             */
107:            public boolean isInstalled() {
108:                return installed;
109:            }
110:
111:            /** 
112:             * Install the plugin.
113:             *
114:             * Note this method also set the installed property.
115:             * When the preference is loaded from the xml preference
116:             * files the installed property will be set, however the
117:             * PluginPreferenceControl will still call setInstalled(true)
118:             * later to actually install the plugin.
119:             *
120:             * @param installed New value of property installed.
121:             */
122:            public void setInstalled(boolean installed) {
123:                this .installed = installed;
124:                if (installed) {
125:                    if (plugin == null)
126:                        plugin = instantiatePlugin();
127:                    plugin.installPlugin(this , context);
128:                } else {
129:                    if (plugin != null)
130:                        plugin.uninstallPlugin();
131:                }
132:            }
133:
134:            /**
135:             * Set the context for this plugin
136:             */
137:            public void setContext(J3dFlyContext context) {
138:                this .context = context;
139:            }
140:
141:            public J3dFlyContext getContext() {
142:                return context;
143:            }
144:
145:            /**
146:             * Set where this plugin was installed from
147:             * either SYSTEM, USER or FILE
148:             */
149:            public void setInstalledFrom(int from) {
150:                installedFrom = from;
151:            }
152:
153:            /**
154:             * Returns where this plugin was installed from
155:             * either SYSTEM, USER or FILE
156:             */
157:            public int getInstalledFrom() {
158:                return installedFrom;
159:            }
160:
161:            /**
162:             * Returns where this plugin was installed from in String form
163:             * either System, Usert or File
164:             */
165:            public String getInstalledFromStr() {
166:                switch (installedFrom) {
167:                case 1:
168:                    return "System";
169:                case 2:
170:                    return "User";
171:                case 3:
172:                    return "File";
173:                case 4:
174:                    return "Loader";
175:                }
176:
177:                throw new RuntimeException("Invalid InstallFrom setting "
178:                        + this );
179:            }
180:
181:            /**
182:             * Instiate and return the Plugin
183:             *
184:             * May return null if plugin is unavailable
185:             */
186:            public abstract J3dFlyPlugin instantiatePlugin();
187:
188:            /**
189:             * Return the name of the Plugin for this prefernece.
190:             * This is the name that will appear in the list of plugins
191:             */
192:            public abstract String getName();
193:
194:            /** 
195:             * Return a description of this plugin
196:             */
197:            public abstract String getDescription();
198:
199:            /**
200:             * Return the plugin instantiated from this preference
201:             */
202:            public J3dFlyPlugin getPlugin() {
203:                return plugin;
204:            }
205:
206:            /**
207:             * Set if this plugin should install itself in the menubar
208:             */
209:            public void setInstallInMenu(boolean install) {
210:                installInMenu = install;
211:            }
212:
213:            /**
214:             * Should this plugin installed itself in the menu bar
215:             */
216:            public boolean isInstallInMenu() {
217:                return installInMenu;
218:            }
219:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.