info.informatica.doc.dom4j
Class XHTMLDocumentFactory

java.lang.Object
  extended by org.dom4j.DocumentFactory
      extended by org.dom4j.dom.DOMDocumentFactory
          extended by info.informatica.doc.dom4j.XHTMLDocumentFactory
All Implemented Interfaces:
Serializable, DOMImplementation

public class XHTMLDocumentFactory
extends org.dom4j.dom.DOMDocumentFactory

DocumentFactory for CSS-styled XHTML documents.

This factory creates XHTMLDocuments and other objects with support for CSS style sheets. A default style sheet can be set with the setDefaultStyleSheet method. If no default sheet is specified, an internal default sheet will be used.

It is possible to produce elements with the ability to cache its own computed style, if you call setStyleCache(true). This should enhance performance for applicactions that may call the getComputedStyle() method of a single stylable element several times.

Author:
Carlos Amengual
See Also:
Serialized Form

Nested Class Summary
 class XHTMLDocumentFactory.DOM4JCSSStyleSheetFactory
          CSS2 style sheet factory for DOM.
 
Field Summary
protected static XHTMLDocumentFactory singleton
           
 
Fields inherited from class org.dom4j.DocumentFactory
cache
 
Constructor Summary
XHTMLDocumentFactory()
           
 
Method Summary
 org.dom4j.Attribute createAttribute(org.dom4j.Element owner, org.dom4j.QName qname, String value)
           
 XHTMLDocument createDocument()
           
 org.dom4j.Element createElement(org.dom4j.QName qname)
           
 org.dom4j.Element createElement(org.dom4j.QName qname, int attributeCount)
           
 XHTMLDocumentFactory.DOM4JCSSStyleSheetFactory getCSSStyleSheetFactory()
          Gets the CSS style sheet factory.
protected  DOM4JCSSStyleSheet getDefaultStyleSheet()
           
static org.dom4j.dom.DOMDocumentFactory getInstance()
           
 StyleDatabase getStyleDatabase()
           
 DOM4JCSSStyleSheet getUserAgentStyleSheet()
          Gets the User Agent default CSS style sheet to be used by this factory.
protected  BaseCSSStyleDeclaration getUserImportantStyle()
           
 boolean isStyleCacheOn()
          Indicates whether the stylable elements currently produced by this factory are cache-enabled or not.
 void setDefaultStyleSheet(DOM4JCSSStyleSheet styleSheet)
          Deprecated. use setUserAgentStyleSheet and setUserStyleSheet.
 void setStyleCache(boolean onOff)
          Can turn on or off the per-Element style caching capability (by default is off).
 void setStyleDatabase(StyleDatabase styleDb)
           
 void setUserAgentStyleSheet(DOM4JCSSStyleSheet styleSheet)
          Sets the default User Agent CSS style sheet to be used in documents created by this factory.
 void setUserStyleSheet(DOM4JCSSStyleSheet styleSheet)
          Sets the CSS style sheet defined by the end-user.
 
Methods inherited from class org.dom4j.dom.DOMDocumentFactory
asDocumentType, createCDATA, createComment, createDocType, createDocument, createDocumentType, createEntity, createEntity, createNamespace, createProcessingInstruction, createProcessingInstruction, createText, hasFeature
 
Methods inherited from class org.dom4j.DocumentFactory
createAttribute, createDocument, createDocument, createElement, createElement, createPattern, createQName, createQName, createQName, createQName, createQNameCache, createSingleton, createXPath, createXPath, createXPathFilter, createXPathFilter, getQNames, getXPathNamespaceURIs, init, intern, setXPathNamespaceURIs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.DOMImplementation
getFeature
 

Field Detail

singleton

protected static transient XHTMLDocumentFactory singleton
Constructor Detail

XHTMLDocumentFactory

public XHTMLDocumentFactory()
Method Detail

getInstance

public static org.dom4j.dom.DOMDocumentFactory getInstance()

getUserAgentStyleSheet

public DOM4JCSSStyleSheet getUserAgentStyleSheet()
Gets the User Agent default CSS style sheet to be used by this factory.

Returns:
the default style sheet.

getDefaultStyleSheet

protected DOM4JCSSStyleSheet getDefaultStyleSheet()

getCSSStyleSheetFactory

public XHTMLDocumentFactory.DOM4JCSSStyleSheetFactory getCSSStyleSheetFactory()
Gets the CSS style sheet factory.

Returns:
the CSS style sheet factory.

setDefaultStyleSheet

public void setDefaultStyleSheet(DOM4JCSSStyleSheet styleSheet)
Deprecated. use setUserAgentStyleSheet and setUserStyleSheet.

Sets the default CSS style sheet to be used in documents created by this factory.

Parameters:
styleSheet - the default style sheet.

setUserAgentStyleSheet

public void setUserAgentStyleSheet(DOM4JCSSStyleSheet styleSheet)
Sets the default User Agent CSS style sheet to be used in documents created by this factory.

The sheet will be appropriately merged with the non-important part of the user-preference style sheet to provide the document's default sheet.

Parameters:
styleSheet - the user agent style sheet.

setUserStyleSheet

public void setUserStyleSheet(DOM4JCSSStyleSheet styleSheet)
Sets the CSS style sheet defined by the end-user.

The supplied sheet should contain user preferences, and will be appropriately merged with the other style sheets.

Parameters:
styleSheet - the user style sheet.

getUserImportantStyle

protected BaseCSSStyleDeclaration getUserImportantStyle()

isStyleCacheOn

public boolean isStyleCacheOn()
Indicates whether the stylable elements currently produced by this factory are cache-enabled or not.

Returns:
true if the per-element cache is enabled, false otherwise.

setStyleCache

public void setStyleCache(boolean onOff)
Can turn on or off the per-Element style caching capability (by default is off).

Only applications that repeatedly call the CSSStylableElement.getComputedStyle() method on the same Element should turn it on.

Parameters:
onOff - set to true to turn on the cache capability, to false to turn it off.

createElement

public org.dom4j.Element createElement(org.dom4j.QName qname)
Overrides:
createElement in class org.dom4j.dom.DOMDocumentFactory

createElement

public org.dom4j.Element createElement(org.dom4j.QName qname,
                                       int attributeCount)
Overrides:
createElement in class org.dom4j.dom.DOMDocumentFactory

createDocument

public XHTMLDocument createDocument()
Overrides:
createDocument in class org.dom4j.dom.DOMDocumentFactory

createAttribute

public org.dom4j.Attribute createAttribute(org.dom4j.Element owner,
                                           org.dom4j.QName qname,
                                           String value)
Overrides:
createAttribute in class org.dom4j.dom.DOMDocumentFactory

getStyleDatabase

public StyleDatabase getStyleDatabase()

setStyleDatabase

public void setStyleDatabase(StyleDatabase styleDb)


Copyright © 2011 informatica.info. All Rights Reserved.