Dude,

I attached the java files for a struts prototype. Not to confuse you but to give you a fresh idea of the composition of the interfaces.

I am extremely picky about clean understandable functional concise interfaces that model the natural world.

But this is a fun task. And if you nail it (which should take no more than 3 days) you will feel proud.

Anybody that delivers incomplete code should rightfully receive a hard pie to the face. I have your source code on my build tree but have not been inspired enough to begin exercising those. This one may cause me to consider your library. So you have my confidence.

Holler if you need any assistance.

Hoping for the best.

Best regards
Ken in nashua

_________________________________________________________________
The average US Credit Score is 675. The cost to see yours: $0 by Experian. http://www.freecreditreport.com/pm/default.aspx?sc=660600&bcd=EMAILFOOTERAVERAGE
package common.wizard;

import org.apache.struts.action.ActionForward;

public class EventForward extends ActionForward {

    public static final ActionForward WIZARD_RELOAD =
            new ActionForward();

    public EventForward() {
        super(null, true);
    }

    public EventForward(String path) {
        super(path, true);
    }
}

package common.wizard;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionMapping;

public interface INavigation
{
    public String wizardCancel();
    public String wizardBack();
    public String wizardNext();
    //public void dispose() throws Throwable;
    //public void finalize() throws Throwable;
    public void reset(ActionMapping mapping, HttpServletRequest request);
}
package common.wizard;

import common.wizard.Step;

public interface ITransition {
	public boolean onTransition(Step step);
}
package common.wizard;

import common.wizard.Step;

public interface IWizard {
	//public Wizard getInstance();
	public Step getInitialStep();
	public Step getCurrentStep();
	public Step getLastStep();
	public void setCurrentStep (Step value);
	public void destroyInstance();
}
package common.wizard;

public class Step extends Object {
	public String id = null;
	public String description = null;
	public String forward = null;
	public Step backStep = null;
	public Step nextStep = null;

	public Step (String id, String description, String forward)
	{
		this.id = id;
		this.description = description;
		this.forward = forward;
	}

	public String getId () { return id; }
	public String getDescription () { return description; }
	public Step getBackStep () { return backStep; }
	public Step getNextStep () { return nextStep; }
	public String getForward () { return this.forward; }

	public void setBackStep (Step step) { this.backStep = step; }
	public void setNextStep (Step step) { this.nextStep = step; }

	public boolean equals (Step rhs)
	{
		if ( this.id.equalsIgnoreCase(rhs.getId()) )
			return true;
		return false;
	}
}
package common.wizard;

import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;
import org.apache.struts.config.ForwardConfig;


import java.util.Iterator;

/**
 * Created by IntelliJ IDEA.
 * User: mjouravlev
 * Date: Jul 20, 2005
 * Time: 12:06:41 PM
 * To change this template use Options | File Templates.
 */
public class WizardMapping extends ActionMapping {

    /**
     * Path to the default view, usually JSP page.
     */
    protected String view;

    /**
     * Returns the path to the default view of a corresponding dialog.
     */
    public String getView() {
        return (this.view);
    }

    /**
     * @param view the path to the default view of a corresponding dialog.
     */
    public void setView(String view) {
        if (configured) {
            throw new IllegalStateException("Configuration is frozen");
        }
        this.view = view;
    }

    /**
     * Return name of the form bean, if any, associated with this Action.
     */
    public String getForm() {
        return super.getName();
    }

    /**
     * @param name name of the form bean associated with this Action.
     */
    public void setForm(String name) {
        super.setName(name);
    }



    public WizardMapping() {
        super.setScope("session");
        super.setValidate(false);
    }

    public ActionForward reload() {
        return EventForward.WIZARD_RELOAD;
    }

    /**
     * Return the forward configuration for the specified key, if any;
     * otherwise return <code>null</code>.
     *
     * @param name Name of the forward configuration to return
     */
    public ForwardConfig findForwardConfig(String name) {
        // Standard Struts quick search for simple event name
        ForwardConfig forwardConfig = (ForwardConfig) forwards.get(name);
        if (forwardConfig != null) {
            return forwardConfig;
        }

        // Slow search for multi-name; do not use for heavy-traffic sites.
        // Will work properly, if mappings are separated (comma, space, whatever)
        Iterator fwIte = forwards.keySet().iterator();
        while (fwIte.hasNext()) {
            String key = (String) fwIte.next();
            if (key.indexOf(name) > -1) {
                return (ForwardConfig) forwards.get(key);
            }
        }

        return null;
    }
}

package common.wizard;


/**
 * Wizard has state - the state hierarchy
 * Wizard has dispatch - struts action
 * Wizard has transition - actionForm formbean
 *
 * @author Ken Colassi
 * This wizard defines potentially 6 steps and maintains state
 */
public abstract class Wizard
	implements IWizard
{
	static public final String EVENT = "Wizard.EVENT";
	static public final String RESUME = "Wizard.Resume";

	static public final String STEPONE = "Wizard.StepOne";
	static public final String STEPTWO = "Wizard.StepTwo";
	static public final String STEPTHREE = "Wizard.StepThree";
	static public final String STEPFOUR = "Wizard.StepFour";
	static public final String STEPFIVE = "Wizard.StepFive";
	static public final String STEPSIX = "Wizard.StepSix";
	static public final String CONFIRM = "Wizard.Confirm";
	static public final String DONE = "Wizard.Done";

	static public final String WIZARD_ACTION_CANCEL = "Wizard.Cancel";
	static public final String WIZARD_ACTION_NEXT = "Wizard.Next";
	static public final String WIZARD_ACTION_BACK = "Wizard.Back";
	static public final String WIZARD_ACTION_CONFIRM = "Wizard.Confirm";
	static public final String WIZARD_ACTION_DONE = "Wizard.Done";

	protected Step initialStep = null;
	protected Step currentStep = null;
	protected Step lastStep = null;

	public Step getInitialStep() { return initialStep; }
	public Step getCurrentStep() { return currentStep; }
	public Step getLastStep() { return lastStep; }
	public synchronized void setCurrentStep (Step value) { this.currentStep = value; }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to