com.hdcookbook.grin.io.builders
Class TranslatorHelper

java.lang.Object
  extended by com.hdcookbook.grin.io.builders.TranslatorHelper
All Implemented Interfaces:
DeferredBuilder

public class TranslatorHelper
extends java.lang.Object
implements DeferredBuilder

A helper class for creating a Translation object. This handles the difference between the absolute "linear" Translation features and the newer, more sensible "linear-relative" Translation type. Only linear-relative is supported at runtime.

To use this, build a normal Translator feature and add it to the show, then make a TranslatorHelper for that feature. Add the TranslatorHelper to the ShowBuilder using addDeferredBuilder(). Then, the ShowBuilder will call back to the TranslatorHelper, which will finish up the needed initialization of the translator.

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

Constructor Summary
TranslatorHelper(SETranslator translator, int line)
           
 
Method Summary
 void finishBuilding(SEShow show)
          Finish the building process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TranslatorHelper

public TranslatorHelper(SETranslator translator,
                        int line)
Method Detail

finishBuilding

public void finishBuilding(SEShow show)
                    throws java.io.IOException
Finish the building process.

Since the show is built, we can calculate the upper-left hand corner of our translator's child. If our model uses absolute coordinates, we use this calculation to transform it into relative coordinates.

Note that using relative coordinates on a translation is less confusing, and is to be encouraged. Absolute coordinates exist mostly for old show files, created before relative coordinates were supported.

Specified by:
finishBuilding in interface DeferredBuilder
Throws:
java.io.IOException
See Also:
ShowBuilder.finishBuilding()