|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.hdcookbook.grin.commands.Command com.hdcookbook.grin.SEShowCommand
public class SEShowCommand
Represents an individual command that is defined in-line in a show file. An SEShowCommand participates in generating the Xlet subclass of Command for a show. It also runs something reasonable in SE emulation mode.
SEShowCommands
Field Summary |
---|
Fields inherited from class com.hdcookbook.grin.commands.Command |
---|
show |
Method Summary | |
---|---|
void |
accept(SEShowVisitor visitor)
Calls the visit method corresponding to this node type. |
java.lang.String |
addSubCommand(Command cmd)
Adds a sub-command to this command object. |
void |
changeFeatureReference(Feature from,
Feature to)
Change a feature reference from one feature to a new one. |
void |
execute()
Execute the command. |
void |
execute(Show caller)
Execute the command. |
int |
getCommandNumber()
|
java.lang.String |
getGrinviewMethodBody()
Returns Grinview method body for this command. |
java.lang.String |
getJavaSource(boolean xlet)
|
java.lang.String |
getOriginalSource()
Returns the original source as specified in Show script file. |
java.lang.String |
getRuntimeClassName()
Returns the class that should be constructed at Show runtime to represent this SENode. |
Command[] |
getSubCommands()
|
java.lang.String |
getXletMethodBody()
Returns Xlet method body for this command. |
void |
postProcess(ShowBuilder builder)
Do any needed post-processing in this show. |
void |
setGrinviewMethodBody(java.lang.String methodBody)
Sets the java source of the body of the method for the GrinView version. |
void |
setOriginalSource(java.lang.String originalSource)
Sets the original source as specified in Show file. |
void |
setXletMethodBody(java.lang.String methodBody)
Sets the java source of the body of the method for the JavaSE version. |
java.lang.String |
toString()
Return a user-friendly string for this command for debugging purposes. |
void |
writeInstanceData(GrinDataOutputStream out)
Record this node information to the binary file format. |
Methods inherited from class com.hdcookbook.grin.commands.Command |
---|
cloneIfNeeded, deferNextCommands |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public java.lang.String addSubCommand(Command cmd)
cmd
- The command to add
public int getCommandNumber()
public Command[] getSubCommands()
public void setGrinviewMethodBody(java.lang.String methodBody) throws java.io.IOException
methodBody
-
java.io.IOException
public java.lang.String getGrinviewMethodBody()
public void setXletMethodBody(java.lang.String methodBody) throws java.io.IOException
methodBody
-
java.io.IOException
public java.lang.String getXletMethodBody()
public java.lang.String getJavaSource(boolean xlet)
public java.lang.String getOriginalSource()
public void setOriginalSource(java.lang.String originalSource)
public void execute(Show caller)
execute
in class Command
caller
- The show that is executing this command. This might
not be the same as the show this command was created
under.public void execute()
execute
in class Command
public void writeInstanceData(GrinDataOutputStream out) throws java.io.IOException
SENode
writeInstanceData
in interface SENode
out
- The stream to write out.
java.io.IOException
- if error occurs.GrinDataOutputStream.writeSuperClassData(Feature)
,
GrinDataOutputStream.writeSuperClassData(RCHandler)
,
GrinDataOutputStream.writeSuperClassData(Segment)
,
GrinDataOutputStream.writeSuperClassData(Command)
public java.lang.String getRuntimeClassName()
SENode
getRuntimeClassName
in interface SENode
public void accept(SEShowVisitor visitor)
SENode
If you are defining a user-defined feature, there are some
restrictions that you'll want to follow. If your extension is
a feature that has children, then you should make it a subclass
of one of the built-in feature types, Assembly, Modifer or Group.
That's because the GRIN compiler defines visitors that need to
visit every node in the tree, but these built-in visitors don't
know about your extension types. By making your extension type
a subclass of one of the standard ones, and by making your
accept()
method call either
visitAssembly()
, visitGroup()
or
visitUserDefinedModifier()
, as appropriate,
you'll ensure that all the children get visited.
accept
in interface SENode
visitor
- SEShowVisitor object.SEShowVisitor
public void postProcess(ShowBuilder builder) throws java.io.IOException
During the post-process phase, a node can add new features to the
show, by calling ShowBuilder.addSyntheticFeature()
,
and it can insert a new feature as the parent of a given feature,
by calling ShowBuilder.injectParent()
. It can also
add segments and handlers by calling the appropriate builder methods.
When a parent is injected, the ShowBuilder calls postProcess() on all nodes automatically, including nodes that are created during the execution of postProcess() in another node.
postProcess
in interface SENode
builder
- The builder that holds state for the show
java.io.IOException
- if an error is encounteredShowBuilder.addSyntheticFeature(Feature)
,
ShowBuilder.injectParent(Feature, Feature)
public void changeFeatureReference(Feature from, Feature to) throws java.io.IOException
from
, it should be
changed to refer to to
. This is called for every node
in an SEShow when SENode.injectParent
is used.
The ShowBuilder calls changeFeatureReference() on all nodes automatically, including nodes that are created during the execution of postProcess().
changeFeatureReference
in interface SENode
java.io.IOException
- If the operation can't be completedSENode.changeFeatureReference(Feature, Feature)
public java.lang.String toString()
toString
in class Command
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |