easik.states
Class AddSumConstraintState

java.lang.Object
  extended by easik.states.EasikState
      extended by easik.states.AddSumConstraintState
All Implemented Interfaces:
PathAcceptingState

public class AddSumConstraintState
extends EasikState
implements PathAcceptingState

This state makes a sum constraint. When pushed, it will then push another state to get a path. Once the first path is received, it will push another request for a path. After adding the first path the options to either add another path or finish the constraint are available.

Since:
2006-05-23 Kevin Green
Version:
2006-08-15 Kevin Green
Author:
Kevin Green 2006, Vera Ranieri 2006

Field Summary
private  boolean _finished
          Stores whether the user has finished adding paths to this constraint
private  java.util.ArrayList<SketchPath> _paths
          The paths involved in this constraint
 
Fields inherited from class easik.states.EasikState
_ourSketch
 
Constructor Summary
AddSumConstraintState(Sketch inSketch)
          Constructor for creating a new state to collect paths and make a diagram.
 
Method Summary
private  boolean addDiagram()
          Add the diagram to the sketch
 void passPath(SketchPath inPath)
          Called when a new path has been completed by a state above this on the stack.
 void poppedOff()
          Nothing to do when it gets popped off, as it always pops itself off when completed.
 void pushedOn()
          When this state is pushed on, it sends a message in a popup and then pushes a path collection state.
 java.lang.String toString()
          This state is called "New Sum Constraint".
 
Methods inherited from class easik.states.EasikState
cancelClicked, finishClicked, gotFocus, nextClicked, resetColors, selectionUpdated, setCancelButton, setFinishButton, setNextButton
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_paths

private java.util.ArrayList<SketchPath> _paths
The paths involved in this constraint


_finished

private boolean _finished
Stores whether the user has finished adding paths to this constraint

Constructor Detail

AddSumConstraintState

public AddSumConstraintState(Sketch inSketch)
Constructor for creating a new state to collect paths and make a diagram.

Parameters:
inSketch - The sketch being worked with.
Method Detail

passPath

public void passPath(SketchPath inPath)
Called when a new path has been completed by a state above this on the stack. If it is null, then cancel, otherwise check to see if the user selected the 'next' or 'finish' option.

Specified by:
passPath in interface PathAcceptingState
Parameters:
inPath - The last path in, null if it was a cancellation

addDiagram

private boolean addDiagram()
Add the diagram to the sketch

Returns:
true if the diagram was successfully added, false otherwise

pushedOn

public void pushedOn()
When this state is pushed on, it sends a message in a popup and then pushes a path collection state.

Specified by:
pushedOn in class EasikState

poppedOff

public void poppedOff()
Nothing to do when it gets popped off, as it always pops itself off when completed.

Specified by:
poppedOff in class EasikState

toString

public java.lang.String toString()
This state is called "New Sum Constraint".

Specified by:
toString in class EasikState
Returns:
The string literal described above.