org.writersforge.catalan.templates
Class DTDTemplate

java.lang.Object
  |
  +--org.writersforge.catalan.templates.RenderTemplate
        |
        +--org.writersforge.catalan.templates.DTDTemplate

public class DTDTemplate
extends RenderTemplate

Template for creating a DTD text file from a data-model XML description.

Author:
jsheets

Constructor Summary
DTDTemplate()
          Creates a new instance of DTDTemplate
 
Method Summary
protected  LayoutArea[] buildFlowLayout(Section section, java.lang.String regionName, Book book)
          Renders a single flow region in the current section, using the data in the Book as an input source.
protected  LayoutArea[] buildStaticLayout(Section section, java.lang.String regionName, Book book)
          Renders a single static region in the current section, using the data in the Book as an input source.
 int getDefaultPageHeight()
          Retrieves the default Page height for this template.
 int getDefaultPageWidth()
          Retrieves the default Page width for this template.
protected  Section[] getSections()
          Returns an array of all Section objects associated with this template.
 
Methods inherited from class org.writersforge.catalan.templates.RenderTemplate
createNewPage, getCurrentPage, getLayout, listToDatumArray, listToLayoutAreaArray, process, renderSection, setCurrentPage, setLayout, sortAreas
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DTDTemplate

public DTDTemplate()
Creates a new instance of DTDTemplate

Method Detail

getDefaultPageWidth

public int getDefaultPageWidth()
Retrieves the default Page width for this template. The units don't really matter, since the template can just create LayoutAreas to whatever scale it wants.

Specified by:
getDefaultPageWidth in class RenderTemplate
Returns:
the default Page width, in arbitrary units

getDefaultPageHeight

public int getDefaultPageHeight()
Retrieves the default Page height for this template. The units don't really matter, since the template can just create LayoutAreas to whatever scale it wants.

Specified by:
getDefaultPageHeight in class RenderTemplate
Returns:
the default Page height, in arbitrary units

getSections

protected Section[] getSections()
Returns an array of all Section objects associated with this template. Each Section represents a series of pages in the document with similar structure.

Specified by:
getSections in class RenderTemplate
Returns:
an array of Section objects

buildStaticLayout

protected LayoutArea[] buildStaticLayout(Section section,
                                         java.lang.String regionName,
                                         Book book)
Renders a single static region in the current section, using the data in the Book as an input source. The created LayoutArea objects are in a simplified, transitional state, with a single area for each block of text. (Later in the rendering process, these transitional areas will be further decomposed into separate areas per line of text, and perhaps split across two or more pages.) This method should call sortAreas() at some point.

Specified by:
buildStaticLayout in class RenderTemplate
Parameters:
section - the Section object to render
regionName - the name of the region in this section to process
book - the data source
Returns:
an array of partially rendered LayoutArea objects

buildFlowLayout

protected LayoutArea[] buildFlowLayout(Section section,
                                       java.lang.String regionName,
                                       Book book)
Renders a single flow region in the current section, using the data in the Book as an input source. The created LayoutArea objects are in a simplified, transitional state, with a single area for each block of text. (Later in the rendering process, these transitional areas will be further decomposed into separate areas per line of text, and perhaps split across two or more pages.) This method should call sortAreas() at some point.

Specified by:
buildFlowLayout in class RenderTemplate
Parameters:
section - the Section object to render
regionName - the name of the region in this section to process
book - the data source
Returns:
an array of partially rendered LayoutArea objects