fop 0.90alpha1

org.apache.fop.apps
Class FOUserAgent

java.lang.Object
  |
  +--org.apache.fop.apps.FOUserAgent

public class FOUserAgent
extends java.lang.Object

The User Agent for fo. This user agent is used by the processing to obtain user configurable options.

Renderer specific extensions (that do not produce normal areas on the output) will be done like so:
The extension will create an area, custom if necessary
this area will be added to the user agent with a key
the renderer will know keys for particular extensions
eg. bookmarks will be held in a special hierarchical area representing the title and bookmark structure
These areas may contain resolvable areas that will be processed with other resolvable areas


Field Summary
protected  java.lang.String author
          Author of the content of the document.
protected  java.util.Date creationDate
          Creation Date: Override of the date the document was created.
protected  java.lang.String creator
          Creator: Metadata element for the user that created the document.
static java.lang.String DEFAULT_PAGE_HEIGHT
          Defines the default page-height
static java.lang.String DEFAULT_PAGE_WIDTH
          Defines the default page-width
static float DEFAULT_PX2MM
          Defines the default resolution (72dpi) for FOP
static float DEFAULT_RESOLUTION
          Defines the default resolution (72dpi) for FOP
protected  java.lang.String keywords
          Set of keywords applicable to this document.
protected  java.lang.String producer
          Producer: Metadata element for the system/software that produces the document.
protected  java.lang.String title
          Title of the document.
 
Constructor Summary
FOUserAgent()
           
 
Method Summary
 void addElementMapping(ElementMapping elementMapping)
          Add the element mapping with the given class name.
 java.util.List getAdditionalElementMappings()
          Returns the List of user-added ElementMapping class names
 java.lang.String getAuthor()
          Returns the author of the document
 java.lang.String getBaseURL()
          Returns the base URL.
 java.util.Date getCreationDate()
          Returns the creation date of the document
 java.lang.String getCreator()
          Returns the creator of the document
 FOEventHandler getFOEventHandlerOverride()
          Returns the overriding FOEventHandler instance, if any.
 java.lang.String getKeywords()
          Returns the keywords for the document
 LayoutManagerMaker getLayoutManagerMakerOverride()
          Returns the overriding LayoutManagerMaker instance, if any.
 java.io.File getOutputFile()
          Gets the output File.
 java.lang.String getPageHeight()
          Gets the default page-height to use as fallback, in case page-height="auto"
 java.lang.String getPageWidth()
          Gets the default page-width to use as fallback, in case page-width="auto"
 PDFEncryptionParams getPDFEncryptionParams()
          Returns the parameters for PDF encryption.
 float getPixelUnitToMillimeter()
          Returns the conversion factor from pixel units to millimeters.
 java.lang.String getProducer()
          Returns the producer of the document
 RendererFactory getRendererFactory()
           
 java.util.Map getRendererOptions()
          Returns the renderer options
 Renderer getRendererOverride()
          Returns the overriding Renderer instance, if any.
 float getResolution()
           
 java.lang.String getTitle()
          Returns the title of the document
 javax.xml.transform.URIResolver getURIResolver()
          Returns the URI Resolver.
 org.apache.avalon.framework.configuration.Configuration getUserConfig()
          Get the user configuration.
 org.apache.avalon.framework.configuration.Configuration getUserRendererConfig(java.lang.String mimeType)
          Returns the configuration subtree for a specific renderer.
 XMLHandlerRegistry getXMLHandlerRegistry()
           
 void initUserConfig()
          Initializes user agent settings from the user configuration file, if present: baseURL, resolution, default page size,...
 javax.xml.transform.Source resolveURI(java.lang.String uri)
          Attempts to resolve the given URI.
 void setAuthor(java.lang.String author)
          Sets the author of the document.
 void setBaseURL(java.lang.String baseURL)
          Sets the base URL.
 void setCreationDate(java.util.Date creationDate)
          Sets the creation date of the document.
 void setCreator(java.lang.String creator)
          Sets the creator of the document.
 void setFOEventHandlerOverride(FOEventHandler handler)
          Sets an explicit FOEventHandler instance which overrides the one defined by the render type setting.
 void setKeywords(java.lang.String keywords)
          Sets the keywords for the document.
 void setLayoutManagerMakerOverride(LayoutManagerMaker lmMaker)
          Sets an explicit LayoutManagerMaker instance which overrides the one defined by the AreaTreeHandler.
 void setOutputFile(java.io.File f)
          Sets the output File.
 void setPageHeight(java.lang.String pageHeight)
          Sets the page-height to use as fallback, in case page-height="auto"
 void setPageWidth(java.lang.String pageWidth)
          Sets the page-width to use as fallback, in case page-width="auto"
 void setPDFEncryptionParams(PDFEncryptionParams pdfEncryptionParams)
          Sets the parameters for PDF encryption.
 void setProducer(java.lang.String producer)
          Sets the producer of the document.
 void setRendererOverride(Renderer renderer)
          Sets an explicit renderer to use which overrides the one defined by the render type setting.
 void setResolution(int dpi)
          Sets the resolution in dpi.
 void setStrictValidation(boolean validateStrictly)
          Activates strict XSL content model validation for FOP Default is false (FOP will continue processing where it can)
 void setTitle(java.lang.String title)
          Sets the title of the document.
 void setURIResolver(javax.xml.transform.URIResolver uriResolver)
          Sets the URI Resolver.
 void setUserConfig(org.apache.avalon.framework.configuration.Configuration userConfig)
          Set the user configuration.
 boolean validateStrictly()
          Returns whether FOP is strictly validating input XSL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_RESOLUTION

public static final float DEFAULT_RESOLUTION
Defines the default resolution (72dpi) for FOP

DEFAULT_PX2MM

public static final float DEFAULT_PX2MM
Defines the default resolution (72dpi) for FOP

DEFAULT_PAGE_HEIGHT

public static final java.lang.String DEFAULT_PAGE_HEIGHT
Defines the default page-height

DEFAULT_PAGE_WIDTH

public static final java.lang.String DEFAULT_PAGE_WIDTH
Defines the default page-width

producer

protected java.lang.String producer
Producer: Metadata element for the system/software that produces the document. (Some renderers can store this in the document.)

creator

protected java.lang.String creator
Creator: Metadata element for the user that created the document. (Some renderers can store this in the document.)

creationDate

protected java.util.Date creationDate
Creation Date: Override of the date the document was created. (Some renderers can store this in the document.)

author

protected java.lang.String author
Author of the content of the document.

title

protected java.lang.String title
Title of the document.

keywords

protected java.lang.String keywords
Set of keywords applicable to this document.
Constructor Detail

FOUserAgent

public FOUserAgent()
Method Detail

addElementMapping

public void addElementMapping(ElementMapping elementMapping)
Add the element mapping with the given class name.
Parameters:
elementMapping - the class name representing the element mapping.

getAdditionalElementMappings

public java.util.List getAdditionalElementMappings()
Returns the List of user-added ElementMapping class names
Returns:
List of Strings holding ElementMapping names.

setRendererOverride

public void setRendererOverride(Renderer renderer)
Sets an explicit renderer to use which overrides the one defined by the render type setting.
Parameters:
renderer - the Renderer instance to use

getRendererOverride

public Renderer getRendererOverride()
Returns the overriding Renderer instance, if any.
Returns:
the overriding Renderer or null

setFOEventHandlerOverride

public void setFOEventHandlerOverride(FOEventHandler handler)
Sets an explicit FOEventHandler instance which overrides the one defined by the render type setting.
Parameters:
handler - the FOEventHandler instance

getFOEventHandlerOverride

public FOEventHandler getFOEventHandlerOverride()
Returns the overriding FOEventHandler instance, if any.
Returns:
the overriding FOEventHandler or null

setStrictValidation

public void setStrictValidation(boolean validateStrictly)
Activates strict XSL content model validation for FOP Default is false (FOP will continue processing where it can)
Parameters:
validateStrictly - true to turn on strict validation

validateStrictly

public boolean validateStrictly()
Returns whether FOP is strictly validating input XSL
Returns:
true of strict validation turned on, false otherwise

setLayoutManagerMakerOverride

public void setLayoutManagerMakerOverride(LayoutManagerMaker lmMaker)
Sets an explicit LayoutManagerMaker instance which overrides the one defined by the AreaTreeHandler.
Parameters:
lmMaker - the LayoutManagerMaker instance

getLayoutManagerMakerOverride

public LayoutManagerMaker getLayoutManagerMakerOverride()
Returns the overriding LayoutManagerMaker instance, if any.
Returns:
the overriding LayoutManagerMaker or null

setProducer

public void setProducer(java.lang.String producer)
Sets the producer of the document.
Parameters:
producer - source of document

getProducer

public java.lang.String getProducer()
Returns the producer of the document
Returns:
producer name

setCreator

public void setCreator(java.lang.String creator)
Sets the creator of the document.
Parameters:
creator - of document

getCreator

public java.lang.String getCreator()
Returns the creator of the document
Returns:
creator name

setCreationDate

public void setCreationDate(java.util.Date creationDate)
Sets the creation date of the document.
Parameters:
creationDate - date of document

getCreationDate

public java.util.Date getCreationDate()
Returns the creation date of the document
Returns:
creation date of document

setAuthor

public void setAuthor(java.lang.String author)
Sets the author of the document.
Parameters:
author - of document

getAuthor

public java.lang.String getAuthor()
Returns the author of the document
Returns:
author name

setTitle

public void setTitle(java.lang.String title)
Sets the title of the document. This will override any title coming from an fo:title element.
Parameters:
title - of document

getTitle

public java.lang.String getTitle()
Returns the title of the document
Returns:
title name

setKeywords

public void setKeywords(java.lang.String keywords)
Sets the keywords for the document.
Parameters:
keywords - for the document

getKeywords

public java.lang.String getKeywords()
Returns the keywords for the document
Returns:
the keywords

getRendererOptions

public java.util.Map getRendererOptions()
Returns the renderer options
Returns:
renderer options

setUserConfig

public void setUserConfig(org.apache.avalon.framework.configuration.Configuration userConfig)
Set the user configuration.
Parameters:
userConfig - configuration

getUserConfig

public org.apache.avalon.framework.configuration.Configuration getUserConfig()
Get the user configuration.
Returns:
the user configuration

initUserConfig

public void initUserConfig()
                    throws org.apache.avalon.framework.configuration.ConfigurationException
Initializes user agent settings from the user configuration file, if present: baseURL, resolution, default page size,...
Throws:
org.apache.avalon.framework.configuration.ConfigurationException - when there is an entry that misses the required attribute

getUserRendererConfig

public org.apache.avalon.framework.configuration.Configuration getUserRendererConfig(java.lang.String mimeType)
Returns the configuration subtree for a specific renderer.
Parameters:
mimeType - MIME type of the renderer
Returns:
the requested configuration subtree, null if there's no configuration

setBaseURL

public void setBaseURL(java.lang.String baseURL)
Sets the base URL.
Parameters:
baseURL - base URL

getBaseURL

public java.lang.String getBaseURL()
Returns the base URL.
Returns:
the base URL

setURIResolver

public void setURIResolver(javax.xml.transform.URIResolver uriResolver)
Sets the URI Resolver.
Parameters:
uriResolver - the new URI resolver

getURIResolver

public javax.xml.transform.URIResolver getURIResolver()
Returns the URI Resolver.
Returns:
the URI Resolver

getPDFEncryptionParams

public PDFEncryptionParams getPDFEncryptionParams()
Returns the parameters for PDF encryption.
Returns:
the PDF encryption parameters, null if not applicable

setPDFEncryptionParams

public void setPDFEncryptionParams(PDFEncryptionParams pdfEncryptionParams)
Sets the parameters for PDF encryption.
Parameters:
pdfEncryptionParams - the PDF encryption parameters, null to disable PDF encryption

resolveURI

public javax.xml.transform.Source resolveURI(java.lang.String uri)
Attempts to resolve the given URI. Will use the configured resolver and if not successful fall back to the default resolver.
Parameters:
uri - URI to access
Returns:
A Source object, or null if the URI cannot be resolved.
See Also:
FOURIResolver

setOutputFile

public void setOutputFile(java.io.File f)
Sets the output File.
Parameters:
f - the output File

getOutputFile

public java.io.File getOutputFile()
Gets the output File.
Returns:
the output File

getPixelUnitToMillimeter

public float getPixelUnitToMillimeter()
Returns the conversion factor from pixel units to millimeters. This depends on the desired reolution.
Returns:
float conversion factor

getResolution

public float getResolution()
Returns:
the resolution for resolution-dependant output

setResolution

public void setResolution(int dpi)
Sets the resolution in dpi.
Parameters:
dpi - resolution in dpi

getPageHeight

public java.lang.String getPageHeight()
Gets the default page-height to use as fallback, in case page-height="auto"
Returns:
the page-height, as a String

setPageHeight

public void setPageHeight(java.lang.String pageHeight)
Sets the page-height to use as fallback, in case page-height="auto"
Parameters:
pageHeight - page-height as a String

getPageWidth

public java.lang.String getPageWidth()
Gets the default page-width to use as fallback, in case page-width="auto"
Returns:
the page-width, as a String

setPageWidth

public void setPageWidth(java.lang.String pageWidth)
Sets the page-width to use as fallback, in case page-width="auto"
Parameters:
pageWidth - page-width as a String

getRendererFactory

public RendererFactory getRendererFactory()
Returns:
the RendererFactory

getXMLHandlerRegistry

public XMLHandlerRegistry getXMLHandlerRegistry()
Returns:
the XML handler registry

fop 0.90alpha1

Copyright 1999-2005 The Apache Software Foundation. All Rights Reserved.