"wizzzerd" all over the place. :-( git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268468 13f79535-47bb-0310-9956-ffa450edef68master
@@ -64,7 +64,7 @@ import org.apache.tools.ant.gui.core.ResourceManager; | |||
public class Args { | |||
private ResourceManager _resources = null; | |||
private boolean _wizzardMode = false; | |||
private boolean _wizardMode = false; | |||
private String _fileName = null; | |||
private boolean _debugMode = false; | |||
@@ -83,8 +83,8 @@ public class Args { | |||
System.out.println(getUsage()); | |||
System.exit(0); | |||
} | |||
else if(arg.equals("-wizzard")) { | |||
_wizzardMode = true; | |||
else if(arg.equals("-wizard")) { | |||
_wizardMode = true; | |||
} | |||
else if(arg.equals("-debug")) { | |||
_debugMode = true; | |||
@@ -140,13 +140,13 @@ public class Args { | |||
} | |||
/** | |||
* Determine if wizzard mode was requested for generating a new | |||
* Determine if wizard mode was requested for generating a new | |||
* build file. | |||
* | |||
* @return True if wizzard mode, false otherwise. | |||
* @return True if wizard mode, false otherwise. | |||
*/ | |||
public boolean isWizzardMode() { | |||
return _wizzardMode; | |||
public boolean isWizardMode() { | |||
return _wizardMode; | |||
} | |||
/** | |||
@@ -54,8 +54,8 @@ | |||
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.wizzard.Wizzard; | |||
import org.apache.tools.ant.gui.wizzard.WizzardListener; | |||
import org.apache.tools.ant.gui.wizard.Wizard; | |||
import org.apache.tools.ant.gui.wizard.WizardListener; | |||
import org.apache.tools.ant.gui.command.LoadFileCmd; | |||
import org.apache.tools.ant.gui.event.EventBus; | |||
import org.apache.tools.ant.gui.acs.ACSFactory; | |||
@@ -86,7 +86,7 @@ public class Main { | |||
f.setDefaultCloseOperation(3 /*JFrame.EXIT_ON_CLOSE*/); | |||
AppContext context = new AppContext(f); | |||
if(!settings.isWizzardMode()) { | |||
if(!settings.isWizardMode()) { | |||
EventResponder resp = new EventResponder(context); | |||
Antidote gui = new Antidote(context); | |||
@@ -114,15 +114,15 @@ public class Main { | |||
} | |||
} | |||
else { | |||
// We are in wizzard mode. Create it. | |||
// We are in wizard mode. Create it. | |||
ResourceManager resources = new ResourceManager( | |||
"org.apache.tools.ant.gui.resources.buildFileWizzard"); | |||
Wizzard wiz = new Wizzard( | |||
"org.apache.tools.ant.gui.resources.buildFileWizard"); | |||
Wizard wiz = new Wizard( | |||
resources, ACSFactory.getInstance().createProject()); | |||
// XXX this is temporary for testing. Eventually | |||
// it will launch the regular antidote screen with the | |||
// results of the wizzard. | |||
wiz.addWizzardListener(new WizzardListener() { | |||
// results of the wizard. | |||
wiz.addWizardListener(new WizardListener() { | |||
public void finished(Object model) { | |||
System.out.println(model); | |||
System.exit(0); | |||
@@ -1,7 +1,7 @@ | |||
# Property file for the wizzard used to create a new build file. | |||
# Property file for the wizard used to create a new build file. | |||
########################################################### | |||
# Define required properties for wizzard. | |||
# Define required properties for wizard. | |||
########################################################### | |||
next=Next >> | |||
back=<< Back | |||
@@ -11,19 +11,19 @@ progress=Progress | |||
help=Help | |||
########################################################### | |||
# Define the steps the comprise the wizzard. | |||
# Define the steps the comprise the wizard. | |||
########################################################### | |||
steps=start, setup, finish | |||
########################################################### | |||
# Step 1 | |||
########################################################### | |||
start.editor=org.apache.tools.ant.gui.wizzard.InstructionStep | |||
start.editor=org.apache.tools.ant.gui.wizard.InstructionStep | |||
start.title=Create new build file | |||
start.description=This wizzard will step you through the process of creating \ | |||
start.description=This wizard will step you through the process of creating \ | |||
a basic Ant build file for your project. | |||
start.instructions=Welcome to the Ant build file wizzard!\n\ | |||
start.instructions=Welcome to the Ant build file wizard!\n\ | |||
You will be asked a series of questions about the project you wish to create\ | |||
and the types of build options you want included.\n\n\ | |||
Click "Next >>" to proceed. | |||
@@ -32,7 +32,7 @@ Click "Next >>" to proceed. | |||
# Step 2 | |||
########################################################### | |||
setup.editor=org.apache.tools.ant.gui.wizzard.build.ProjectSetupStep | |||
setup.editor=org.apache.tools.ant.gui.wizard.build.ProjectSetupStep | |||
setup.title=Setup project | |||
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. | |||
@@ -42,7 +42,7 @@ setup.optionsLabel=Options | |||
########################################################### | |||
# Last step | |||
########################################################### | |||
finish.editor=org.apache.tools.ant.gui.wizzard.InstructionStep | |||
finish.editor=org.apache.tools.ant.gui.wizard.InstructionStep | |||
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\ |
@@ -51,19 +51,19 @@ | |||
* information on the Apache Software Foundation, please see | |||
* <http://www.apache.org/>. | |||
*/ | |||
package org.apache.tools.ant.gui.wizzard; | |||
package org.apache.tools.ant.gui.wizard; | |||
import org.apache.tools.ant.gui.core.ResourceManager; | |||
import javax.swing.JComponent; | |||
/** | |||
* Abstract class implementing the basic support for the WizzardStep interface. | |||
* Abstract class implementing the basic support for the WizardStep interface. | |||
* | |||
* @version $Revision$ | |||
* @author Simeon Fitch | |||
*/ | |||
public abstract class AbstractWizzardStep extends JComponent | |||
implements WizzardStep { | |||
public abstract class AbstractWizardStep extends JComponent | |||
implements WizardStep { | |||
/** Flag to indicate whether or not init has been called. */ | |||
private boolean _initialized = false; | |||
@@ -108,9 +108,9 @@ public abstract class AbstractWizzardStep extends JComponent | |||
} | |||
/** | |||
* Set the step id. The id must be unique among steps within the wizzard. | |||
* Set the step id. The id must be unique among steps within the wizard. | |||
* | |||
* @param id Wizzard id. | |||
* @param id Wizard id. | |||
*/ | |||
public void setID(String id) { | |||
_id = id; | |||
@@ -199,7 +199,7 @@ public abstract class AbstractWizzardStep extends JComponent | |||
/** | |||
* Set the data model object that the step will edit. It is assumed | |||
* that all steps initialized within a single wizzard agree on the | |||
* that all steps initialized within a single wizard agree on the | |||
* data model type. | |||
* | |||
* @param model Data model to edit. | |||
@@ -220,7 +220,7 @@ public abstract class AbstractWizzardStep extends JComponent | |||
/** | |||
* Get the component that should be displayed to the user for | |||
* editing the model. This component should <b>not</b> include the | |||
* title and text display, which is handled by the wizzard container. | |||
* title and text display, which is handled by the wizard container. | |||
* | |||
* @return Editing component. | |||
*/ |
@@ -51,7 +51,7 @@ | |||
* information on the Apache Software Foundation, please see | |||
* <http://www.apache.org/>. | |||
*/ | |||
package org.apache.tools.ant.gui.wizzard; | |||
package org.apache.tools.ant.gui.wizard; | |||
import org.apache.tools.ant.gui.core.ResourceManager; | |||
import javax.swing.*; | |||
import java.awt.event.ActionListener; | |||
@@ -59,7 +59,7 @@ import java.awt.event.ActionEvent; | |||
import java.awt.FlowLayout; | |||
import java.util.*; | |||
class ButtonNavigator extends JComponent implements WizzardNavigator { | |||
class ButtonNavigator extends JComponent implements WizardNavigator { | |||
public static final String NEXT = "next"; | |||
public static final String BACK = "back"; | |||
public static final String CANCEL = "cancel"; |
@@ -51,19 +51,19 @@ | |||
* information on the Apache Software Foundation, please see | |||
* <http://www.apache.org/>. | |||
*/ | |||
package org.apache.tools.ant.gui.wizzard; | |||
package org.apache.tools.ant.gui.wizard; | |||
import javax.swing.*; | |||
import java.awt.BorderLayout; | |||
import java.awt.Font; | |||
import java.awt.Insets; | |||
/** | |||
* Wizzard step whose only purpose is to display some text. | |||
* Wizard step whose only purpose is to display some text. | |||
* | |||
* @version $Revision$ | |||
* @author Simeon Fitch | |||
*/ | |||
public class InstructionStep extends AbstractWizzardStep { | |||
public class InstructionStep extends AbstractWizardStep { | |||
/** | |||
* Initialize the contents of the container. |
@@ -51,38 +51,38 @@ | |||
* information on the Apache Software Foundation, please see | |||
* <http://www.apache.org/>. | |||
*/ | |||
package org.apache.tools.ant.gui.wizzard; | |||
package org.apache.tools.ant.gui.wizard; | |||
/** | |||
* Interface for classes interested in events from the WizzardNavigator. | |||
* Interface for classes interested in events from the WizardNavigator. | |||
* | |||
* @version $Revision$ | |||
* @author Simeon Fitch | |||
*/ | |||
public interface NavigatorListener { | |||
/** | |||
* Called when the wizzard should show the next step. | |||
* Called when the wizard should show the next step. | |||
* | |||
*/ | |||
void nextStep(); | |||
/** | |||
* Called when the wizzard should show the previous step. | |||
* Called when the wizard should show the previous step. | |||
* | |||
*/ | |||
void backStep(); | |||
/** | |||
* Called when the wizzard should show the step with the given id. | |||
* Called when the wizard should show the step with the given id. | |||
* | |||
* @param stepID ID of step to show. | |||
*/ | |||
void gotoStep(String stepID); | |||
/** | |||
* Called when the wizzard activity shold be cancelled. | |||
* Called when the wizard activity shold be cancelled. | |||
* | |||
*/ | |||
void cancel(); | |||
/** | |||
* Called when the wizzard is finished. | |||
* Called when the wizard is finished. | |||
* | |||
*/ | |||
void finish(); |
@@ -51,7 +51,7 @@ | |||
* information on the Apache Software Foundation, please see | |||
* <http://www.apache.org/>. | |||
*/ | |||
package org.apache.tools.ant.gui.wizzard; | |||
package org.apache.tools.ant.gui.wizard; | |||
import org.apache.tools.ant.gui.core.ResourceManager; | |||
import javax.swing.*; | |||
@@ -64,13 +64,13 @@ import java.awt.Insets; | |||
import java.util.*; | |||
/** | |||
* Top level container and controller for wizzard-type GUI. | |||
* Top level container and controller for wizard-type GUI. | |||
* | |||
* @version $Revision$ | |||
* @author Simeon Fitch | |||
*/ | |||
public class Wizzard extends JComponent { | |||
/** Resources defining the wizzard contents. Separate from the | |||
public class Wizard extends JComponent { | |||
/** Resources defining the wizard contents. Separate from the | |||
* application context resources. */ | |||
private ResourceManager _resources = null; | |||
/** Container for the step editors. */ | |||
@@ -86,21 +86,21 @@ public class Wizzard extends JComponent { | |||
/** Progress meter. */ | |||
private JProgressBar _progress = null; | |||
/** Widget for navigating through steps. */ | |||
private WizzardNavigator _nav = null; | |||
private WizardNavigator _nav = null; | |||
/** The data model to pass on to each step. */ | |||
private Object _model = null; | |||
/** The current Wizzard step. */ | |||
private WizzardStep _curr = null; | |||
/** The set of wizzard listeners. */ | |||
/** The current Wizard step. */ | |||
private WizardStep _curr = null; | |||
/** The set of wizard listeners. */ | |||
private List _listeners = new ArrayList(1); | |||
/** | |||
* Standard ctor. | |||
* | |||
* @param resources Wizzard definition resources | |||
* @param resources Wizard definition resources | |||
* @param dataModel Initial data model. | |||
*/ | |||
public Wizzard(ResourceManager resources, Object dataModel) { | |||
public Wizard(ResourceManager resources, Object dataModel) { | |||
setLayout(new BorderLayout()); | |||
_resources = resources; | |||
_model = dataModel; | |||
@@ -146,7 +146,7 @@ public class Wizzard extends JComponent { | |||
try { | |||
for(int i = 0; i < steps.length; i++) { | |||
Class type = _resources.getClass(steps[i] + ".editor"); | |||
WizzardStep step = (WizzardStep) type.newInstance(); | |||
WizardStep step = (WizardStep) type.newInstance(); | |||
step.setResources(_resources); | |||
step.setID(steps[i]); | |||
step.setTitle(_resources.getString(steps[i]+ ".title")); | |||
@@ -167,14 +167,14 @@ public class Wizzard extends JComponent { | |||
} | |||
// Initialize the first screen with the data model. | |||
if(steps.length > 0) { | |||
WizzardStep first = (WizzardStep)_steps.get(steps[0]); | |||
WizardStep first = (WizardStep)_steps.get(steps[0]); | |||
first.setDataModel(_model); | |||
_curr = first; | |||
showStep(first); | |||
} | |||
} | |||
catch(Exception ex) { | |||
// If we get here then the wizzard didn't initialize properly. | |||
// If we get here then the wizard didn't initialize properly. | |||
// XXX log me. | |||
ex.printStackTrace(); | |||
} | |||
@@ -182,20 +182,20 @@ public class Wizzard extends JComponent { | |||
} | |||
/** | |||
* Add a wizzard listener. | |||
* Add a wizard listener. | |||
* | |||
* @param l Listener to add. | |||
*/ | |||
public void addWizzardListener(WizzardListener l) { | |||
public void addWizardListener(WizardListener l) { | |||
_listeners.add(l); | |||
} | |||
/** | |||
* Remove a wizzard listener. | |||
* Remove a wizard listener. | |||
* | |||
* @param l Listener to remove. | |||
*/ | |||
public void removeWizzardListener(WizzardListener l) { | |||
public void removeWizardListener(WizardListener l) { | |||
_listeners.remove(l); | |||
} | |||
@@ -204,7 +204,7 @@ public class Wizzard extends JComponent { | |||
* | |||
* @param step Step to go to. | |||
*/ | |||
private void showStep(WizzardStep step) { | |||
private void showStep(WizardStep step) { | |||
if(step == null) return; | |||
// Transfer data model (in case step wants to create a new one. | |||
@@ -230,34 +230,34 @@ public class Wizzard extends JComponent { | |||
_curr = step; | |||
} | |||
/** Handler for actions invoked by wizzard. */ | |||
/** Handler for actions invoked by wizard. */ | |||
private class NavHandler implements NavigatorListener { | |||
public void nextStep() { | |||
String nextID = _curr.getNext(); | |||
if(nextID != null) { | |||
showStep((WizzardStep)_steps.get(nextID)); | |||
showStep((WizardStep)_steps.get(nextID)); | |||
} | |||
} | |||
public void backStep() { | |||
String prevID = _curr.getPrevious(); | |||
if(prevID != null) { | |||
showStep((WizzardStep)_steps.get(prevID)); | |||
showStep((WizardStep)_steps.get(prevID)); | |||
} | |||
} | |||
public void gotoStep(String stepID){ | |||
showStep((WizzardStep) _steps.get(stepID)); | |||
showStep((WizardStep) _steps.get(stepID)); | |||
} | |||
public void cancel() { | |||
Iterator it = _listeners.iterator(); | |||
while(it.hasNext()) { | |||
WizzardListener l = (WizzardListener) it.next(); | |||
WizardListener l = (WizardListener) it.next(); | |||
l.canceled(); | |||
} | |||
} | |||
public void finish() { | |||
Iterator it = _listeners.iterator(); | |||
while(it.hasNext()) { | |||
WizzardListener l = (WizzardListener) it.next(); | |||
WizardListener l = (WizardListener) it.next(); | |||
l.finished(_curr.getDataModel()); | |||
} | |||
} |
@@ -51,17 +51,17 @@ | |||
* information on the Apache Software Foundation, please see | |||
* <http://www.apache.org/>. | |||
*/ | |||
package org.apache.tools.ant.gui.wizzard; | |||
package org.apache.tools.ant.gui.wizard; | |||
/** | |||
* Interface for classes desiring notifiction of when the user | |||
* completes his/her use of wizzard. | |||
* completes his/her use of wizard. | |||
* | |||
* @version $Revision$ | |||
* @author Simeon Fitch | |||
*/ | |||
public interface WizzardListener { | |||
public interface WizardListener { | |||
/** | |||
* Called when the user has clicked the finish button. | |||
* |
@@ -51,9 +51,16 @@ | |||
* information on the Apache Software Foundation, please see | |||
* <http://www.apache.org/>. | |||
*/ | |||
package org.apache.tools.ant.gui.wizzard; | |||
package org.apache.tools.ant.gui.wizard; | |||
public interface WizzardNavigator { | |||
/** | |||
* Interface for classes that control the movement from one step of a | |||
* wizard to another. | |||
* | |||
* @version $Revision$ | |||
* @author Simeon Fitch | |||
*/ | |||
public interface WizardNavigator { | |||
/** | |||
* Add a navigator listener. | |||
* |
@@ -51,18 +51,18 @@ | |||
* information on the Apache Software Foundation, please see | |||
* <http://www.apache.org/>. | |||
*/ | |||
package org.apache.tools.ant.gui.wizzard; | |||
package org.apache.tools.ant.gui.wizard; | |||
import org.apache.tools.ant.gui.core.ResourceManager; | |||
import javax.swing.JComponent; | |||
/** | |||
* Interface for classes defining a step in a wizzard. | |||
* Interface for classes defining a step in a wizard. | |||
* | |||
* @version $Revision$ | |||
* @author Simeon Fitch | |||
*/ | |||
public interface WizzardStep { | |||
public interface WizardStep { | |||
/** | |||
* Set the step's resources. | |||
* | |||
@@ -70,9 +70,9 @@ public interface WizzardStep { | |||
void setResources(ResourceManager resources); | |||
/** | |||
* Set the step id. The id must be unique among steps within the wizzard. | |||
* Set the step id. The id must be unique among steps within the wizard. | |||
* | |||
* @param id Wizzard id. | |||
* @param id Wizard id. | |||
*/ | |||
void setID(String id); | |||
@@ -138,7 +138,7 @@ public interface WizzardStep { | |||
/** | |||
* Set the data model object that the step will edit. It is assumed | |||
* that all steps initialized within a single wizzard agree on the | |||
* that all steps initialized within a single wizard agree on the | |||
* data model type. | |||
* | |||
* @param model Data model to edit. | |||
@@ -155,7 +155,7 @@ public interface WizzardStep { | |||
/** | |||
* Get the component that should be displayed to the user for | |||
* editing the model. This component should <b>not</b> include the | |||
* title and text display, which is handled by the wizzard container. | |||
* title and text display, which is handled by the wizard container. | |||
* | |||
* @return Editing component. | |||
*/ |
@@ -51,9 +51,9 @@ | |||
* information on the Apache Software Foundation, please see | |||
* <http://www.apache.org/>. | |||
*/ | |||
package org.apache.tools.ant.gui.wizzard.build; | |||
package org.apache.tools.ant.gui.wizard.build; | |||
import org.apache.tools.ant.gui.wizzard.AbstractWizzardStep; | |||
import org.apache.tools.ant.gui.wizard.AbstractWizardStep; | |||
import javax.swing.*; | |||
import java.awt.BorderLayout; | |||
import java.awt.FlowLayout; | |||
@@ -61,13 +61,13 @@ import java.awt.GridBagLayout; | |||
import org.apache.tools.ant.gui.acs.*; | |||
/** | |||
* Build file wizzard step for naming the project and | |||
* Build file wizard step for naming the project and | |||
* selecting what features are desired. | |||
* | |||
* @version $Revision$ | |||
* @author Simeon Fitch | |||
*/ | |||
public class ProjectSetupStep extends AbstractWizzardStep { | |||
public class ProjectSetupStep extends AbstractWizardStep { | |||
/** Name of the project. */ | |||
private JTextField _name = null; |