All Packages Class Hierarchy This Package Previous Next Index
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.
public abstract void doStateCommand(String command)
public abstract String getCurrentState()
public abstract StateCommandableInfo getStateCommandableInfo()
Since this is used for read only purposes, the info objects may be shared between StateCommandables. This is the Flyweight Pattern, and can modestly reduce resource requirements and increase startup speed.
Most StateCommandables will have static StateCommandableInfo. They are assumeed to return the same info instance each time with the identical data. This allows optimizing assumptions. If the info is dynamic then a new StateCommandableInfo should be returned each time.
All Packages Class Hierarchy This Package Previous Next Index