metasim 01/01/24 11:51:35
Modified: src/antidote/org/apache/tools/ant/gui/wizard/build
BuildData.java CompileStep.java
ProjectSetupStep.java
Added: src/antidote/org/apache/tools/ant/gui/wizard/build
Builder.java
Log:
Incremental update.
Revision Changes Path
1.2 +32 -2
jakarta-ant/src/antidote/org/apache/tools/ant/gui/wizard/build/BuildData.java
Index: BuildData.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/wizard/build/BuildData.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BuildData.java 2001/01/17 22:23:38 1.1
+++ BuildData.java 2001/01/24 19:51:31 1.2
@@ -57,11 +57,12 @@
import org.apache.tools.ant.gui.core.ResourceManager;
import org.apache.tools.ant.gui.acs.*;
import java.util.*;
+import java.io.File;
/**
* Data model for the build wizard.
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
* @author Simeon Fitch
*/
public class BuildData implements WizardData {
@@ -70,7 +71,8 @@
"org.apache.tools.ant.gui.resources.buildFileWizard");
private StateMachine _stateMachine = new BuildStateMachine();
- private String _name = null;
+ private String _name = "MyProject";
+ private File _outputFile = new File("build.xml");
private boolean _isNewProject = true;
private List _optionalSteps = null;
@@ -120,6 +122,25 @@
}
/**
+ * Set the output file.
+ *
+ * @param out Output file.
+ */
+ public void setOutputFile(File out) {
+ _outputFile = out;
+ }
+
+ /**
+ * Get the output file.
+ *
+ * @return Output file.
+ */
+ public File getOutputFile() {
+ return _outputFile;
+ }
+
+
+ /**
* Set whether or not a new project is being created.
*
* @param isNew True if new project, false if importing a project.
@@ -156,4 +177,13 @@
}
+ /**
+ * Convert the state data into a project.
+ *
+ * @return Created project.
+ */
+ public ACSProjectElement createProject() {
+ Builder builder = new Builder(this);
+ return builder.buildProject();
+ }
}
1.2 +4 -1
jakarta-ant/src/antidote/org/apache/tools/ant/gui/wizard/build/CompileStep.java
Index: CompileStep.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/wizard/build/CompileStep.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CompileStep.java 2001/01/17 22:23:38 1.1
+++ CompileStep.java 2001/01/24 19:51:32 1.2
@@ -61,7 +61,7 @@
/**
*
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
* @author Simeon Fitch
*/
public class CompileStep extends AbstractWizardStep implements OptionalStep {
@@ -71,6 +71,9 @@
*
*/
protected void init() {
+
+
+
}
/**
1.3 +21 -4
jakarta-ant/src/antidote/org/apache/tools/ant/gui/wizard/build/ProjectSetupStep.java
Index: ProjectSetupStep.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/wizard/build/ProjectSetupStep.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ProjectSetupStep.java 2001/01/17 22:23:38 1.2
+++ ProjectSetupStep.java 2001/01/24 19:51:33 1.3
@@ -54,17 +54,20 @@
package org.apache.tools.ant.gui.wizard.build;
import org.apache.tools.ant.gui.wizard.AbstractWizardStep;
+import org.apache.tools.ant.gui.util.LabelFieldGBC;
+import org.apache.tools.ant.gui.customizer.FilePropertyEditor;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridBagLayout;
import java.util.*;
+import java.io.File;
/**
* Build file wizard step for naming the project and
* selecting what features are desired.
*
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
* @author Simeon Fitch
*/
public class ProjectSetupStep extends AbstractWizardStep {
@@ -89,7 +92,10 @@
/** Name of the project. */
private JTextField _name = null;
+ /** Control for selecting a file. */
+ private FilePropertyEditor _fileEditor = null;
+
/**
* Initialize the screen widgets.
*
@@ -97,12 +103,19 @@
protected void init() {
setLayout(new BorderLayout());
- JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
+ LabelFieldGBC gbc = new LabelFieldGBC();
+ JPanel p = new JPanel(new GridBagLayout());
add(p, BorderLayout.NORTH);
+ _fileEditor = new FilePropertyEditor();
+ p.add(new JLabel(
+ getResources().getString(getID() + ".fileLabel")),
gbc.forLabel());
+ p.add(_fileEditor.getCustomEditor(), gbc.forField());
+
_name = new JTextField(10);
- p.add(new JLabel(getResources().getString(getID() + ".nameLabel")));
- p.add(_name);
+ p.add(new JLabel(
+ getResources().getString(getID() + ".nameLabel")),
gbc.forLabel());
+ p.add(_name, gbc.forField());
p = new JPanel(null);
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
@@ -131,6 +144,8 @@
BuildData data = (BuildData) getDataModel();
_name.setText(data.getProjectName());
+ _fileEditor.setValue(data.getOutputFile());
+
// Steps.
List steps = data.getOptionalSteps();
if(steps != null) {
@@ -149,6 +164,8 @@
// Name.
BuildData data = (BuildData) getDataModel();
data.setProjectName(_name.getText());
+
+ data.setOutputFile((File)_fileEditor.getValue());
// Steps.
List steps = new ArrayList();
1.1
jakarta-ant/src/antidote/org/apache/tools/ant/gui/wizard/build/Builder.java
Index: Builder.java
===================================================================
/*
* 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 [EMAIL PROTECTED]
*
* 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
* <http://www.apache.org/>.
*/
package org.apache.tools.ant.gui.wizard.build;
import org.apache.tools.ant.gui.acs.*;
/**
* Class that takes care of converting the wizard state data stored in
* BuildData and translates it into a build file.
*
* @version $Revision: 1.1 $
* @author Simeon Fitch
*/
public class Builder {
/** Build data. */
private BuildData _data = null;
/**
* Constructor.
*
* @param data Build data to create project from.
*/
public Builder(BuildData data) {
_data = data;
}
/**
* Convert build data into a project.
*
* @return Project.
*/
public ACSProjectElement buildProject() {
ACSProjectElement retval = ACSFactory.getInstance().createProject();
retval.setName(_data.getProjectName());
return retval;
}
}