easik.states
Class AddCommutativeDiagramState

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

public class AddCommutativeDiagramState
extends EasikState
implements PathAcceptingState

This state makes a commutative diagram. 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. Once two paths are accepted, it will create the constraint and then add it to the sketch.

Version:
2006-08-15 Kevin Green
Author:
Rob Fletcher 2005, Kevin Green 2006, Vera Ranieri 2006

Field Summary
private  boolean _finished
          Boolean to ascertain whether the selection of paths for this constraint has been finished
private  SketchPath _pathA
          The first path involved in this constraint
private  SketchPath _pathB
          The second path involved in this constraint
 
Fields inherited from class easik.states.EasikState
_ourSketch
 
Constructor Summary
AddCommutativeDiagramState(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 Commutative diagram"
 
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

_pathA

private SketchPath _pathA
The first path involved in this constraint


_pathB

private SketchPath _pathB
The second path involved in this constraint


_finished

private boolean _finished
Boolean to ascertain whether the selection of paths for this constraint has been finished

Constructor Detail

AddCommutativeDiagramState

public AddCommutativeDiagramState(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 add it to the collection. When two paths are in the collection, finish (if they share a domain and codomain).

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 to the sketch, 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 Commutative diagram"

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