|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.hdcookbook.grin.Feature com.hdcookbook.grin.io.text.SEGenericFeature
public abstract class SEGenericFeature
This is a generic SEFeature class in which the ExtensionParser implementation can choose to subclass. This is meant to be used for the show compile time only.
Field Summary |
---|
Fields inherited from class com.hdcookbook.grin.Feature |
---|
name, show |
Constructor Summary | |
---|---|
SEGenericFeature(Show show)
|
Method Summary | |
---|---|
void |
accept(SEShowVisitor visitor)
Calls the visit method corresponding to this node type. |
void |
addDisplayAreas(RenderContext context)
Add all of the areas that are displayed for this feature with the current frame. |
void |
changeFeatureReference(Feature from,
Feature to)
Change a feature reference from one feature to a new one. |
void |
destroy()
Free any resources held by this feature. |
void |
doSomeSetup()
|
int |
getX()
Get the upper-left hand corner of this feature as presently displayed. |
int |
getY()
Get the upper-left hand corner of this feature as presently displayed Return Integer.MAX_VALUE if this feature has no visible representation. |
void |
initialize()
Initialize this feature. |
boolean |
needsMoreSetup()
This is where the feaure says whether or not it needs more setup. |
void |
nextFrame()
Called from Segment with the Show lock held, to advance us to the state we should be in for the next frame. |
void |
paintFrame(java.awt.Graphics2D gr)
Paint the current state of this feature to gr. |
void |
postProcess(ShowBuilder builder)
Do any needed post-processing in this show. |
protected void |
setActivateMode(boolean mode)
Change the activated mode of this feature. |
protected int |
setSetupMode(boolean mode)
Change the setup mode of this feature. |
Methods inherited from class com.hdcookbook.grin.Feature |
---|
activate, addSubgraph, cloneCommands, clonedReference, cloneSubgraph, createClone, deactivate, destroyClonedSubgraph, getName, initializeClone, isSetup, makeNewClone, markDisplayAreasChanged, resetFeature, sendFeatureSetup, setName, setup, toString, unsetup |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.hdcookbook.grin.SENode |
---|
getRuntimeClassName, writeInstanceData |
Constructor Detail |
---|
public SEGenericFeature(Show show)
Method Detail |
---|
public int getX()
Feature
getX
in class Feature
public int getY()
Feature
getY
in class Feature
public void initialize()
Feature
initialize
in class Feature
public void destroy()
Feature
Features are deactivated before they are destroyed. For example, the last segment a show is in when the show is destroyed will probably be active, but it is deactivated and unsetup() is called in Show.destroy() before the features are destroyed.
Cloned features are handled a little differently. They have destroy() called from within Feature.destroyClonedSubgraph(). Since cloned fetures are exempt from the setup/unsetup lifecycle, the cloned feature will not be activated, but will be in a setup state when destroy() is called. Features that support cloning must therefore release any resources they acquired in createClone() or initializeClone() during the call to destroy().
Clients of the GRIN framework should never call this method directly. Custom feature extensions must implement this method.
destroy
in class Feature
protected int setSetupMode(boolean mode)
Feature
This method must return a guaranteed lower bound for the number of times it will send a feature setup command as a result of this call. That is, it must send at least as many feature setup commands to the segment as the number returned; sending an accurate number makes the setup process more efficient, since the time it takes to process a command scales with the number of features in a segment. When mode is false, 0 should be returned.
setSetupMode
in class Feature
protected void setActivateMode(boolean mode)
Feature
setActivateMode
in class Feature
public void doSomeSetup()
public boolean needsMoreSetup()
Feature
needsMoreSetup
in class Feature
SetupClient.needsMoreSetup()
public void addDisplayAreas(RenderContext context)
Feature
A feature that displays something needs to maintain a record of it in a DrawRecord. The animation framework uses this to track what needs to be erased and drawn from frame to frame.
Clients of the GRIN framework should not call this method directly. Feature subclasses must implement this method.
addDisplayAreas
in class Feature
context
- The context for tracking rendering stateDrawRecord
public void paintFrame(java.awt.Graphics2D gr)
Feature
paintFrame
in class Feature
gr
- The place to paint to.public void nextFrame()
Feature
nextFrame
in class Feature
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)
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
SENode.changeFeatureReference(Feature, Feature)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |