uci.argo.kernel
Class Wizard

java.lang.Object
  |
  +--uci.argo.kernel.Wizard
Direct Known Subclasses:
WizAssocComposite, WizBreakCircularComp, WizCueCards, WizManyNames, WizMEName, WizNavigable

public abstract class Wizard
extends Object
implements Serializable

"Abstract" base class for non-modal wizards. Each subclass should define its own makeNextPanel methods. Because most wizards will not be run to completion, the panels are constructed only as needed. This implies that Wizards should no initialize many instance variables in their constructors.

By convention step 0 is the problem description of the ToDoItem, step 1 is the first panel displayed after the user presses "Next>", and so on. The problem description panel is not stored in this wizard, only the panels that are specific to the wizard are stored. If the user presses "Back>" enough times to get back to the problem description, backPanel should return null. A null panel indicates that problem description should be shown.

Several of the comments in this class refer to "context". Context is the data about this execution of this wizard, for example, valus that the user enters in step 1 is part of the context of later steps, and the ToDoItem with its offenders Set is always context. Most context should be stored in instance variables of Wizard subclasses.

See Also:
Serialized Form

Field Summary
protected  boolean _finished
          True when the wizard has done everything it can.
protected  ToDoItem _item
           
protected  Vector _panels
          User interface panels displayed so far.
protected  boolean _started
           
protected  int _step
          The current step that the Wizard is on.
 
Constructor Summary
Wizard()
          Construct a new wizard to help the user repair a design flaw.
 
Method Summary
 void back()
           
 boolean canFinish()
           
 boolean canGoBack()
           
 boolean canGoNext()
          Return true iff the "Next>" button should be enabled.
 void doAction()
           
abstract  void doAction(int oldStep)
          Take action at the completion of a step.
 void finish()
           
 JPanel getCurrentPanel()
          Get the panel that should be displayed now.
abstract  int getNumSteps()
          Get the number of steps in this wizard.
 JPanel getPanel(int s)
          Get the exising panel at step s.
 int getProgress()
          An integer between 0 and 100, shows percent done.
 ToDoItem getToDoItem()
           
 boolean isFinsished()
           
 boolean isStarted()
           
abstract  JPanel makePanel(int newStep)
          Create a new panel for the given step.
 void next()
           
 void redoAction()
           
 void redoAction(int oldStep)
          Redo the action at the completion of a step.
 void setToDoItem(ToDoItem item)
           
 void undoAction()
           
 void undoAction(int oldStep)
          Undo the action done after the given step.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_panels

protected Vector _panels
User interface panels displayed so far.

_step

protected int _step
The current step that the Wizard is on. Zero indicates that the wizard has not yet begun.

_finished

protected boolean _finished
True when the wizard has done everything it can.

_started

protected boolean _started

_item

protected ToDoItem _item
Constructor Detail

Wizard

public Wizard()
Construct a new wizard to help the user repair a design flaw.
Method Detail

setToDoItem

public void setToDoItem(ToDoItem item)

getToDoItem

public ToDoItem getToDoItem()

getProgress

public int getProgress()
An integer between 0 and 100, shows percent done. The current Argo/UML user itnerface shows different PostIt note icons for 0, 1-25, 26-50. 51-75, and 76-100.

getNumSteps

public abstract int getNumSteps()
Get the number of steps in this wizard. Subclasses should override to return a constant, or compute based on context.

getCurrentPanel

public JPanel getCurrentPanel()
Get the panel that should be displayed now. Usually called after the user pressed "Next>" and next() has returned, or after the user pressed "

getPanel

public JPanel getPanel(int s)
Get the exising panel at step s. Step 1 is the first wizard panel.

canGoNext

public boolean canGoNext()
Return true iff the "Next>" button should be enabled. Subclasses should override to first check super.nextEnabled() and then check for legal context values.

next

public void next()

canGoBack

public boolean canGoBack()

back

public void back()

canFinish

public boolean canFinish()

isStarted

public boolean isStarted()

isFinsished

public boolean isFinsished()

finish

public void finish()

makePanel

public abstract JPanel makePanel(int newStep)
Create a new panel for the given step. For example, When the given step is 1, create the first step of the wizard.

Needs-More-Work: It might be convient to make a reusable subclass of Wizard that shows all textual steps to guide the user without any automation. Such a Wizard could be easily authored, stored in an XML file, and effiecntly presented by reusing a single panel with a single JTextArea.


doAction

public abstract void doAction(int oldStep)
Take action at the completion of a step. For example, when the given step is 0, do nothing; and when the given step is 1, do the first action. Argo non-modal wizards should take action as they do along, as soon as possible, they should not wait until the final step. Also, if the user pressed "Finish" doAction may be called for steps that never constructored or displayed their panels.

doAction

public void doAction()

undoAction

public void undoAction(int oldStep)
Undo the action done after the given step. For example, when the given step is 0, nothing was done, so nothing can be undone; and when the given step is 1, undo the first action. Undo allows users to work part way through fixing a problem, see the partial result, and explore a different alternative.

undoAction

public void undoAction()

redoAction

public void redoAction(int oldStep)
Redo the action at the completion of a step. For example, when the given step is 0, nothing was done, so redo nothing; and when the given step is 1, redo the first action. This implementation simply calls doAction().

redoAction

public void redoAction()