com.hdcookbook.grin
Interface SENode

All Known Implementing Classes:
SEActivatePartCommand, SEActivateSegmentCommand, SEAssembly, SEBox, SEClipped, SECommandList, SECommandRCHandler, SEFade, SEFixedImage, SEFontStripText, SEGenericCommand, SEGenericFeature, SEGenericModifier, SEGrinXHelper, SEGroup, SEGuaranteeFill, SEImageSequence, SEInterpolatedModel, SEMenuAssembly, SEPlaylist, SEResetFeatureCommand, SERunNamedCommand, SEScalingModel, SESegment, SESegmentDoneCommand, SESetTarget, SESetVisualRCStateCommand, SEShowCommand, SESrcOver, SESyncDisplayCommand, SEText, SETimer, SETranslator, SETranslatorModel, SEVisualRCHandler

public interface SENode

Defines methods needed to compile Show into a binary file. All show elements (Segments, Features, Commands, RCHandlers) that are constructed on the SE side during show compilation are expected to implement this interface.

See Also:
Node

Method Summary
 void accept(SEShowVisitor visitor)
          Calls the visit method corresponding to this node type.
 void changeFeatureReference(Feature from, Feature to)
          Change a feature reference from one feature to a new one.
 java.lang.String getRuntimeClassName()
          Returns the class that should be constructed at Show runtime to represent this SENode.
 void postProcess(ShowBuilder builder)
          Do any needed post-processing in this show.
 void writeInstanceData(GrinDataOutputStream out)
          Record this node information to the binary file format.
 

Method Detail

writeInstanceData

void writeInstanceData(GrinDataOutputStream out)
                       throws java.io.IOException
Record this node information to the binary file format. An implementation of this method is recommended to call out.writeSuperClassData(this) as the first line of the method to write out data defined in the base class of this Node type.

Parameters:
out - The stream to write out.
Throws:
java.io.IOException - if error occurs.
See Also:
GrinDataOutputStream.writeSuperClassData(Feature), GrinDataOutputStream.writeSuperClassData(RCHandler), GrinDataOutputStream.writeSuperClassData(Segment), GrinDataOutputStream.writeSuperClassData(Command)

getRuntimeClassName

java.lang.String getRuntimeClassName()
Returns the class that should be constructed at Show runtime to represent this SENode.

Returns:
String A fully qualified classname of a Node at xlet runtime.

accept

void accept(SEShowVisitor visitor)
Calls the visit method corresponding to this node type.

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.

Parameters:
visitor - SEShowVisitor object.
See Also:
SEShowVisitor

postProcess

void postProcess(ShowBuilder builder)
                 throws java.io.IOException
Do any needed post-processing in this show. The grin compiler works as follows:

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.

Parameters:
builder - The builder that holds state for the show
Throws:
java.io.IOException - if an error is encountered
See Also:
ShowBuilder.addSyntheticFeature(Feature), ShowBuilder.injectParent(Feature, Feature)

changeFeatureReference

void changeFeatureReference(Feature from,
                            Feature to)
                            throws java.io.IOException
Change a feature reference from one feature to a new one. If your node has a reference to the feature 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().

Throws:
java.io.IOException - If the operation can't be completed
See Also:
changeFeatureReference(Feature, Feature)