|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.writersforge.catalan.templates.RenderTemplate
Base class for all rendering templates. The RenderTemplate is a factory for preprocessing data before sending it off to the Renderer. The template decides which input Datum objects should be rendered, and in which order. It creates and initializes the set of LayoutArea objects to pass on to the Renderer, and assigns the layout constraints for each area. It then passes these areas to a LayoutEngine to process within the context of a Page object. After the LayoutEngine has moved and resized the areas, the template adds them into the current Page object. When a Page runs out of available space, the template will create a blank new Page object and continue processing.
| Constructor Summary | |
RenderTemplate()
Creates a new instance of RenderTemplate using the default LayoutEngine. |
|
RenderTemplate(LayoutEngine layout)
Creates a new instance of RenderTemplate using the given LayoutEngine. |
|
RenderTemplate(java.lang.String layout)
Creates a new instance of RenderTemplate using the requested LayoutEngine. |
|
| Method Summary | |
protected abstract 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 abstract 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. |
protected Page |
createNewPage(Book book)
Creates a new Page object, initialized with width, height, and margins appropriate to this template and Book. |
protected int |
getCurrentPage()
Retrieves the current page index |
abstract int |
getDefaultPageHeight()
Retrieves the default Page height for this template. |
abstract int |
getDefaultPageWidth()
Retrieves the default Page width for this template. |
protected LayoutEngine |
getLayout()
Retrieves the current LayoutEngine |
protected abstract Section[] |
getSections()
Returns an array of all Section objects associated with this template. |
static org.writersforge.bellows.Datum[] |
listToDatumArray(java.util.List list)
Converts an ArrayList into an array of Datum objects. |
static LayoutArea[] |
listToLayoutAreaArray(java.util.List list)
Converts an ArrayList into an array of LayoutArea objects. |
void |
process(Book book)
Processes all content in the Book's ListDatum container according to the rules in this template, and divides the results into separate Pages. |
protected Page[] |
renderSection(Section section,
Book book)
Converts a section of the document into Page objects, using the data in the Book as an input source. |
protected void |
setCurrentPage(int currentPage)
Sets the current page index |
protected void |
setLayout(LayoutEngine layout)
Assigns a LayoutEngine to this template. |
protected LayoutArea[] |
sortAreas(LayoutArea[] areas)
Rearranges the LayoutArea objects in a more linear order, gathering keep-with areas together and shuffling to make the layout more efficient. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public RenderTemplate()
public RenderTemplate(java.lang.String layout)
layout - the name of the layout engine to render Pages with
java.lang.IllegalArgumentException - if the layout engine is invalidpublic RenderTemplate(LayoutEngine layout)
layout - the layout engine to render Pages with| Method Detail |
protected void setLayout(LayoutEngine layout)
layout - the LayoutEngine for this templateprotected LayoutEngine getLayout()
protected void setCurrentPage(int currentPage)
currentPage - the current page indexprotected int getCurrentPage()
public abstract int getDefaultPageWidth()
public abstract int getDefaultPageHeight()
protected abstract Section[] getSections()
protected abstract LayoutArea[] buildStaticLayout(Section section,
java.lang.String regionName,
Book book)
section - the Section object to renderregionName - the name of the region in this section to processbook - the data source
protected abstract LayoutArea[] buildFlowLayout(Section section,
java.lang.String regionName,
Book book)
section - the Section object to renderregionName - the name of the region in this section to processbook - the data source
protected Page createNewPage(Book book)
book - the owning Book object for the new Page
public void process(Book book)
book - the data to organize into Pages
protected Page[] renderSection(Section section,
Book book)
section - the Section object to renderbook - the data source
protected LayoutArea[] sortAreas(LayoutArea[] areas)
areas - the master list of areas to sort
public static org.writersforge.bellows.Datum[] listToDatumArray(java.util.List list)
list - list of objects to grab
public static LayoutArea[] listToLayoutAreaArray(java.util.List list)
list - list of objects to grab
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||