001: package com.xoetrope.editor.netbeans.wizard;
002:
003: import java.awt.BorderLayout;
004: import java.awt.Container;
005: import java.awt.Image;
006: import java.net.URL;
007: import javax.swing.JMenuBar;
008: import javax.swing.JPanel;
009: import net.xoetrope.swing.SwingWidgetAdapter;
010: import net.xoetrope.xui.XProject;
011: import net.xoetrope.editor.project.XEditorProject;
012: import net.xoetrope.editor.project.XEditorProjectManager;
013: import net.xoetrope.xui.XApplicationContext;
014: import net.xoetrope.xui.XStartupObject;
015: import org.openide.windows.CloneableTopComponent;
016:
017: /**
018: * A TopComponent for holding/hosting a XUI wizard applications
019: *
020: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
021: * the GNU Public License (GPL), please see license.txt for more details. If
022: * you make commercial use of this software you must purchase a commercial
023: * license from Xoetrope.</p>
024: * <p> $Revision: 1.8 $</p>
025: */
026: public abstract class XuiTopComponent extends CloneableTopComponent
027: implements XStartupObject {
028: /** The project that initiated this session */
029: protected XProject ownerProject;
030:
031: /** The wizard's own project */
032: protected XProject currentProject;
033:
034: /** The root panel for adding things */
035: protected JPanel contentPane;
036:
037: /** The wizards context */
038: protected XApplicationContext applicationContext;
039:
040: /**
041: * Creates a new instance of XuiTopComponent
042: */
043: public XuiTopComponent(Class ownerClass, String projectXuiFile,
044: String xuiStartupFile) {
045: ClassLoader cl = ownerClass.getClassLoader();
046: String startupFile = cl.getResource(xuiStartupFile).getFile()
047: .toString();
048: String xuiFile = cl.getResource(projectXuiFile).getFile()
049: .toString();
050: String[] args = new String[1];
051: args[0] = startupFile;
052:
053: setLayout(new BorderLayout());
054: contentPane = new JPanel();
055: contentPane.setLayout(new BorderLayout());
056: add(contentPane, BorderLayout.CENTER);
057:
058: currentProject = (XEditorProject) XEditorProjectManager
059: .getProject(cl, xuiFile, startupFile, false);
060: SwingWidgetAdapter.getInstance();
061: applicationContext = new XApplicationContext(this ,
062: "com.xoetrope.editor.carousel.wizard.XTarget", args);
063: }
064:
065: public Container getParent() {
066: return super .getParent();
067: }
068:
069: public URL getDocumentBase() {
070: return null;
071: }
072:
073: public void refresh() {
074: invalidate();
075: validate();
076: repaint();
077: }
078:
079: public void setAppTitle(String title) {
080: setDisplayName(title);
081: }
082:
083: public void setIcon(Image img) {
084: }
085:
086: public void setupWindow(XProject project, int clientWidth,
087: int clientHeight) {
088: setVisible(true);
089:
090: ownerProject.setApplet(null);
091: ownerProject.setStartupObject(null);
092: ownerProject.setAppFrame(null);
093: ownerProject.setAppWindow(null);
094: }
095:
096: /**
097: * Setup the initial menubar
098: */
099: protected JMenuBar createMenuBar() {
100: return null;
101: }
102:
103: public Container getContentPane() {
104: return contentPane;
105: }
106:
107: /**
108: * Get a startup parameter
109: * @param param the name of the parameter
110: */
111: public String getParameter(String param) {
112: return "";
113: }
114:
115: public abstract int getPersistenceType();
116:
117: public abstract String preferredID();
118:
119: /**
120: * Restore the normal page views, as in the case of the docking layout where
121: * panels may be zoomed or minimized. This method is called prior to the
122: * display of a new page.
123: */
124: public void restoreViews() {
125: }
126: }
|