Source Code Cross Referenced for XEditorPlugin.java in  » XML-UI » XUI » net » xoetrope » builder » editor » plugin » 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 » XML UI » XUI » net.xoetrope.builder.editor.plugin 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.xoetrope.builder.editor.plugin;
002:
003:        import java.util.Hashtable;
004:        import java.util.Vector;
005:
006:        import java.awt.AWTEvent;
007:        import java.awt.Component;
008:        import java.awt.Frame;
009:        import javax.swing.JDialog;
010:        import javax.swing.JFrame;
011:        import javax.swing.JMenu;
012:        import javax.swing.JMenuItem;
013:        import javax.swing.JPanel;
014:        import javax.swing.event.MenuEvent;
015:
016:        import net.xoetrope.builder.editor.XEditorProject;
017:        import net.xoetrope.builder.editor.XPageResource;
018:        import net.xoetrope.builder.editor.components.PropertyHelper;
019:        import java.awt.Color;
020:
021:        /**
022:         * An abstract base class from which to build editor plugins. The plugins can
023:         * interact with the editor in a number of different ways including appearing
024:         * as dialogs, property windows or tab panes.
025:         * <p> Copyright (c) Xoetrope Ltd., 2002-2003</p>
026:         * <p> $Revision: 1.16 $</p>
027:         * <p> License: see License.txt</p>
028:         */
029:        public abstract class XEditorPlugin implements  Comparable {
030:            public static final int PROJECT_PLUGIN = 0;
031:            public static final int PAGE_EDITOR = 1;
032:            public static final int PROPERTY_EDITOR = 3;
033:
034:            public static final int UNINITIALIZED = 0;
035:            public static final int CREATED = 1;
036:            public static final int LOADED = 2;
037:            public static final int ACTIVATED = 3;
038:            public static final int DEACTIVATED = 4;
039:            public static final int CLOSED = 5;
040:
041:            public abstract void setFrame(JFrame appFrame);
042:
043:            protected String pluginUrl = "";
044:
045:            private Color pluginTabBackground = null;
046:            private Color pluginTabForeground = null;
047:
048:            /**
049:             * Get the name of the plugin as it will appear on the plugin menu
050:             * @return the short name
051:             */
052:            public abstract String getName();
053:
054:            /**
055:             * Get the names of the deployment jar file that house the plugin's runtime
056:             * components
057:             * @return the short name of the jar file
058:             */
059:            public abstract String[] getDeploymentJarNames();
060:
061:            public abstract int getPluginType();
062:
063:            /**
064:             * Get the url for the plugin's jar file
065:             * @return the plugin url string
066:             */
067:            public String getPluginUrl() {
068:                return pluginUrl;
069:            }
070:
071:            /**
072:             * Set the url for the plugin's jar file
073:             * @param the new plugin url string
074:             */
075:            public void setPluginUrl(String newUrl) {
076:                pluginUrl = newUrl;
077:            }
078:
079:            /**
080:             * Gets the main menu to show on the main menu bar
081:             * @return
082:             */
083:            public abstract JMenu getMenu();
084:
085:            /**
086:             * Get the menuItem or the sub menu that plugs into the plugins menu.
087:             * @return the JMenu or JMenuItem or null if no menu is being provided. If no
088:             * menu is provided then the plugins menu item will be derived from the plugin name
089:             * and will activate or deactive the plugin.
090:             */
091:            public abstract JMenuItem getPluginMenu();
092:
093:            /**
094:             * Get the menuItem or the sub menu that plugs into the context/popup menu for
095:             * the selected components. The functions on this menu should all operate on
096:             * the selection or individual component selecte.
097:             * @return the JMenu or JMenuItem or null if no menu is being provided.
098:             */
099:            public abstract JMenuItem getContextMenu();
100:
101:            /**
102:             * Get the panel that will plug into the main panel. The panel will be given a
103:             * tab of its own on the editor's tabbar
104:             * @return the main panel or null for no panel
105:             */
106:            public abstract JPanel getMainPanel();
107:
108:            /**
109:             * Gets the dialog for this plugin. The dialog must be modal. Once dismissed
110:             * no further interaction with the plugin should take place
111:             * @param applicationFrame the main application fram
112:             * @return the dialog
113:             */
114:            public abstract JDialog getDialog(Frame applicationFrame);
115:
116:            /**
117:             * Get the panel that plugs into the right hand side splitter of the editor.
118:             * The panel is intended to allow property editors to be located alongside the
119:             * componen designer
120:             * @return the panel or null if this plugin doesn't offer such a facility
121:             */
122:            public abstract JPanel getPropertiesPanel();
123:
124:            /**
125:             * Get an array of components to add to the toolbar
126:             * @return
127:             */
128:            public abstract Component[] getToolbarComponents();
129:
130:            /**
131:             * Get the name used on the tabbar for a plugin's components
132:             * @return the tab name
133:             */
134:            public abstract String getToolbarName();
135:
136:            /**
137:             * Get a flag indicating if the plugin creates a dialog
138:             * @return true if the plugin presents a dialog
139:             */
140:            public abstract boolean isDialogPlugin();
141:
142:            /**
143:             * Process a menu commands for a plugin
144:             * @param command the command id
145:             * @param evt the original event
146:             * @param selected the selected state of the toolbar or menu item or false if no state exists
147:             */
148:            public abstract int processCommand(int command, AWTEvent evt,
149:                    boolean selected);
150:
151:            /**
152:             * Tells the plugin to save its data
153:             * @return 0 for success, non zero otherwise
154:             */
155:            public abstract int save();
156:
157:            public abstract void setActiveProject(XEditorProject project);
158:
159:            public abstract void setActivePage(XPageResource page);
160:
161:            public abstract void setActiveComponents(Vector comps);
162:
163:            /**
164:             * Compares this XEditorPlugin to another Object.  If the Object is a XEditorPlugin,
165:             * this function behaves like <code>compareTo(String)</code>.  Otherwise,
166:             * it throws a <code>ClassCastException</code> (as XEditorPlugin are comparable
167:             * only to other XEditorPlugin).
168:             *
169:             * @param   o the <code>Object</code> to be compared.
170:             * @return  the value <code>0</code> if the plugin whose name
171:             *		lexicographically equal to this plugin's name; a value less than
172:             *		<code>0</code> if the argument is a name lexicographically
173:             *		greater than this plugin's name; and a value greater than
174:             *		<code>0</code> if the argument is a name lexicographically
175:             *		less than this plugin's name.
176:             * @exception <code>ClassCastException</code> if the argument is not a
177:             *		  <code>XEditorPlugin</code>.
178:             * @see     java.lang.Comparable
179:             */
180:            public int compareTo(Object o) {
181:                return getName().compareTo(((XEditorPlugin) o).getName());
182:            }
183:
184:            /**
185:             * Set the activation/deactivation state of the plugin
186:             * @param newState the new state
187:             */
188:            public abstract void setState(int newState);
189:
190:            /**
191:             * Get the activation/deactivation state of the plugin
192:             */
193:            public abstract int getState();
194:
195:            public abstract void cut();
196:
197:            public abstract void copy();
198:
199:            public abstract void paste();
200:
201:            public abstract void delete();
202:
203:            public void menuSelected(MenuEvent e) {
204:            }
205:
206:            /**
207:             * Get a set of attributes belonging to this page.
208:             * @param thePage the page whos attributes are being requested
209:             * @return a Hashtable of keys and values or null if none are provided
210:             */
211:            public Hashtable getPageAttributes(XPageResource thePage) {
212:                return null;
213:            }
214:
215:            /**
216:             * Get a set of attributes belonging to this component.
217:             * @param comp the component whos attributes are being requested
218:             * @return a Hashtable of keys and values or null if none are provided
219:             */
220:            public Hashtable getComponentAttributes(Component comp) {
221:                return null;
222:            }
223:
224:            /**
225:             * Get the tab color
226:             * @param foreGround true for the foreground color, false for the background color.
227:             * @return the color or null for the default
228:             */
229:            public Color getTabColor(boolean foreGround) {
230:                return foreGround ? pluginTabForeground : pluginTabBackground;
231:            }
232:
233:            /**
234:             * Set the tab color
235:             * @param foreGround true for the foreground color, false for the background color.
236:             * @param clr the color
237:             */
238:            public void setTabColor(boolean foreGround, Color clr) {
239:                if (foreGround)
240:                    pluginTabForeground = clr;
241:                else
242:                    pluginTabBackground = clr;
243:            }
244:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.