org.argouml.uml.cognitive.critics
Class WizAssocComposite

java.lang.Object
  |
  +--org.argouml.kernel.Wizard
        |
        +--org.argouml.uml.cognitive.critics.WizAssocComposite
All Implemented Interfaces:
java.io.Serializable

public class WizAssocComposite
extends Wizard

A non-modal wizard to assist the user in changing aggregation of an association.

Earlier version always imposed composite aggregation. This version allows the user to choose.

Note. This only applies to binary associations. A separate wizard is needed for 3-way (or more) associations.

See Also:
ArgoUML User Manual: Two Aggregate ends (roles) in binary Association, Serialized Form

Field Summary
protected static Category cat
           
 
Fields inherited from class org.argouml.kernel.Wizard
_finished, _item, _panels, _started, _step
 
Constructor Summary
WizAssocComposite()
          Constructor for the wizard.
 
Method Summary
 boolean canFinish()
          Determine if we have sufficient information to finish.
 void doAction(int oldStep)
          Take action at the completion of a step.
 int getNumSteps()
          Returns the number of steps in this wizard.
 javax.swing.JPanel makePanel(int newStep)
          Create a JPanel for the given step.
 void setInstructions(java.lang.String s)
          Set the initial instruction string for the choice.
 
Methods inherited from class org.argouml.kernel.Wizard
back, canGoBack, canGoNext, doAction, finish, getCurrentPanel, getPanel, getProgress, getToDoItem, isFinished, isStarted, next, setToDoItem, undoAction, undoAction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cat

protected static Category cat
Constructor Detail

WizAssocComposite

public WizAssocComposite()

Constructor for the wizard. Currently does nothing.

Method Detail

getNumSteps

public int getNumSteps()

Returns the number of steps in this wizard.

Specified by:
getNumSteps in class Wizard
Returns:
The number of steps (excluding the initial explanation) in this wizard (1).
See Also:
Wizard

setInstructions

public void setInstructions(java.lang.String s)

Set the initial instruction string for the choice. May be called by the creator of the wizard to override the default.


makePanel

public javax.swing.JPanel makePanel(int newStep)

Create a JPanel for the given step.

We use a WizStepChoice to handle the choice selection for the user. We only create the panel once, saving it in a private field (_step1Choice) for subsequent use.

Note. If the association has been deleted, then we may not be able to create a vector of options. Under these circumstances we also return null.

Specified by:
makePanel in class Wizard
Parameters:
newStep - The index of the step for which a panel is needed.
Returns:
The created JPanel or null if no options were available.
See Also:
Wizard

doAction

public void doAction(int oldStep)

Take action at the completion of a step.

The guideline for ArgoUML non-modal wizards is to act immediately, not wait for the finish. This method may also be invoked when finish is triggered for any steps whose panels didn't get created.

The observation is that this seems to be trigged when there is any change on the panel (e.g choosing an option), not just when "next" is pressed. Coded accordingly

We allow for the association that caused the problem having by now been deleted, and hence an exception may be raised. We catch this politely.

Specified by:
doAction in class Wizard
Parameters:
oldStep - The index of the step just completed (0 for the first information panel)
See Also:
Wizard

canFinish

public boolean canFinish()

Determine if we have sufficient information to finish.

We can't finish if our parent Wizard can't finish.

We can finish if we're on step 0.

We can finish if we're on step 1 and have made a choice.

Overrides:
canFinish in class Wizard
Returns:
true if we can finish, otherwise false.
See Also:
Wizard


ArgoUML © 1996-2003 (20040229)ArgoUML Project HomeArgoUML Cookbook