com.hdcookbook.grin.fontstrip
Class SEFontStripText

java.lang.Object
  extended by com.hdcookbook.grin.Feature
      extended by com.hdcookbook.grin.fontstrip.FontStripText
          extended by com.hdcookbook.grin.fontstrip.SEFontStripText
All Implemented Interfaces:
Node, SENode, SEScalableNode, SetupClient

public class SEFontStripText
extends FontStripText
implements SENode, SEScalableNode


Field Summary
 
Fields inherited from class com.hdcookbook.grin.fontstrip.FontStripText
alignment, background, BASELINE, BOTTOM, fontImageFileName, hspace, INFOFILE, LEFT, MIDDLE, RIGHT, strings, TOP, vspace, xArg, yArg
 
Fields inherited from class com.hdcookbook.grin.Feature
name, show
 
Constructor Summary
SEFontStripText(Show show)
           
SEFontStripText(Show show, int xArg, int yArg, int alignment, java.lang.String[] strings, java.lang.String fileName, int hspace, int vspace, java.awt.Color background)
           
 
Method Summary
 void accept(SEShowVisitor visitor)
          For a visitor method
 void changeFeatureReference(Feature from, Feature to)
          Change a feature reference from one feature to a new one.
 java.lang.String getRuntimeClassName()
          For xlet runtime, FonrStripText class instance should be used.
 void postProcess(ShowBuilder builder)
          Do any needed post-processing in this show.
 void scaleBy(int xScale, int yScale, int xOffset, int yOffset)
          Scale this node by the given scale factor, and apply the given offset.
 java.lang.String toString()
          
 void writeInstanceData(GrinDataOutputStream out)
          Record this node information to the binary file format.
 
Methods inherited from class com.hdcookbook.grin.fontstrip.FontStripText
addDisplayAreas, destroy, doSomeSetup, getLineHeight, getText, getX, getY, initialize, markDisplayAreasChanged, needsMoreSetup, nextFrame, paintFrame, readInstanceData, setActivateMode, setSetupMode, setText
 
Methods inherited from class com.hdcookbook.grin.Feature
activate, addSubgraph, cloneCommands, clonedReference, cloneSubgraph, createClone, deactivate, destroyClonedSubgraph, getName, initializeClone, isSetup, makeNewClone, resetFeature, sendFeatureSetup, setName, setup, unsetup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SEFontStripText

public SEFontStripText(Show show)

SEFontStripText

public SEFontStripText(Show show,
                       int xArg,
                       int yArg,
                       int alignment,
                       java.lang.String[] strings,
                       java.lang.String fileName,
                       int hspace,
                       int vspace,
                       java.awt.Color background)
Method Detail

writeInstanceData

public void writeInstanceData(GrinDataOutputStream out)
                       throws java.io.IOException
Description copied from interface: SENode
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.

Specified by:
writeInstanceData in interface SENode
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

public java.lang.String getRuntimeClassName()
For xlet runtime, FonrStripText class instance should be used.

Specified by:
getRuntimeClassName in interface SENode
Returns:
String A fully qualified classname of a Node at xlet runtime.

accept

public void accept(SEShowVisitor visitor)
For a visitor method

Specified by:
accept in interface SENode
Parameters:
visitor - SEShowVisitor object.
See Also:
SEShowVisitor

postProcess

public 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.

Specified by:
postProcess in interface SENode
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

public void changeFeatureReference(Feature from,
                                   Feature to)
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().

Specified by:
changeFeatureReference in interface SENode
See Also:
SENode.changeFeatureReference(Feature, Feature)

scaleBy

public void scaleBy(int xScale,
                    int yScale,
                    int xOffset,
                    int yOffset)
Scale this node by the given scale factor, and apply the given offset. This will change the size of the features and RC handlers within the show at compile time, so no special scaling action is required at runtime.

Note that you must also build the font strip .png image with the same scale factors.

Specified by:
scaleBy in interface SEScalableNode
Parameters:
xScale - x scale factor in mills
yScale - y scale factor in mills
xOffset - x offset in pixels
yOffset - y offset in pixels

toString

public java.lang.String toString()

Overrides:
toString in class Feature
Returns:
a developer-friendly description of this feature, for debugging