org.jfor.jfor.converter
Class BuilderContext

java.lang.Object
  extended byorg.jfor.jfor.converter.BuilderContext

class BuilderContext
extends java.lang.Object

A BuilderContext is shared between all IBuilders when building an RTF document

Author:
Bertrand Delacretaz bdelacretaz@codeconsult.ch

Field Summary
(package private)  ConverterLogChannel log
          log channel
(package private)  IRtfOptions m_options
          Rtf options
 
Constructor Summary
(package private) BuilderContext(java.io.Writer w, ConverterLogChannel theLog, IRtfOptions rtfOptions)
           
 
Method Summary
(package private)  IBuilder getBuilder(java.lang.Class builderClass, boolean required)
          find the "nearest" IBuilder of given class
(package private)  RtfContainer getContainer(java.lang.Class containerClass, boolean required, IBuilder forWhichBuilder)
          find the "nearest" container that implements the given interface on our stack
(package private)  RtfFile getRtfFile()
          return the RtfFile that we're building
(package private)  TableContext getTableContext()
          return the current TableContext
(package private)  IBuilder popBuilderAndGetPreviousOne()
          pop the topmost IBuilder from our stack and return previous builder on stack
(package private)  void popContainer()
          pop the topmost RtfContainer from our stack
(package private)  void popTableContext()
          pop a TableContext from our stack
(package private)  void pushBuilder(IBuilder b)
          push an IBuilder to our stack
(package private)  void pushContainer(RtfContainer c)
          push an RtfContainer on our stack
(package private)  void pushTableContext(TableContext tc)
          push a TableContext to our stack
(package private)  void replaceContainer(RtfContainer oldC, RtfContainer newC)
          in some cases an RtfContainer must be replaced by another one on the stack.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

ConverterLogChannel log
log channel


m_options

IRtfOptions m_options
Rtf options

Constructor Detail

BuilderContext

BuilderContext(java.io.Writer w,
               ConverterLogChannel theLog,
               IRtfOptions rtfOptions)
         throws java.io.IOException
Method Detail

getBuilder

IBuilder getBuilder(java.lang.Class builderClass,
                    boolean required)
              throws ConverterException
find the "nearest" IBuilder of given class

Throws:
ConverterException

getContainer

RtfContainer getContainer(java.lang.Class containerClass,
                          boolean required,
                          IBuilder forWhichBuilder)
                    throws ConverterException
find the "nearest" container that implements the given interface on our stack

Parameters:
required - if true, ConverterException is thrown if no container found
forWhichBuilder - used in error message if container not found
Throws:
ConverterException

pushContainer

void pushContainer(RtfContainer c)
push an RtfContainer on our stack


replaceContainer

void replaceContainer(RtfContainer oldC,
                      RtfContainer newC)
                throws ConverterException
in some cases an RtfContainer must be replaced by another one on the stack. this happens when handling nested fo:blocks for example: after handling a nested block the enclosing block must switch to a new paragraph container to handle what follows the nested block. TODO: what happens to elements that are "more on top" than oldC on the stack? shouldn't they be closed or something?

Throws:
ConverterException

popContainer

void popContainer()
pop the topmost RtfContainer from our stack


pushBuilder

void pushBuilder(IBuilder b)
push an IBuilder to our stack


popBuilderAndGetPreviousOne

IBuilder popBuilderAndGetPreviousOne()
pop the topmost IBuilder from our stack and return previous builder on stack

Returns:
null if builders stack is empty

getRtfFile

RtfFile getRtfFile()
return the RtfFile that we're building


getTableContext

TableContext getTableContext()
return the current TableContext


pushTableContext

void pushTableContext(TableContext tc)
push a TableContext to our stack


popTableContext

void popTableContext()
pop a TableContext from our stack