diff --git a/src/antidote/org/apache/tools/ant/gui/Main.java b/src/antidote/org/apache/tools/ant/gui/Main.java
index ae5b7ad4a..8da54c6b4 100644
--- a/src/antidote/org/apache/tools/ant/gui/Main.java
+++ b/src/antidote/org/apache/tools/ant/gui/Main.java
@@ -55,6 +55,7 @@ package org.apache.tools.ant.gui;
import org.apache.tools.ant.gui.core.*;
import org.apache.tools.ant.gui.util.XMLHelper;
import org.apache.tools.ant.gui.wizard.Wizard;
+import org.apache.tools.ant.gui.wizard.build.BuildData;
import org.apache.tools.ant.gui.wizard.WizardListener;
import org.apache.tools.ant.gui.command.LoadFileCmd;
import org.apache.tools.ant.gui.event.EventBus;
@@ -115,10 +116,7 @@ public class Main {
}
else {
// We are in wizard mode. Create it.
- ResourceManager resources = new ResourceManager(
- "org.apache.tools.ant.gui.resources.buildFileWizard");
- Wizard wiz = new Wizard(
- resources, ACSFactory.getInstance().createProject());
+ Wizard wiz = new Wizard(new BuildData());
// XXX this is temporary for testing. Eventually
// it will launch the regular antidote screen with the
// results of the wizard.
diff --git a/src/antidote/org/apache/tools/ant/gui/resources/buildFileWizard.properties b/src/antidote/org/apache/tools/ant/gui/resources/buildFileWizard.properties
index dcb766019..a281e8a12 100644
--- a/src/antidote/org/apache/tools/ant/gui/resources/buildFileWizard.properties
+++ b/src/antidote/org/apache/tools/ant/gui/resources/buildFileWizard.properties
@@ -13,10 +13,10 @@ help=Help
###########################################################
# Define the steps the comprise the wizard.
###########################################################
-steps=start, setup, finish
+steps=start, type, setup, compile, jar, javadoc, finish
###########################################################
-# Step 1
+# Step: start
###########################################################
start.editor=org.apache.tools.ant.gui.wizard.InstructionStep
start.title=Create new build file
@@ -29,7 +29,21 @@ and the types of build options you want included.\n\n\
Click "Next >>" to proceed.
###########################################################
-# Step 2
+# Step: type
+###########################################################
+
+type.editor=org.apache.tools.ant.gui.wizard.build.ProjectTypeStep
+type.title=Select project type
+type.description=Select "New" if you want the buile environment \
+directory structure defined and created for you \
+in addition to the build file. Select "Import" if you want \
+a build file created for an existing project.
+
+type.isNewLabel=New project
+type.isImportLabel=Import existing project
+
+###########################################################
+# Step: setup
###########################################################
setup.editor=org.apache.tools.ant.gui.wizard.build.ProjectSetupStep
@@ -38,11 +52,35 @@ setup.description=Give the project a name, and select the features you \
wish to be included in the project file, such as JavaDoc and JAR creation.
setup.nameLabel=Project Name:
setup.optionsLabel=Options
+setup.compile.label=Compiled Java code (.class files)
+setup.jar.label=Executable JAR file
+setup.javadoc.label=JavaDoc
+
+###########################################################
+# Step: compile
+###########################################################
+compile.title=Setup Java source compilation
+compile.description=Need help?
+compile.editor=org.apache.tools.ant.gui.wizard.build.CompileStep
+
+###########################################################
+# Step: jar
+###########################################################
+jar.title=Setup executable JAR creation
+jar.description=Need help?
+jar.editor=org.apache.tools.ant.gui.wizard.build.JARStep
+
+###########################################################
+# Step: javadoc
+###########################################################
+javadoc.title=Setup JavaDoc creation
+javadoc.description=Need help?
+javadoc.editor=org.apache.tools.ant.gui.wizard.build.JavaDocStep
###########################################################
-# Last step
+# Step: finish
###########################################################
-finish.editor=org.apache.tools.ant.gui.wizard.InstructionStep
+finish.editor=org.apache.tools.ant.gui.wizard.build.FinishStep
finish.title=Complete build file
finish.description=Click "Finish" to save your build file definition.
finish.instructions=You are done!\n\nClick "Finish" to complete your new\
diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/AbstractWizardStep.java b/src/antidote/org/apache/tools/ant/gui/wizard/AbstractWizardStep.java
index a413b3fbe..f5160ba53 100644
--- a/src/antidote/org/apache/tools/ant/gui/wizard/AbstractWizardStep.java
+++ b/src/antidote/org/apache/tools/ant/gui/wizard/AbstractWizardStep.java
@@ -76,11 +76,7 @@ public abstract class AbstractWizardStep extends JComponent
/** Description of the step. */
private String _description = null;
/** Data model. */
- private Object _model = null;
- /** ID of next step. */
- private String _nextID = null;
- /** ID of previous step. */
- private String _prevID = null;
+ private WizardData _model = null;
/**
* Called when the instance should initialize its contents, e.g.
@@ -161,41 +157,6 @@ public abstract class AbstractWizardStep extends JComponent
return _description;
}
- /**
- * Set the default id of the next step.
- *
- * @param nextID ID of next step.
- */
- public void setNext(String nextID) {
- _nextID = nextID;
- }
-
- /**
- * Get the id of the next step.
- *
- * @return ID of next step.
- */
- public String getNext() {
- return _nextID;
- }
-
- /**
- * Set the default id of the previous step.
- *
- * @param prevID ID of previous step.
- */
- public void setPrevious(String prevID) {
- _prevID = prevID;
- }
-
- /**
- * Get the id of the previous step.
- *
- * @return Previous step.
- */
- public String getPrevious() {
- return _prevID;
- }
/**
* Set the data model object that the step will edit. It is assumed
@@ -204,7 +165,7 @@ public abstract class AbstractWizardStep extends JComponent
*
* @param model Data model to edit.
*/
- public void setDataModel(Object model) {
+ public void setDataModel(WizardData model) {
_model = model;
}
@@ -213,7 +174,7 @@ public abstract class AbstractWizardStep extends JComponent
*
* @return Current data model.
*/
- public Object getDataModel() {
+ public WizardData getDataModel() {
return _model;
}
@@ -233,6 +194,26 @@ public abstract class AbstractWizardStep extends JComponent
return this;
}
+ /**
+ * Get the id of the next step.
+ *
+ * @return ID of next step.
+ */
+ public String getNext() {
+ return getDataModel().getStateMachine().getNext(
+ this, getDataModel());
+ }
+
+ /**
+ * Get the id of the previous step.
+ *
+ * @return Previous step.
+ */
+ public String getPrevious() {
+ return getDataModel().getStateMachine().getPrevious(
+ this, getDataModel());
+ }
+
/**
* Get a string representation of this.
*
@@ -242,10 +223,6 @@ public abstract class AbstractWizardStep extends JComponent
StringBuffer buf = new StringBuffer(getClass().getName());
buf.append("[id=");
buf.append(getID());
- buf.append(",prev=");
- buf.append(getPrevious());
- buf.append(",next=");
- buf.append(getNext());
buf.append("]");
return buf.toString();
}
diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/DefaultStateMachine.java b/src/antidote/org/apache/tools/ant/gui/wizard/DefaultStateMachine.java
new file mode 100644
index 000000000..317a7a9da
--- /dev/null
+++ b/src/antidote/org/apache/tools/ant/gui/wizard/DefaultStateMachine.java
@@ -0,0 +1,108 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+package org.apache.tools.ant.gui.wizard;
+import org.apache.tools.ant.gui.core.ResourceManager;
+import java.util.*;
+
+/**
+ * A simple state machine based on the defined ordering of steps
+ * in the resources.
+ *
+ * @version $Revision$
+ * @author Simeon Fitch
+ */
+public class DefaultStateMachine implements StateMachine {
+
+ /**
+ * Get the list of step IDs defined in the resources as a list.
+ *
+ * @param data Current wizard state.
+ * @return List of step IDs
+ */
+ protected List getStepList(WizardData data) {
+ return Arrays.asList(data.getResources().getStringArray("steps"));
+ }
+
+ /**
+ * Get the next step.
+ *
+ * @param curr The current step.
+ * @param data The current state of the wizard.
+ * @return The ID of next step, or null if there currently isn't one.
+ */
+ public String getNext(WizardStep curr, WizardData data) {
+ List steps = getStepList(data);
+ int nextIndex = steps.indexOf(curr.getID()) + 1;
+ if(nextIndex > 0 && nextIndex < steps.size()) {
+ return (String) steps.get(nextIndex);
+ }
+ return null;
+ }
+
+ /**
+ * Get the previous step.
+ *
+ * @param curr The current step.
+ * @param data The current state of the wizard.
+ * @return The ID of previous step, or null if there currently isn't one.
+ */
+ public String getPrevious(WizardStep curr, WizardData data) {
+ List steps = getStepList(data);
+ int nextIndex = steps.indexOf(curr.getID()) - 1;
+ if(nextIndex > 0 && nextIndex < steps.size()) {
+ return (String) steps.get(nextIndex);
+ }
+ return null;
+ }
+}
diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/StateMachine.java b/src/antidote/org/apache/tools/ant/gui/wizard/StateMachine.java
new file mode 100644
index 000000000..3ea92c82f
--- /dev/null
+++ b/src/antidote/org/apache/tools/ant/gui/wizard/StateMachine.java
@@ -0,0 +1,82 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+package org.apache.tools.ant.gui.wizard;
+
+/**
+ * Interface for the wizard state machine, responsible for determining the
+ * next step in the wizard.
+ *
+ * @version $Revision$
+ * @author Simeon Fitch
+ */
+public interface StateMachine {
+
+ /**
+ * Get the next step.
+ *
+ * @param curr The current step.
+ * @param data The current state of the wizard.
+ * @return The next step, or null if there currently isn't one.
+ */
+ String getNext(WizardStep curr, WizardData data);
+
+ /**
+ * Get the previous step.
+ *
+ * @param curr The current step.
+ * @param data The current state of the wizard.
+ * @return The previous step, or null if there currently isn't one.
+ */
+ String getPrevious(WizardStep curr, WizardData data);
+}
diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/Wizard.java b/src/antidote/org/apache/tools/ant/gui/wizard/Wizard.java
index c7cd86729..a18424179 100644
--- a/src/antidote/org/apache/tools/ant/gui/wizard/Wizard.java
+++ b/src/antidote/org/apache/tools/ant/gui/wizard/Wizard.java
@@ -70,9 +70,8 @@ import java.util.*;
* @author Simeon Fitch
*/
public class Wizard extends JComponent {
- /** Resources defining the wizard contents. Separate from the
- * application context resources. */
- private ResourceManager _resources = null;
+ /** The data model to pass on to each step. */
+ private WizardData _data = null;
/** Container for the step editors. */
private JPanel _stepContainer = null;
/** Layout manager for all the step panels. */
@@ -87,8 +86,6 @@ public class Wizard extends JComponent {
private JProgressBar _progress = null;
/** Widget for navigating through steps. */
private WizardNavigator _nav = null;
- /** The data model to pass on to each step. */
- private Object _model = null;
/** The current Wizard step. */
private WizardStep _curr = null;
/** The set of wizard listeners. */
@@ -97,17 +94,15 @@ public class Wizard extends JComponent {
/**
* Standard ctor.
*
- * @param resources Wizard definition resources
- * @param dataModel Initial data model.
+ * @param data Data for the wizard.
*/
- public Wizard(ResourceManager resources, Object dataModel) {
+ public Wizard(WizardData data) {
setLayout(new BorderLayout());
- _resources = resources;
- _model = dataModel;
+ _data = data;
_progress = new JProgressBar();
_progress.setBorder(BorderFactory.createTitledBorder(
- _resources.getString("progress")));
+ _data.getResources().getString("progress")));
_progress.setStringPainted(true);
add(_progress, BorderLayout.NORTH);
@@ -126,7 +121,7 @@ public class Wizard extends JComponent {
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scroller.setBorder(BorderFactory.createTitledBorder(
- _resources.getString("help")));
+ _data.getResources().getString("help")));
add(scroller, BorderLayout.WEST);
_stepContainer = new JPanel(_layout = new CardLayout());
@@ -136,30 +131,23 @@ public class Wizard extends JComponent {
add(_stepContainer, BorderLayout.CENTER);
- _nav = new ButtonNavigator(_resources);
+ _nav = new ButtonNavigator(_data.getResources());
_nav.addNavigatorListener(new NavHandler());
((ButtonNavigator)_nav).setBorder(BorderFactory.createEtchedBorder());
add((ButtonNavigator)_nav, BorderLayout.SOUTH);
- String[] steps = _resources.getStringArray("steps");
+ String[] steps = _data.getResources().getStringArray("steps");
_progress.setMaximum(steps.length - 1);
try {
for(int i = 0; i < steps.length; i++) {
- Class type = _resources.getClass(steps[i] + ".editor");
+ Class type = _data.getResources().getClass(steps[i] + ".editor");
WizardStep step = (WizardStep) type.newInstance();
- step.setResources(_resources);
+ step.setResources(_data.getResources());
step.setID(steps[i]);
- step.setTitle(_resources.getString(steps[i]+ ".title"));
+ step.setTitle(
+ _data.getResources().getString(steps[i]+ ".title"));
step.setDescription(
- _resources.getString(steps[i]+ ".description"));
-
- String id = _resources.getString(steps[i] + ".next");
- id = (id == null && i < steps.length - 1) ? steps[i + 1] : id;
- step.setNext(id);
-
- id = _resources.getString(steps[i] + ".prev");
- id = (id == null && i > 0) ? steps[i - 1] : id;
- step.setPrevious(id);
+ _data.getResources().getString(steps[i]+ ".description"));
_steps.put(steps[i], step);
_stepOrdering.add(step);
@@ -168,7 +156,7 @@ public class Wizard extends JComponent {
// Initialize the first screen with the data model.
if(steps.length > 0) {
WizardStep first = (WizardStep)_steps.get(steps[0]);
- first.setDataModel(_model);
+ first.setDataModel(_data);
_curr = first;
showStep(first);
}
@@ -207,13 +195,13 @@ public class Wizard extends JComponent {
private void showStep(WizardStep step) {
if(step == null) return;
- // Transfer data model (in case step wants to create a new one.
- _curr.updateDataModel();
step.setDataModel(_curr.getDataModel());
// Update the title and description.
_stepContainer.setBorder(
- BorderFactory.createTitledBorder(step.getTitle()));
+ BorderFactory.createCompoundBorder(
+ BorderFactory.createTitledBorder(step.getTitle()),
+ BorderFactory.createEmptyBorder(5, 15, 5, 15)));
_description.setText(step.getDescription());
_nav.setBackEnabled(step.getPrevious() != null);
@@ -233,21 +221,28 @@ public class Wizard extends JComponent {
/** Handler for actions invoked by wizard. */
private class NavHandler implements NavigatorListener {
public void nextStep() {
+ // Called to give data model chance to make changes to what is next.
+ _curr.updateDataModel();
String nextID = _curr.getNext();
if(nextID != null) {
showStep((WizardStep)_steps.get(nextID));
}
}
public void backStep() {
+ // Called to give data model chance to make changes to what is
+ // before.
+ _curr.updateDataModel();
String prevID = _curr.getPrevious();
if(prevID != null) {
showStep((WizardStep)_steps.get(prevID));
}
}
public void gotoStep(String stepID){
+ _curr.updateDataModel();
showStep((WizardStep) _steps.get(stepID));
}
public void cancel() {
+ _curr.updateDataModel();
Iterator it = _listeners.iterator();
while(it.hasNext()) {
WizardListener l = (WizardListener) it.next();
@@ -255,6 +250,7 @@ public class Wizard extends JComponent {
}
}
public void finish() {
+ _curr.updateDataModel();
Iterator it = _listeners.iterator();
while(it.hasNext()) {
WizardListener l = (WizardListener) it.next();
diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/WizardData.java b/src/antidote/org/apache/tools/ant/gui/wizard/WizardData.java
new file mode 100644
index 000000000..ff8b66a8a
--- /dev/null
+++ b/src/antidote/org/apache/tools/ant/gui/wizard/WizardData.java
@@ -0,0 +1,79 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+package org.apache.tools.ant.gui.wizard;
+
+import org.apache.tools.ant.gui.core.ResourceManager;
+
+/**
+ * Interface for the wizard data model.
+ *
+ * @version $Revision$
+ * @author Simeon Fitch
+ */
+public interface WizardData {
+ /**
+ * Get access to the resources for the wizard.
+ *
+ * @return Wizard resources.
+ */
+ ResourceManager getResources();
+
+ /**
+ * Get the class the determines what the next step should be.
+ *
+ * @return State machine.
+ */
+ StateMachine getStateMachine();
+
+}
diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/WizardStep.java b/src/antidote/org/apache/tools/ant/gui/wizard/WizardStep.java
index fc632592c..94f722ad4 100644
--- a/src/antidote/org/apache/tools/ant/gui/wizard/WizardStep.java
+++ b/src/antidote/org/apache/tools/ant/gui/wizard/WizardStep.java
@@ -109,33 +109,6 @@ public interface WizardStep {
*/
String getDescription();
- /**
- * Set the default id of the next step.
- *
- * @param nextID ID of next step.
- */
- void setNext(String nextID);
- /**
- * Get the id of the next step.
- *
- * @return ID of next step.
- */
- String getNext();
-
- /**
- * Set the default id of the previous step.
- *
- * @param prevID ID of previous step.
- */
- void setPrevious(String prevID);
-
- /**
- * Get the id of the previous step.
- *
- * @return Previous step.
- */
- String getPrevious();
-
/**
* Set the data model object that the step will edit. It is assumed
* that all steps initialized within a single wizard agree on the
@@ -143,14 +116,14 @@ public interface WizardStep {
*
* @param model Data model to edit.
*/
- void setDataModel(Object model);
+ void setDataModel(WizardData model);
/**
* Get the data model that should be passeed on to the next step.
*
* @return Current data model.
*/
- Object getDataModel();
+ WizardData getDataModel();
/**
* Get the component that should be displayed to the user for
@@ -175,4 +148,18 @@ public interface WizardStep {
*/
void updateDataModel();
+ /**
+ * Get the id of the next step.
+ *
+ * @return ID of next step.
+ */
+ String getNext();
+
+ /**
+ * Get the id of the previous step.
+ *
+ * @return Previous step.
+ */
+ String getPrevious();
+
}
diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/build/BuildData.java b/src/antidote/org/apache/tools/ant/gui/wizard/build/BuildData.java
new file mode 100644
index 000000000..e57211907
--- /dev/null
+++ b/src/antidote/org/apache/tools/ant/gui/wizard/build/BuildData.java
@@ -0,0 +1,159 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+package org.apache.tools.ant.gui.wizard.build;
+
+import org.apache.tools.ant.gui.wizard.*;
+import org.apache.tools.ant.gui.core.ResourceManager;
+import org.apache.tools.ant.gui.acs.*;
+import java.util.*;
+
+/**
+ * Data model for the build wizard.
+ *
+ * @version $Revision$
+ * @author Simeon Fitch
+ */
+public class BuildData implements WizardData {
+ /** Wizard resources. */
+ private ResourceManager _resources = new ResourceManager(
+ "org.apache.tools.ant.gui.resources.buildFileWizard");
+
+ private StateMachine _stateMachine = new BuildStateMachine();
+ private String _name = null;
+ private boolean _isNewProject = true;
+ private List _optionalSteps = null;
+
+ /**
+ * Default ctor.
+ *
+ */
+ public BuildData() {
+ //_project = ACSFactory.getInstance().createProject();
+ _optionalSteps = Arrays.asList(ProjectSetupStep.OPTIONS);
+ }
+
+ /**
+ * Get access to the resources for the wizard.
+ *
+ * @return Wizard resources.
+ */
+ public ResourceManager getResources() {
+ return _resources;
+ }
+
+ /**
+ * Get the class the determines what the next step should be.
+ *
+ * @return State machine.
+ */
+ public StateMachine getStateMachine() {
+ return _stateMachine;
+ }
+
+ /**
+ * Get the project name.
+ *
+ * @param name Project name.
+ */
+ public void setProjectName(String name) {
+ _name = name;
+ }
+
+ /**
+ * Set the project name.
+ *
+ * @return Project name.
+ */
+ public String getProjectName() {
+ return _name;
+ }
+
+ /**
+ * Set whether or not a new project is being created.
+ *
+ * @param isNew True if new project, false if importing a project.
+ */
+ public void setNewProject(boolean isNew) {
+ _isNewProject = isNew;
+ }
+
+ /**
+ * Determine if we are creating a new project.
+ *
+ * @return True if new project, false if importing a project.
+ */
+ public boolean isNewProject() {
+ return _isNewProject;
+ }
+
+ /**
+ * Set the set of optional steps (as IDs) that should be executed.
+ *
+ * @param steps Set of optional step IDs.
+ */
+ public void setOptionalSteps(List steps) {
+ _optionalSteps = steps;
+ }
+
+ /**
+ * Get the set of optional steps (as IDs) that should be executed.
+ *
+ * @return Set of optional step IDs.
+ */
+ public List getOptionalSteps() {
+ return _optionalSteps;
+
+ }
+
+}
diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/build/BuildStateMachine.java b/src/antidote/org/apache/tools/ant/gui/wizard/build/BuildStateMachine.java
new file mode 100644
index 000000000..be69de3ed
--- /dev/null
+++ b/src/antidote/org/apache/tools/ant/gui/wizard/build/BuildStateMachine.java
@@ -0,0 +1,141 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+package org.apache.tools.ant.gui.wizard.build;
+import org.apache.tools.ant.gui.wizard.*;
+import org.apache.tools.ant.gui.core.ResourceManager;
+import java.util.*;
+
+/**
+ * State machine defining the step ordering for the build wizard.
+ *
+ * @version $Revision$
+ * @author Simeon Fitch
+ */
+public class BuildStateMachine extends DefaultStateMachine {
+ private List _optionals = Arrays.asList(ProjectSetupStep.OPTIONS);
+
+
+ /**
+ * Get the next step.
+ *
+ * @param curr The current step.
+ * @param data The current state of the wizard.
+ * @return The ID of next step, or null if there currently isn't one.
+ */
+ public String getNext(ProjectSetupStep curr, WizardData data) {
+ return getFollowingID(super.getNext(curr, data), data, +1);
+ }
+
+ /**
+ * Get the next step.
+ *
+ * @param curr The current step.
+ * @param data The current state of the wizard.
+ * @return The ID of next step, or null if there currently isn't one.
+ */
+ public String getNext(OptionalStep curr, WizardData data) {
+ return getFollowingID(super.getNext(curr, data), data, +1);
+ }
+
+ /**
+ * Get the previous step.
+ *
+ * @param curr The current step.
+ * @param data The current state of the wizard.
+ * @return The ID of previous step, or null if there currently isn't one.
+ */
+ public String getPrevious(OptionalStep curr, WizardData data) {
+ return getFollowingID(super.getPrevious(curr, data), data, -1);
+ }
+
+ /**
+ * Get the previous step.
+ *
+ * @param curr The current step.
+ * @param data The current state of the wizard.
+ * @return The ID of previous step, or null if there currently isn't one.
+ */
+ public String getPrevious(FinishStep curr, WizardData data) {
+ return getFollowingID(super.getPrevious(curr, data), data, -1);
+ }
+
+ /**
+ * Figure out which ID should follow the given one based on the current
+ * state setting of the optional steps.
+ *
+ * @param curr ID of the current step.
+ * @param data State data.
+ * @param direction +1 for next, -1 for previous.
+ * @return The ID to follow, or null if none.
+ */
+ private String getFollowingID(String curr, WizardData data, int direction) {
+ String follow = curr;
+ List steps = getStepList(data);
+ List setting = ((BuildData)data).getOptionalSteps();
+
+ while(follow != null && _optionals.contains(follow) &&
+ !setting.contains(follow)) {
+
+ int index = steps.indexOf(follow) + direction;
+ if(index >= 0 && index < steps.size()) {
+ follow = (String) steps.get(index);
+ }
+ else {
+ follow = null;
+ }
+ }
+
+ return follow;
+ }
+}
diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/build/CompileStep.java b/src/antidote/org/apache/tools/ant/gui/wizard/build/CompileStep.java
new file mode 100644
index 000000000..c2b2daed9
--- /dev/null
+++ b/src/antidote/org/apache/tools/ant/gui/wizard/build/CompileStep.java
@@ -0,0 +1,116 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+package org.apache.tools.ant.gui.wizard.build;
+
+import org.apache.tools.ant.gui.wizard.AbstractWizardStep;
+import javax.swing.*;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+/**
+ *
+ *
+ * @version $Revision$
+ * @author Simeon Fitch
+ */
+public class CompileStep extends AbstractWizardStep implements OptionalStep {
+
+ /**
+ * Initialize the display.
+ *
+ */
+ protected void init() {
+ }
+
+ /**
+ * Called when the step should refresh its display based on the
+ * current model setting.
+ *
+ */
+ public void updateDisplay() {
+ BuildData data = (BuildData) getDataModel();
+
+ }
+
+ /**
+ * Called when the step should update the data model based on the
+ * settings of its widgets.
+ *
+ */
+ public void updateDataModel() {
+ BuildData data = (BuildData) getDataModel();
+
+ }
+
+ /**
+ * Get the id of the next step.
+ *
+ * @return ID of next step.
+ */
+ public String getNext() {
+ return ((BuildStateMachine)getDataModel().getStateMachine()).
+ getNext(this, getDataModel());
+ }
+
+ /**
+ * Get the id of the previous step.
+ *
+ * @return Previous step.
+ */
+ public String getPrevious() {
+ return ((BuildStateMachine)getDataModel().getStateMachine()).
+ getPrevious(this, getDataModel());
+ }
+
+}
diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/build/FinishStep.java b/src/antidote/org/apache/tools/ant/gui/wizard/build/FinishStep.java
new file mode 100644
index 000000000..421653d2d
--- /dev/null
+++ b/src/antidote/org/apache/tools/ant/gui/wizard/build/FinishStep.java
@@ -0,0 +1,110 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+package org.apache.tools.ant.gui.wizard.build;
+
+import org.apache.tools.ant.gui.wizard.InstructionStep;
+import javax.swing.*;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+/**
+ *
+ *
+ * @version $Revision$
+ * @author Simeon Fitch
+ */
+public class FinishStep extends InstructionStep {
+
+
+ /**
+ * Called when the step should refresh its display based on the
+ * current model setting.
+ *
+ */
+ public void updateDisplay() {
+ BuildData data = (BuildData) getDataModel();
+
+ }
+
+ /**
+ * Called when the step should update the data model based on the
+ * settings of its widgets.
+ *
+ */
+ public void updateDataModel() {
+ BuildData data = (BuildData) getDataModel();
+
+ }
+
+ /**
+ * Get the id of the next step.
+ *
+ * @return ID of next step.
+ */
+ public String getNext() {
+ return ((BuildStateMachine)getDataModel().getStateMachine()).
+ getNext(this, getDataModel());
+ }
+
+ /**
+ * Get the id of the previous step.
+ *
+ * @return Previous step.
+ */
+ public String getPrevious() {
+ return ((BuildStateMachine)getDataModel().getStateMachine()).
+ getPrevious(this, getDataModel());
+ }
+
+}
diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/build/JARStep.java b/src/antidote/org/apache/tools/ant/gui/wizard/build/JARStep.java
new file mode 100644
index 000000000..da90c62f6
--- /dev/null
+++ b/src/antidote/org/apache/tools/ant/gui/wizard/build/JARStep.java
@@ -0,0 +1,116 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+package org.apache.tools.ant.gui.wizard.build;
+
+import org.apache.tools.ant.gui.wizard.AbstractWizardStep;
+import javax.swing.*;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+/**
+ *
+ *
+ * @version $Revision$
+ * @author Simeon Fitch
+ */
+public class JARStep extends AbstractWizardStep implements OptionalStep {
+
+ /**
+ * Initialize the display.
+ *
+ */
+ protected void init() {
+ }
+
+ /**
+ * Called when the step should refresh its display based on the
+ * current model setting.
+ *
+ */
+ public void updateDisplay() {
+ BuildData data = (BuildData) getDataModel();
+
+ }
+
+ /**
+ * Called when the step should update the data model based on the
+ * settings of its widgets.
+ *
+ */
+ public void updateDataModel() {
+ BuildData data = (BuildData) getDataModel();
+
+ }
+
+ /**
+ * Get the id of the next step.
+ *
+ * @return ID of next step.
+ */
+ public String getNext() {
+ return ((BuildStateMachine)getDataModel().getStateMachine()).
+ getNext(this, getDataModel());
+ }
+
+ /**
+ * Get the id of the previous step.
+ *
+ * @return Previous step.
+ */
+ public String getPrevious() {
+ return ((BuildStateMachine)getDataModel().getStateMachine()).
+ getPrevious(this, getDataModel());
+ }
+
+}
diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/build/JavaDocStep.java b/src/antidote/org/apache/tools/ant/gui/wizard/build/JavaDocStep.java
new file mode 100644
index 000000000..e8af955ed
--- /dev/null
+++ b/src/antidote/org/apache/tools/ant/gui/wizard/build/JavaDocStep.java
@@ -0,0 +1,116 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+package org.apache.tools.ant.gui.wizard.build;
+
+import org.apache.tools.ant.gui.wizard.AbstractWizardStep;
+import javax.swing.*;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+/**
+ *
+ *
+ * @version $Revision$
+ * @author Simeon Fitch
+ */
+public class JavaDocStep extends AbstractWizardStep implements OptionalStep {
+
+ /**
+ * Initialize the display.
+ *
+ */
+ protected void init() {
+ }
+
+ /**
+ * Called when the step should refresh its display based on the
+ * current model setting.
+ *
+ */
+ public void updateDisplay() {
+ BuildData data = (BuildData) getDataModel();
+
+ }
+
+ /**
+ * Called when the step should update the data model based on the
+ * settings of its widgets.
+ *
+ */
+ public void updateDataModel() {
+ BuildData data = (BuildData) getDataModel();
+
+ }
+
+ /**
+ * Get the id of the next step.
+ *
+ * @return ID of next step.
+ */
+ public String getNext() {
+ return ((BuildStateMachine)getDataModel().getStateMachine()).
+ getNext(this, getDataModel());
+ }
+
+ /**
+ * Get the id of the previous step.
+ *
+ * @return Previous step.
+ */
+ public String getPrevious() {
+ return ((BuildStateMachine)getDataModel().getStateMachine()).
+ getPrevious(this, getDataModel());
+ }
+
+}
diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/build/OptionalStep.java b/src/antidote/org/apache/tools/ant/gui/wizard/build/OptionalStep.java
new file mode 100644
index 000000000..1264c619b
--- /dev/null
+++ b/src/antidote/org/apache/tools/ant/gui/wizard/build/OptionalStep.java
@@ -0,0 +1,65 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+package org.apache.tools.ant.gui.wizard.build;
+import org.apache.tools.ant.gui.wizard.WizardStep;
+
+/**
+ * A tagging interface for optional steps to make virtual dispatching easier.
+ *
+ * @version $Revision$
+ * @author Simeon Fitch
+ */
+interface OptionalStep extends WizardStep {
+
+}
diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/build/ProjectSetupStep.java b/src/antidote/org/apache/tools/ant/gui/wizard/build/ProjectSetupStep.java
index e844d38c4..89b245275 100644
--- a/src/antidote/org/apache/tools/ant/gui/wizard/build/ProjectSetupStep.java
+++ b/src/antidote/org/apache/tools/ant/gui/wizard/build/ProjectSetupStep.java
@@ -58,7 +58,7 @@ import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridBagLayout;
-import org.apache.tools.ant.gui.acs.*;
+import java.util.*;
/**
* Build file wizard step for naming the project and
@@ -69,9 +69,31 @@ import org.apache.tools.ant.gui.acs.*;
*/
public class ProjectSetupStep extends AbstractWizardStep {
+ /** ID for compile option. */
+ public static final String COMPILE_OPTION = "compile";
+ /** ID for JAR option. */
+ public static final String JAR_OPTION = "jar";
+ /** ID for JavaDoc option. */
+ public static final String JAVADOC_OPTION = "javadoc";
+
+ /** Available options as an array. */
+ public static final String[] OPTIONS = {
+ COMPILE_OPTION,
+ JAR_OPTION,
+ JAVADOC_OPTION
+ };
+
+ /** Array of the option selections. */
+ private JCheckBox[] _selections = null;
+
+
/** Name of the project. */
private JTextField _name = null;
+ /**
+ * Initialize the screen widgets.
+ *
+ */
protected void init() {
setLayout(new BorderLayout());
@@ -82,11 +104,21 @@ public class ProjectSetupStep extends AbstractWizardStep {
p.add(new JLabel(getResources().getString(getID() + ".nameLabel")));
p.add(_name);
- p = new JPanel(new GridBagLayout());
- p.setBorder(BorderFactory.createTitledBorder(
- getResources().getString(getID() + ".optionsLabel")));
+ p = new JPanel(null);
+ p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
+ p.setBorder(BorderFactory.createCompoundBorder(
+ BorderFactory.createTitledBorder(
+ getResources().getString(getID() + ".optionsLabel")),
+ BorderFactory.createEmptyBorder(5, 10, 5, 10)));
add(p, BorderLayout.CENTER);
+ _selections = new JCheckBox[OPTIONS.length];
+ for(int i = 0; i < OPTIONS.length; i++) {
+ _selections[i] = new JCheckBox(
+ getResources().getString(getID() + "." + OPTIONS[i] + ".label"));
+ _selections[i].setSelected(true);
+ p.add(_selections[i]);
+ }
}
/**
@@ -95,8 +127,17 @@ public class ProjectSetupStep extends AbstractWizardStep {
*
*/
public void updateDisplay() {
- ACSProjectElement project = (ACSProjectElement) getDataModel();
- _name.setText(project.getName());
+ // Name.
+ BuildData data = (BuildData) getDataModel();
+ _name.setText(data.getProjectName());
+
+ // Steps.
+ List steps = data.getOptionalSteps();
+ if(steps != null) {
+ for(int i = 0; i < _selections.length; i++) {
+ _selections[i].setSelected(steps.contains(OPTIONS[i]));
+ }
+ }
}
/**
@@ -105,8 +146,39 @@ public class ProjectSetupStep extends AbstractWizardStep {
*
*/
public void updateDataModel() {
- ACSProjectElement project = (ACSProjectElement) getDataModel();
- project.setName(_name.getText());
+ // Name.
+ BuildData data = (BuildData) getDataModel();
+ data.setProjectName(_name.getText());
+
+ // Steps.
+ List steps = new ArrayList();
+ for(int i = 0; i < _selections.length; i++) {
+ if(_selections[i].isSelected()) {
+ steps.add(OPTIONS[i]);
+ }
+ }
+
+ data.setOptionalSteps(steps);
}
+ /**
+ * Get the id of the next step.
+ *
+ * @return ID of next step.
+ */
+ public String getNext() {
+ return ((BuildStateMachine)getDataModel().getStateMachine()).
+ getNext(this, getDataModel());
+ }
+
+ /**
+ * Get the id of the previous step.
+ *
+ * @return Previous step.
+ */
+ public String getPrevious() {
+ return ((BuildStateMachine)getDataModel().getStateMachine()).
+ getPrevious(this, getDataModel());
+ }
}
+
diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/build/ProjectTypeStep.java b/src/antidote/org/apache/tools/ant/gui/wizard/build/ProjectTypeStep.java
new file mode 100644
index 000000000..880a16131
--- /dev/null
+++ b/src/antidote/org/apache/tools/ant/gui/wizard/build/ProjectTypeStep.java
@@ -0,0 +1,115 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+package org.apache.tools.ant.gui.wizard.build;
+
+import org.apache.tools.ant.gui.wizard.AbstractWizardStep;
+import javax.swing.*;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+import org.apache.tools.ant.gui.acs.*;
+import java.util.*;
+
+/**
+ * Step for selecting whether a new project is being created, or
+ * if an existing one is being imported.
+ *
+ * @version $Revision$
+ * @author Simeon Fitch
+ */
+public class ProjectTypeStep extends AbstractWizardStep {
+
+ private JRadioButton _isNew = null;
+ private JRadioButton _isImport = null;
+
+ /**
+ * Initialize the display.
+ *
+ */
+ protected void init() {
+ setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
+
+ ButtonGroup group = new ButtonGroup();
+ _isNew = new JRadioButton(
+ getResources().getString(getID() + ".isNewLabel"));
+ group.add(_isNew);
+ add(_isNew);
+ _isImport = new JRadioButton(
+ getResources().getString(getID() + ".isImportLabel"));
+ group.add(_isImport);
+ add(_isImport);
+ // XXX Not implemented yet.
+ _isImport.setEnabled(false);
+ _isImport.setToolTipText("Not implemented yet.");
+ }
+
+ /**
+ * Called when the step should refresh its display based on the
+ * current model setting.
+ *
+ */
+ public void updateDisplay() {
+ BuildData data = (BuildData) getDataModel();
+ _isNew.setSelected(data.isNewProject());
+ }
+
+ /**
+ * Called when the step should update the data model based on the
+ * settings of its widgets.
+ *
+ */
+ public void updateDataModel() {
+ BuildData data = (BuildData) getDataModel();
+ data.setNewProject(_isNew.isSelected());
+ }
+}