easik
Class StateManager

java.lang.Object
  extended by easik.StateManager

public class StateManager
extends java.lang.Object

The state manager is a class that keeps track of the current state of the program. Different states are used in order to interpret more complicated inputs. An example of this would be the process needed to create a commutative diagram. First there are several clicks required to select each path. Paths can listen to what's going on with the UI, and can change and collect information that way. The state manager works like a stack. New states are pushed on top and then the state manager forwards any important messages up to the active state.

Version:
2006-05-30 Vera Ranieri
Author:
Rob Fletcher 2005, Vera Ranieri 2006

Field Summary
private  boolean _finished
          Boolean to record whether the user has pressed the Finish button.
private  java.util.LinkedList<EasikState> _states
          The stack.
 
Constructor Summary
StateManager(Easik inApp)
          Initialize the state manager
 
Method Summary
 void cancelClicked()
          Informs the top element that the cancel button has been clicked.
 void finishClicked()
          Informs the top element that the finish button has been clicked.
 boolean getFinished()
          Gets the value currently stored in finsihed
 void nextClicked()
          Informs the top element that the next button has been clicked
 EasikState peekState()
          Non destructively take a look at the top item on the stack.
 EasikState popState()
          Pop the state off of the top of the stack.
 void pushState(EasikState toPush)
          Pushes a state onto the stack, calls the 'pushed on' hook after being added.
 void resetFinished()
          Resets the value of finsihed to false
 void selectionUpdated()
          Hook for informing the current active state that the selection has been updated
 void updateStatus()
          When called, this sends an updated state status string to the status bar
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_finished

private boolean _finished
Boolean to record whether the user has pressed the Finish button.


_states

private java.util.LinkedList<EasikState> _states
The stack.

Constructor Detail

StateManager

public StateManager(Easik inApp)
Initialize the state manager

Parameters:
inApp - The current instance of this application
Method Detail

selectionUpdated

public void selectionUpdated()
Hook for informing the current active state that the selection has been updated


peekState

public EasikState peekState()
Non destructively take a look at the top item on the stack.

Returns:
The top state

popState

public EasikState popState()
Pop the state off of the top of the stack. After the state has been popped the 'popped' hook is called.

Returns:
The popped state

pushState

public void pushState(EasikState toPush)
Pushes a state onto the stack, calls the 'pushed on' hook after being added.

Parameters:
toPush - The new state being pushed on

updateStatus

public void updateStatus()
When called, this sends an updated state status string to the status bar


nextClicked

public void nextClicked()
Informs the top element that the next button has been clicked


cancelClicked

public void cancelClicked()
Informs the top element that the cancel button has been clicked.


finishClicked

public void finishClicked()
Informs the top element that the finish button has been clicked.

Since:
2006-05-30 Vera Ranieri

getFinished

public boolean getFinished()
Gets the value currently stored in finsihed

Returns:
True if the user has selected finished, false otherwise.
Since:
2006-05-30 Vera Ranieri

resetFinished

public void resetFinished()
Resets the value of finsihed to false

Since:
2006-05-30 Vera Ranieri