All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface uhr.core.role.StateCommandable

public interface StateCommandable
This interface allows the state of an class to be changed by commands. Means are avaiable for publishing information about the state machine, allowing the designer, user and other classes to better understand things.

For example one may wish to control the lifecycle of parts, relieving them of that confusing burden and allowing a part framework to achieve higher reuse.

One planned use for this is to allow users to right click on a System Tree part node. The context menu is dynamically built using the current state and StateCommandableInfo. The current state is mentioned and all commands are listed. Those commands not allowable at this time are disabled. The part designer can add unit tests, what ifs, etc for development use, and remove them later.

Special thanks to Wayne Allen for suggesting the default command trick, which he has used in his system designs. He has used this to cycle from an object's initial to terminal state and other things. We could use it to be the default command for a part, such as what happens when a part is double clicked.


Method Index

 o doStateCommand(String)
Performs the command if its present state allows it.
 o getStateCommandableAide()
Returns the aide handling the StateCommandable's state manchine.

Methods

 o getStateCommandableAide
 public abstract StateCommandableAide getStateCommandableAide()
Returns the aide handling the StateCommandable's state manchine.

Returns:
the very handy aide.
 o doStateCommand
 public abstract void doStateCommand(String command)
Performs the command if its present state allows it. This method should not be called directly. Instead call the same method in the aide, which will call this method.

Parameters:
command - the command to perform. It must be in the published list of commands available.
Throws: IllegalArgumentException
if unknown command.
Throws: IllegalStateException
if not in proper state to perform the command. Gee, this is precise. :-)
Throws: RuntimeException
or such if the command fails.

All Packages  Class Hierarchy  This Package  Previous  Next  Index