summaryrefslogtreecommitdiffstats
path: root/scripting/java/org/openoffice/netbeans/modules/office/wizard
diff options
context:
space:
mode:
authorTomas O'Connor <toconnor@openoffice.org>2003-01-16 16:51:45 +0000
committerTomas O'Connor <toconnor@openoffice.org>2003-01-16 16:51:45 +0000
commit07b4957c44d3b43b028a704329999be3e32e7ca2 (patch)
treee82f7388f1caeab8700e355c0599d128e245f101 /scripting/java/org/openoffice/netbeans/modules/office/wizard
parentIssueZilla 10518 - Add BeanShell support (diff)
downloadcore-07b4957c44d3b43b028a704329999be3e32e7ca2.tar.gz
core-07b4957c44d3b43b028a704329999be3e32e7ca2.zip
IssueZilla 10518 - Add BeanShell language support
Diffstat (limited to 'scripting/java/org/openoffice/netbeans/modules/office/wizard')
-rw-r--r--scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties25
-rw-r--r--scripting/java/org/openoffice/netbeans/modules/office/wizard/JavaScriptIterator.java280
-rw-r--r--scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelContentsIterator.java94
-rw-r--r--scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesPanel.java117
-rw-r--r--scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.form69
-rw-r--r--scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.java156
6 files changed, 673 insertions, 68 deletions
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties b/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties
index 4c089b7d3219..5095829d9245 100644
--- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties
+++ b/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties
@@ -23,28 +23,3 @@ TITLE_WizardPanel=Panel Name
# CallableSystemAction
LBL_Action=Run Action
-# Window System API
-
-# TopComponent
-LBL_component_name=<name of component>
-#LBL_mode_name=<name of mode>
-#LBL_workspace_name=<name of workspace>
-
-# WizardDescriptor
-# Dialog title:
-TITLE_wizard=My Wizard
-
-# WizardDescriptor.Iterator
-# Label the sequence #. Appears at top of pane:
-# e.g. "Panel Name (1 of 3)"
-TITLE_x_of_y={0} of {1}
-# Provide list of steps to show in left pane:
-#LBL_step_1=Select First Thing
-#LBL_step_2=Configure Details
-
-# WizardDescriptor.Panel
-# Will appear in dialog title; see above
-TITLE_WizardPanel=Panel Name
-
-# CallableSystemAction
-LBL_Action=Run Action
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/JavaScriptIterator.java b/scripting/java/org/openoffice/netbeans/modules/office/wizard/JavaScriptIterator.java
new file mode 100644
index 000000000000..c6b95d6069d1
--- /dev/null
+++ b/scripting/java/org/openoffice/netbeans/modules/office/wizard/JavaScriptIterator.java
@@ -0,0 +1,280 @@
+/*************************************************************************
+ *
+ * $RCSfile: JavaScriptIterator.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: toconnor $ $Date: 2003-01-16 17:51:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.netbeans.modules.office.wizard;
+
+import java.awt.Component;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import javax.swing.JComponent;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+import org.openide.ErrorManager;
+import org.openide.TopManager;
+import org.openide.NotifyDescriptor;
+import org.openide.WizardDescriptor;
+import org.openide.cookies.OpenCookie;
+import org.openide.cookies.SourceCookie;
+import org.openide.loaders.*;
+import org.openide.util.NbBundle;
+import org.openide.filesystems.*;
+
+import org.openoffice.idesupport.zip.ParcelZipper;
+import org.openoffice.netbeans.modules.office.loader.ParcelFolder;
+import org.openoffice.netbeans.modules.office.filesystem.OpenOfficeDocFileSystem;
+import org.openoffice.netbeans.modules.office.utils.PackageRemover;
+
+/** A template wizard iterator (sequence of panels).
+ * Used to fill in the second and subsequent panels in the New wizard.
+ * Associate this to a template inside a layer using the
+ * Sequence of Panels extra property.
+ * Create one or more panels from template as needed too.
+ *
+ * @author tomaso
+ */
+public class JavaScriptIterator implements TemplateWizard.Iterator {
+
+
+ // private static final long serialVersionUID = ...L;
+
+ // You should define what panels you want to use here:
+
+ protected WizardDescriptor.Panel[] createPanels() {
+ return new WizardDescriptor.Panel[] {
+ // keep the default 2nd panel:
+ wiz.targetChooser(),
+ };
+ }
+
+ // And the list of step names:
+
+ protected String[] createSteps() {
+ return new String[] {
+ null,
+ };
+ }
+
+ private DataFolder checkTarget(DataFolder folder) {
+ FileObject fo = folder.getPrimaryFile();
+
+ try {
+ FileSystem fs = fo.getFileSystem();
+
+ if (fs instanceof OpenOfficeDocFileSystem && fo.isRoot()) {
+ FileObject scripts =
+ fo.getFileObject(OpenOfficeDocFileSystem.SCRIPTS_ROOT);
+ if (scripts == null)
+ scripts =
+ fo.createFolder(OpenOfficeDocFileSystem.SCRIPTS_ROOT);
+
+ FileObject javafolder = scripts.getFileObject("java");
+ if (javafolder == null)
+ javafolder = scripts.createFolder("java");
+
+ DataFolder subfolder = new DataFolder(javafolder);
+ return subfolder;
+ }
+ }
+ catch (IOException ioe) {
+ /* do nothing, we will just return the folder we were passed in */
+ }
+ return folder;
+ }
+
+ public Set instantiate(TemplateWizard wiz) throws IOException {
+ String name = wiz.getTargetName();
+ DataFolder targetFolder = wiz.getTargetFolder();
+ targetFolder = checkTarget(targetFolder);
+
+ DataObject template = wiz.getTemplate();
+ DataObject result;
+ if (name == null) {
+ // Default name.
+ result = template.createFromTemplate(targetFolder);
+ } else {
+ result = template.createFromTemplate(targetFolder, name);
+ }
+
+ FileObject tmp = result.getPrimaryFile();
+ if (tmp.getExt().equals("java")) {
+ try {
+ PackageRemover.removeDeclaration(FileUtil.toFile(tmp));
+ }
+ catch (IOException ioe) {
+ NotifyDescriptor d = new NotifyDescriptor.Message(
+ "Error removing package declaration from file: " +
+ tmp.getNameExt() +
+ ". You should manually remove this declaration " +
+ "before building the Parcel Recipe");
+ TopManager.getDefault().notify(d);
+ }
+ }
+
+ return Collections.singleton(result);
+ }
+
+ // --- The rest probably does not need to be touched. ---
+
+ private transient int index;
+ private transient WizardDescriptor.Panel[] panels;
+ private transient TemplateWizard wiz;
+
+ // You can keep a reference to the TemplateWizard which can
+ // provide various kinds of useful information such as
+ // the currently selected target name.
+ // Also the panels will receive wiz as their "settings" object.
+ public void initialize(TemplateWizard wiz) {
+ this.wiz = wiz;
+ index = 0;
+ panels = createPanels();
+ // Make sure list of steps is accurate.
+ String[] steps = createSteps();
+ for (int i = 0; i < panels.length; i++) {
+ Component c = panels[i].getComponent();
+ if (steps[i] == null) {
+ // Default step name to component name of panel.
+ // Mainly useful for getting the name of the target
+ // chooser to appear in the list of steps.
+ steps[i] = c.getName();
+ }
+ if (c instanceof JComponent) { // assume Swing components
+ JComponent jc = (JComponent)c;
+ // Step #.
+ jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i)); // NOI18N
+ // Step name (actually the whole list for reference).
+ jc.putClientProperty("WizardPanel_contentData", steps); // NOI18N
+ }
+ }
+ }
+ public void uninitialize(TemplateWizard wiz) {
+ this.wiz = null;
+ panels = null;
+ }
+
+ // --- WizardDescriptor.Iterator METHODS: ---
+ // Note that this is very similar to WizardDescriptor.Iterator, but with a
+ // few more options for customization. If you e.g. want to make panels appear
+ // or disappear dynamically, go ahead.
+
+ public String name() {
+ return "";
+ }
+
+ public boolean hasNext() {
+ return index < panels.length - 1;
+ }
+ public boolean hasPrevious() {
+ return index > 0;
+ }
+ public void nextPanel() {
+ if (!hasNext()) throw new NoSuchElementException();
+ index++;
+ }
+ public void previousPanel() {
+ if (!hasPrevious()) throw new NoSuchElementException();
+ index--;
+ }
+ public WizardDescriptor.Panel current() {
+ return panels[index];
+ }
+
+ // If nothing unusual changes in the middle of the wizard, simply:
+ public final void addChangeListener(ChangeListener l) {}
+ public final void removeChangeListener(ChangeListener l) {}
+ // If something changes dynamically (besides moving between panels),
+ // e.g. the number of panels changes in response to user input, then
+ // uncomment the following and call when needed:
+ // fireChangeEvent();
+ /*
+ private transient Set listeners = new HashSet(1); // Set<ChangeListener>
+ public final void addChangeListener(ChangeListener l) {
+ synchronized(listeners) {
+ listeners.add(l);
+ }
+ }
+ public final void removeChangeListener(ChangeListener l) {
+ synchronized(listeners) {
+ listeners.remove(l);
+ }
+ }
+ protected final void fireChangeEvent() {
+ Iterator it;
+ synchronized (listeners) {
+ it = new HashSet(listeners).iterator();
+ }
+ ChangeEvent ev = new ChangeEvent(this);
+ while (it.hasNext()) {
+ ((ChangeListener)it.next()).stateChanged(ev);
+ }
+ }
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ listeners = new HashSet(1);
+ }
+ */
+
+}
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelContentsIterator.java b/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelContentsIterator.java
index 0745b28962e4..34a76fdcb897 100644
--- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelContentsIterator.java
+++ b/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelContentsIterator.java
@@ -2,9 +2,9 @@
*
* $RCSfile: ParcelContentsIterator.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: toconnor $ $Date: 2002-11-13 17:44:40 $
+ * last change: $Author: toconnor $ $Date: 2003-01-16 17:51:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -84,6 +84,7 @@ import org.openide.util.NbBundle;
import org.openide.filesystems.*;
import org.openoffice.idesupport.zip.ParcelZipper;
+import org.openoffice.netbeans.modules.office.loader.ParcelFolder;
import org.openoffice.netbeans.modules.office.filesystem.OpenOfficeDocFileSystem;
import org.openoffice.netbeans.modules.office.utils.PackageRemover;
@@ -102,11 +103,14 @@ public class ParcelContentsIterator implements TemplateWizard.Iterator {
// You should define what panels you want to use here:
+ public static final String PROP_LANGUAGE =
+ ParcelFolder.LANGUAGE_ATTRIBUTE;
+
protected WizardDescriptor.Panel[] createPanels() {
return new WizardDescriptor.Panel[] {
// keep the default 2nd panel:
- wiz.targetChooser(),
- // new ParcelDescriptorPanel(),
+ // wiz.targetChooser(),
+ new ParcelPropertiesPanel(),
};
}
@@ -114,8 +118,8 @@ public class ParcelContentsIterator implements TemplateWizard.Iterator {
protected String[] createSteps() {
return new String[] {
- null,
- // "Parcel Properties",
+ // null,
+ "Parcel Properties",
};
}
@@ -146,11 +150,21 @@ public class ParcelContentsIterator implements TemplateWizard.Iterator {
return folder;
}
- public Set instantiate(TemplateWizard wiz) throws IOException/*, IllegalStateException*/ {
+ public Set instantiate(TemplateWizard wiz) throws IOException {
String name = wiz.getTargetName();
DataFolder targetFolder = wiz.getTargetFolder();
targetFolder = checkTarget(targetFolder);
+ String sourceFile = "Templates/OfficeScripting/EmptyScript/Empty";
+ String language = (String)wiz.getProperty(PROP_LANGUAGE);
+
+ if (language.toLowerCase().equals("java"))
+ sourceFile += ".java";
+ else if (language.toLowerCase().equals("beanshell"))
+ sourceFile += ".bsh";
+ else
+ sourceFile = null;
+
DataObject template = wiz.getTemplate();
DataObject result;
if (name == null) {
@@ -160,46 +174,40 @@ public class ParcelContentsIterator implements TemplateWizard.Iterator {
result = template.createFromTemplate(targetFolder, name);
}
- FileObject contents = result.getPrimaryFile().getFileObject(ParcelZipper.CONTENTS_DIRNAME);
- DataFolder parent = DataFolder.findFolder(contents);
- DataObject[] objs = parent.getChildren();
-
- for (int i = 0; i < objs.length; i++) {
- FileObject fo = objs[i].getPrimaryFile();
- if (fo.getExt().equals("java")) {
- try {
- PackageRemover.removeDeclaration(FileUtil.toFile(fo));
- }
- catch (IOException ioe) {
- NotifyDescriptor d = new NotifyDescriptor.Message(
- "Error removing package declaration from file: " +
- fo.getNameExt() +
- ". You should manually remove this declaration before " +
- "building the Parcel Recipe");
- TopManager.getDefault().notify(d);
+ FileObject recipe = result.getPrimaryFile();
+ recipe.setAttribute(ParcelFolder.LANGUAGE_ATTRIBUTE, language);
+ System.out.println("Called setAttribute from wizard: " + language);
+
+ FileObject contents =
+ recipe.getFileObject(ParcelZipper.CONTENTS_DIRNAME);
+
+ if (contents != null) {
+ DataFolder parent = DataFolder.findFolder(contents);
+
+ FileSystem fs = Repository.getDefault().getDefaultFileSystem();
+ DataObject dObj = DataObject.find(fs.findResource(sourceFile));
+ dObj.createFromTemplate(parent);
+
+ DataObject[] objs = parent.getChildren();
+
+ for (int i = 0; i < objs.length; i++) {
+ FileObject fo = objs[i].getPrimaryFile();
+ if (fo.getExt().equals("java")) {
+ try {
+ PackageRemover.removeDeclaration(FileUtil.toFile(fo));
+ }
+ catch (IOException ioe) {
+ NotifyDescriptor d = new NotifyDescriptor.Message(
+ "Error removing package declaration from file: " +
+ fo.getNameExt() +
+ ". You should manually remove this declaration " +
+ "before building the Parcel Recipe");
+ TopManager.getDefault().notify(d);
+ }
}
}
}
- /* Uncomment this code to open the Parcel Descriptor file in an editor
- * window
- DataFolder parent = DataFolder.findFolder(result.getPrimaryFile());
- DataObject[] objs = parent.getChildren();
-
- if (objs != null) {
- DataObject descriptor = objs[0];
-
- OpenCookie open = (OpenCookie)descriptor.getCookie(OpenCookie.class);
- if (open != null) {
- open.open();
- }
- } */
-
- /* Uncomment to open the Parcel in a new Explorer window
- Node node = parent.getNodeDelegate();
- TopManager.getDefault().getNodeOperation().explore(node);
- */
-
return Collections.singleton(result);
}
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesPanel.java b/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesPanel.java
new file mode 100644
index 000000000000..704bb6f66aed
--- /dev/null
+++ b/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesPanel.java
@@ -0,0 +1,117 @@
+/*
+ * ParcelPropertiesPanel.java
+ *
+ * Created on January 15, 2003
+ */
+
+package org.openoffice.netbeans.modules.office.wizard;
+
+import java.awt.Component;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+import org.openide.WizardDescriptor;
+import org.openide.loaders.TemplateWizard;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+
+/** A single panel descriptor for a wizard.
+ * You probably want to make a wizard iterator to hold it.
+ *
+ * @author tomaso
+ */
+public class ParcelPropertiesPanel implements WizardDescriptor.FinishPanel {
+
+ /** The visual component that displays this panel.
+ * If you need to access the component from this class,
+ * just use getComponent().
+ */
+ private ParcelPropertiesVisualPanel component;
+
+ /** Create the wizard panel descriptor. */
+ public ParcelPropertiesPanel() {
+ }
+
+ // Get the visual component for the panel. In this template, the component
+ // is kept separate. This can be more efficient: if the wizard is created
+ // but never displayed, or not all panels are displayed, it is better to
+ // create only those which really need to be visible.
+ public Component getComponent() {
+ if (component == null) {
+ component = new ParcelPropertiesVisualPanel(this);
+ }
+ return component;
+ }
+
+ public HelpCtx getHelp() {
+ // Show no Help button for this panel:
+ return HelpCtx.DEFAULT_HELP;
+ // If you have context help:
+ // return new HelpCtx(ParcelPropertiesPanel.class);
+ }
+
+ public boolean isValid() {
+ // If it is always OK to press Next or Finish, then:
+ return true;
+ // If it depends on some condition (form filled out...), then:
+ // return someCondition();
+ // and when this condition changes (last form field filled in...) then:
+ // fireChangeEvent();
+ // and uncomment the complicated stuff below.
+ }
+
+ public final void addChangeListener(ChangeListener l) {}
+ public final void removeChangeListener(ChangeListener l) {}
+ /*
+ private final Set listeners = new HashSet(1); // Set<ChangeListener>
+ public final void addChangeListener(ChangeListener l) {
+ synchronized (listeners) {
+ listeners.add(l);
+ }
+ }
+ public final void removeChangeListener(ChangeListener l) {
+ synchronized (listeners) {
+ listeners.remove(l);
+ }
+ }
+ protected final void fireChangeEvent() {
+ Iterator it;
+ synchronized (listeners) {
+ it = new HashSet(listeners).iterator();
+ }
+ ChangeEvent ev = new ChangeEvent(this);
+ while (it.hasNext()) {
+ ((ChangeListener)it.next()).stateChanged(ev);
+ }
+ }
+ */
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setLanguage(String language) {
+ this.language = language;
+ }
+
+ private String language = "Java";
+ private String name = null;
+
+ // You can use a settings object to keep track of state.
+ // Normally the settings object will be the WizardDescriptor,
+ // so you can use WizardDescriptor.getProperty & putProperty
+ // to store information entered by the user.
+ public void readSettings(Object settings) {
+ }
+
+ public void storeSettings(Object settings) {
+ TemplateWizard wiz = (TemplateWizard)settings;
+ wiz.setTargetName(name);
+ wiz.putProperty(ParcelContentsIterator.PROP_LANGUAGE, language);
+ }
+}
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.form b/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.form
new file mode 100644
index 000000000000..48ee7b800446
--- /dev/null
+++ b/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.form
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <AuxValues>
+ <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,75,0,0,1,-112"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="jLabel1">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Parcel Recipe Name"/>
+ </Properties>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
+ <GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="12" insetsBottom="11" insetsRight="2" anchor="17" weightX="0.0" weightY="0.0"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ <Component class="javax.swing.JTextField" name="recipeName">
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="recipeNameActionPerformed"/>
+ <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="recipeNameFocusGained"/>
+ <EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="recipeNameFocusLost"/>
+ </Events>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
+ <GridBagConstraints gridX="1" gridY="0" gridWidth="0" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="0" insetsBottom="11" insetsRight="11" anchor="10" weightX="1.0" weightY="0.0"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel2">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Initial Script Language"/>
+ </Properties>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
+ <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="12" insetsBottom="11" insetsRight="12" anchor="17" weightX="0.0" weightY="0.0"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ <Component class="javax.swing.JComboBox" name="languagesComboBox">
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="languagesComboBoxActionPerformed"/>
+ </Events>
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_InitCodePre" type="java.lang.String" value=""/>
+ <AuxValue name="JavaCodeGenerator_CreateCodePre" type="java.lang.String" value=""/>
+ <AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value=""/>
+ <AuxValue name="JavaCodeGenerator_CodeGeneration" type="java.lang.Integer" value="0"/>
+ <AuxValue name="JavaCodeGenerator_CreateCodePost" type="java.lang.String" value=""/>
+ </AuxValues>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
+ <GridBagConstraints gridX="1" gridY="1" gridWidth="0" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="11" insetsRight="11" anchor="17" weightX="0.0" weightY="0.0"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ <Container class="javax.swing.JPanel" name="jPanel1">
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
+ <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="3" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="1.0"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
+ </Container>
+ </SubComponents>
+</Form>
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.java b/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.java
new file mode 100644
index 000000000000..dbfd4edfd328
--- /dev/null
+++ b/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.java
@@ -0,0 +1,156 @@
+/*
+ * ParcelPropertiesVisualPanel.java
+ *
+ * Created on January 15, 2003
+ */
+
+package org.openoffice.netbeans.modules.office.wizard;
+
+import org.openide.util.NbBundle;
+
+/** A single panel for a wizard - the GUI portion.
+ *
+ * @author tomaso
+ */
+public class ParcelPropertiesVisualPanel extends javax.swing.JPanel {
+
+ /** The wizard panel descriptor associated with this GUI panel.
+ * If you need to fire state changes or something similar, you can
+ * use this handle to do so.
+ */
+ private final ParcelPropertiesPanel panel;
+
+ /** Create the wizard panel and set up some basic properties. */
+ public ParcelPropertiesVisualPanel(ParcelPropertiesPanel panel) {
+ this.panel = panel;
+ initComponents();
+
+ languagesComboBox.addItem("Java");
+ languagesComboBox.addItem("BeanShell");
+
+ // Provide a name in the title bar.
+ setName(NbBundle.getMessage(ParcelPropertiesVisualPanel.class, "TITLE_WizardPanel"));
+ /*
+ // Optional: provide a special description for this pane.
+ // You must have turned on WizardDescriptor.WizardPanel_helpDisplayed
+ // (see descriptor in standard iterator template for an example of this).
+ try {
+ putClientProperty("WizardPanel_helpURL", // NOI18N
+ new URL("nbresloc:/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualHelp.html")); // NOI18N
+ } catch (MalformedURLException mfue) {
+ throw new IllegalStateException(mfue.toString());
+ }
+ */
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ private void initComponents() {//GEN-BEGIN:initComponents
+ java.awt.GridBagConstraints gridBagConstraints;
+
+ jLabel1 = new javax.swing.JLabel();
+ recipeName = new javax.swing.JTextField();
+ jLabel2 = new javax.swing.JLabel();
+ languagesComboBox = new javax.swing.JComboBox();
+ jPanel1 = new javax.swing.JPanel();
+
+ setLayout(new java.awt.GridBagLayout());
+
+ jLabel1.setText("Parcel Recipe Name");
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ gridBagConstraints.insets = new java.awt.Insets(12, 12, 11, 2);
+ add(jLabel1, gridBagConstraints);
+
+ recipeName.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ recipeNameActionPerformed(evt);
+ }
+ });
+
+ recipeName.addFocusListener(new java.awt.event.FocusAdapter() {
+ public void focusGained(java.awt.event.FocusEvent evt) {
+ recipeNameFocusGained(evt);
+ }
+ public void focusLost(java.awt.event.FocusEvent evt) {
+ recipeNameFocusLost(evt);
+ }
+ });
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.weightx = 1.0;
+ gridBagConstraints.insets = new java.awt.Insets(12, 0, 11, 11);
+ add(recipeName, gridBagConstraints);
+
+ jLabel2.setText("Initial Script Language");
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 12, 11, 12);
+ add(jLabel2, gridBagConstraints);
+
+ languagesComboBox.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ languagesComboBoxActionPerformed(evt);
+ }
+ });
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 11, 11);
+ add(languagesComboBox, gridBagConstraints);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
+ gridBagConstraints.weighty = 1.0;
+ add(jPanel1, gridBagConstraints);
+
+ }//GEN-END:initComponents
+
+ private void recipeNameFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_recipeNameFocusGained
+ recipeName.selectAll();
+ }//GEN-LAST:event_recipeNameFocusGained
+
+ private void recipeNameFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_recipeNameFocusLost
+ changeName();
+ }//GEN-LAST:event_recipeNameFocusLost
+
+ private void languagesComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_languagesComboBoxActionPerformed
+ String language = (String)languagesComboBox.getSelectedItem();
+ panel.setLanguage(language);
+ }//GEN-LAST:event_languagesComboBoxActionPerformed
+
+ private void recipeNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_recipeNameActionPerformed
+ changeName();
+ }//GEN-LAST:event_recipeNameActionPerformed
+
+ private void changeName() {
+ String name = recipeName.getText().trim();
+ if (name.equals(""))
+ name = null;
+ panel.setName(name);
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JTextField recipeName;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JPanel jPanel1;
+ private javax.swing.JComboBox languagesComboBox;
+ // End of variables declaration//GEN-END:variables
+
+}