info.informatica.doc.dom4j
Class DocumentFormatter

java.lang.Object
  extended by info.informatica.doc.dom4j.DocumentFormatter

public class DocumentFormatter
extends Object

Builds the formatting structure for DOM4J documents.

This is the class to use for rendering CSS-styled DOM4J documents.

Author:
Carlos Amengual (amengual at informatica.info)

Constructor Summary
DocumentFormatter(UserAgent<?> userAgent)
           
 
Method Summary
protected  void checkBackgroundImage(CSS2ComputedProperties style)
           
 CSSContainerBox formatDocument(XHTMLDocument xdoc)
          Builds a CSS formatting structure for the given document.
protected  CSSBox generateBox(DOM4JCSSStyleDeclaration style)
          Creates a box of the appropriate type according to CSS box model.
 CSSBoxFactory getBoxFactory()
           
 DOM4JCSSErrorHandler getErrorHandler()
           
 UserAgent<?> getUserAgent()
           
 void setBoxFactory(CSSBoxFactory boxFactory)
           
 void setErrorHandler(DOM4JCSSErrorHandler errorHandler)
          Sets the error handler.
 void setUserAgent(UserAgent<?> userAgent)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentFormatter

public DocumentFormatter(UserAgent<?> userAgent)
Method Detail

getErrorHandler

public DOM4JCSSErrorHandler getErrorHandler()

getUserAgent

public UserAgent<?> getUserAgent()

setUserAgent

public void setUserAgent(UserAgent<?> userAgent)

setErrorHandler

public void setErrorHandler(DOM4JCSSErrorHandler errorHandler)
Sets the error handler.

Parameters:
errorHandler - the DOM4J-specific CSS error handler.

getBoxFactory

public CSSBoxFactory getBoxFactory()

setBoxFactory

public void setBoxFactory(CSSBoxFactory boxFactory)

formatDocument

public CSSContainerBox formatDocument(XHTMLDocument xdoc)
                               throws CSSStyleException
Builds a CSS formatting structure for the given document.

Parameters:
xdoc - the document to be formatted.
Returns:
the root box containing the format structure.
Throws:
CSSStyleException - if the root box could not be established.

generateBox

protected CSSBox generateBox(DOM4JCSSStyleDeclaration style)
                      throws CSSStyleException
Creates a box of the appropriate type according to CSS box model.

Note that table sub-elements are not generated here.

Parameters:
style - the computed style that applies for the box.
Returns:
the generated box, or null if the element generates no box (display: none).
Throws:
CSSStyleException - if an error occurs generating the box.

checkBackgroundImage

protected void checkBackgroundImage(CSS2ComputedProperties style)


Copyright © 2011 informatica.info. All Rights Reserved.