org.apache.fop.apps

Class FOUserAgent


public class FOUserAgent
extends java.lang.Object

This is the user agent for FOP. It is the entity through which you can interact with the XSL-FO processing and 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

static float
DEFAULT_TARGET_RESOLUTION
Defines the default target resolution (72dpi) for FOP
protected String
author
Author of the content of the document.
protected Date
creationDate
Creation Date: Override of the date the document was created.
protected String
creator
Creator: Metadata element for the user that created the document.
protected String
keywords
Set of keywords applicable to this document.
protected String
producer
Producer: Metadata element for the system/software that produces the document.
protected String
title
Title of the document.

Constructor Summary

FOUserAgent(FopFactory factory)
Main constructor.

Method Summary

String
getAuthor()
Returns the author of the document
String
getBaseURL()
Returns the base URL.
Date
getCreationDate()
Returns the creation date of the document
String
getCreator()
Returns the creator of the document
FOEventHandler
getFOEventHandlerOverride()
Returns the overriding FOEventHandler instance, if any.
FopFactory
getFactory()
String
getFontBaseURL()
ImageSessionContext
getImageSessionContext()
Returns the image session context for the image package.
String
getKeywords()
Returns the keywords for the document
File
getOutputFile()
Gets the output File.
String
getPageHeight()
Gets the default page-height to use as fallback, in case page-height="auto"
String
getPageWidth()
Gets the default page-width to use as fallback, in case page-width="auto"
String
getProducer()
Returns the producer of the document
RendererFactory
getRendererFactory()
Map
getRendererOptions()
Returns the renderer options
Renderer
getRendererOverride()
Returns the overriding Renderer instance, if any.
float
getSourcePixelUnitToMillimeter()
Returns the conversion factor from pixel units to millimeters.
float
getSourceResolution()
float
getTargetPixelUnitToMillimeter()
Returns the conversion factor from pixel units to millimeters.
float
getTargetResolution()
String
getTitle()
Returns the title of the document
URIResolver
getURIResolver()
Returns the URI Resolver.
XMLHandlerRegistry
getXMLHandlerRegistry()
boolean
isBreakIndentInheritanceOnReferenceAreaBoundary()
boolean
isLocatorEnabled()
Checks if the use of Locators is enabled
Source
resolveURI(String uri)
Attempts to resolve the given URI.
Source
resolveURI(String href, String base)
Attempts to resolve the given URI.
void
setAuthor(String author)
Sets the author of the document.
void
setBaseURL(String baseUrl)
Sets the base URL.
void
setCreationDate(Date creationDate)
Sets the creation date of the document.
void
setCreator(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
setFontBaseURL(String fontBaseUrl)
sets font base URL
void
setKeywords(String keywords)
Sets the keywords for the document.
void
setLocatorEnabled(boolean enableLocator)
Controls the use of SAXLocators to provide location information in error messages.
void
setOutputFile(File f)
Sets the output File.
void
setProducer(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
setTargetResolution(float dpi)
Sets the target resolution in dpi.
void
setTargetResolution(int dpi)
Sets the target resolution in dpi.
void
setTitle(String title)
Sets the title of the document.
void
setURIResolver(URIResolver resolver)
Sets the URI Resolver.
boolean
validateStrictly()
Returns whether FOP is strictly validating input XSL

Field Details

DEFAULT_TARGET_RESOLUTION

public static final float DEFAULT_TARGET_RESOLUTION
Defines the default target resolution (72dpi) for FOP
Field Value:
72.0f

author

protected String author
Author of the content of the document.

creationDate

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

creator

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

keywords

protected String keywords
Set of keywords applicable to this document.

producer

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

title

protected String title
Title of the document.

Constructor Details

FOUserAgent

public FOUserAgent(FopFactory factory)
Main constructor. This constructor should not be called directly. Please use the methods from FopFactory to construct FOUserAgent instances!
Parameters:
factory - the factory that provides environment-level information
See Also:
FopFactory

Method Details

getAuthor

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

getBaseURL

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

getCreationDate

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

getCreator

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

getFOEventHandlerOverride

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

getFactory

public FopFactory getFactory()
Returns:
the associated FopFactory instance

getFontBaseURL

public String getFontBaseURL()
Returns:
the font base URL

getImageSessionContext

public ImageSessionContext getImageSessionContext()
Returns the image session context for the image package.
Returns:
the ImageSessionContext instance for this rendering run

getKeywords

public String getKeywords()
Returns the keywords for the document
Returns:
the keywords

getOutputFile

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

getPageHeight

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

getPageWidth

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

getProducer

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

getRendererFactory

public RendererFactory getRendererFactory()
Returns:
the RendererFactory

getRendererOptions

public Map getRendererOptions()
Returns the renderer options
Returns:
renderer options

getRendererOverride

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

getSourcePixelUnitToMillimeter

public float getSourcePixelUnitToMillimeter()
Returns the conversion factor from pixel units to millimeters. This depends on the desired source resolution.
Returns:
float conversion factor

getSourceResolution

public float getSourceResolution()
Returns:
the resolution for resolution-dependant input

getTargetPixelUnitToMillimeter

public float getTargetPixelUnitToMillimeter()
Returns the conversion factor from pixel units to millimeters. This depends on the desired target resolution.
Returns:
float conversion factor

getTargetResolution

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

getTitle

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

getURIResolver

public URIResolver getURIResolver()
Returns the URI Resolver.
Returns:
the URI Resolver

getXMLHandlerRegistry

public XMLHandlerRegistry getXMLHandlerRegistry()
Returns:
the XML handler registry

isBreakIndentInheritanceOnReferenceAreaBoundary

public boolean isBreakIndentInheritanceOnReferenceAreaBoundary()
Returns:
true if the indent inheritance should be broken when crossing reference area boundaries (for more info, see the javadoc for the relative member variable)

isLocatorEnabled

public boolean isLocatorEnabled()
Checks if the use of Locators is enabled
Returns:
true if context information should be stored on each node in the FO tree.

resolveURI

public Source resolveURI(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 javax.xml.transform.Source object, or null if the URI cannot be resolved.

resolveURI

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

setAuthor

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

setBaseURL

public void setBaseURL(String baseUrl)
Sets the base URL.
Parameters:
baseUrl - base URL

setCreationDate

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

setCreator

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

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

setFontBaseURL

public void setFontBaseURL(String fontBaseUrl)
sets font base URL
Parameters:
fontBaseUrl - font base URL

setKeywords

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

setLocatorEnabled

public void setLocatorEnabled(boolean enableLocator)
Controls the use of SAXLocators to provide location information in error messages.
Parameters:
enableLocator - false if SAX Locators should be disabled

setOutputFile

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

setProducer

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

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

setTargetResolution

public void setTargetResolution(float dpi)
Sets the target resolution in dpi. This value defines the target resolution of bitmap images generated by the bitmap renderers (such as the TIFF renderer) and of bitmap images generated by filter effects in Apache Batik.
Parameters:
dpi - resolution in dpi

setTargetResolution

public void setTargetResolution(int dpi)
Sets the target resolution in dpi. This value defines the target resolution of bitmap images generated by the bitmap renderers (such as the TIFF renderer) and of bitmap images generated by filter effects in Apache Batik.
Parameters:
dpi - resolution in dpi

setTitle

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

setURIResolver

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

validateStrictly

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

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