com.hdcookbook.grin
Class SEShowCommands

java.lang.Object
  extended by com.hdcookbook.grin.SEShowCommands

public class SEShowCommands
extends java.lang.Object

Represents the commands that are defined in-line in a show file. All of the commands are combined together into one command class that is included with the xlet. There's also a facility to make a different version of the commands class that can run under JavaSE during debugging.

For JavaSE, the SEShowCommands object emits a java source file. Ideally, you should generate this source file, compile it, then link GrinView against it, even if you're reading a source text file with GrinView. If you don't, it's OK: GrinView will provide a default command implementation that prints out the source of what would have been executed, rather than trying to run the command.

This class compiled from the source file that this class emits is pretty much a requirement to be present if your show includes any custom extension and executing a binary file, meanwhile. SEShowCommands generates some code to indicate how to instantiate custom extensions.

Author:
Bill Foote (http://jovial.com)

Method Summary
 SEShowCommand addNewCommand()
           
 void appendXletClassBody(java.lang.String classBody)
           
 java.lang.String getClassName()
           
 java.lang.Class getCommandClass()
           
 java.lang.String getGrinviewClassBody()
          Returns grinview class body string.
 java.lang.String getJavaSource(boolean forXlet, java.lang.String moreCode)
          Get the java source for the class implementing this show's command.
 java.lang.String getOriginalSource()
           
 java.lang.String getXletClassBody()
          Returns xlet class body string.
 void setClassName(java.lang.String className)
          Set the fully-qualified name of the class to generate for the xlet
 void setGrinviewClassBody(java.lang.String classBody)
          Adds to the java source of the body of the class for the GrinView version.
 void setOriginalSource(java.lang.String originalSource)
           
 void setXletClassBody(java.lang.String classBody)
          Adds to the java source of the body of the class for the JavaSE version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setClassName

public void setClassName(java.lang.String className)
Set the fully-qualified name of the class to generate for the xlet

Parameters:
className - The name

getCommandClass

public java.lang.Class getCommandClass()

getClassName

public java.lang.String getClassName()
Returns:
the show class name, or null if not set.

addNewCommand

public SEShowCommand addNewCommand()

setGrinviewClassBody

public void setGrinviewClassBody(java.lang.String classBody)
                          throws java.io.IOException
Adds to the java source of the body of the class for the GrinView version. The special string JAVA_COMMAND_BODY must occur somewhere in the string. This will be replaced by the automatically-generated methods.

Parameters:
classBody -
Throws:
java.io.IOException - If there's an error, like the absence of JAVA_COMMAND_BODY

getGrinviewClassBody

public java.lang.String getGrinviewClassBody()
Returns grinview class body string.


setXletClassBody

public void setXletClassBody(java.lang.String classBody)
                      throws java.io.IOException
Adds to the java source of the body of the class for the JavaSE version. The special string JAVA_COMMAND_BODY must occur somewhere in the string. This will be replaced by the automatically-generated methods.

Parameters:
classBody -
Throws:
java.io.IOException - If there's an error, like the absence of JAVA_COMMAND_BODY

getXletClassBody

public java.lang.String getXletClassBody()
Returns xlet class body string.


setOriginalSource

public void setOriginalSource(java.lang.String originalSource)

getOriginalSource

public java.lang.String getOriginalSource()

appendXletClassBody

public void appendXletClassBody(java.lang.String classBody)

getJavaSource

public java.lang.String getJavaSource(boolean forXlet,
                                      java.lang.String moreCode)
Get the java source for the class implementing this show's command.

Parameters:
forXlet - true if the code to emit is for the xlet to use, false if it's meant for GrinView on big jdk to use.
moreCode - code to append to the end of the generated code.
Returns:
The java source, or null if there are no commands to be emitted.