org.apache.batik.svggen

Class SVGGeneratorContext

public class SVGGeneratorContext extends Object implements ErrorConstants

This class contains all non graphical contextual information that are needed by the {@link org.apache.batik.svggen.SVGGraphics2D} to generate SVG from Java 2D primitives. You can subclass it to change the defaults.

See Also: SVGGraphics2D

Nested Class Summary
static classSVGGeneratorContext.GraphicContextDefaults
Class to describe the GraphicContext defaults to be used.
Field Summary
protected DecimalFormatdecimalFormat
Current double value formatter
protected static DecimalFormat[]decimalFormats
protected static DecimalFormatSymbolsdsf
Constructor Summary
protected SVGGeneratorContext(Document domFactory)
Builds an instance of SVGGeneratorContext with the given domFactory but let the user set later the other contextual information.
Method Summary
static SVGGeneratorContextcreateDefault(Document domFactory)
Creates an instance of SVGGeneratorContext with the given domFactory and with the default values for the other information.
StringdoubleString(double value)
Converts the input double value to a string with a number of decimal places controlled by the precision attribute.
StringgetComment()
Returns the comment to be generated in the SVG file.
DocumentgetDOMFactory()
Returns the DOM Factory that has been set.
ErrorHandlergetErrorHandler()
Returns the {@link org.apache.batik.svggen.ErrorHandler} that has been set.
ExtensionHandlergetExtensionHandler()
Returns the {@link org.apache.batik.svggen.ExtensionHandler} that has been set.
SVGGeneratorContext.GraphicContextDefaultsgetGraphicContextDefaults()
Returns the set of defaults which should be used for the GraphicContext.
SVGIDGeneratorgetIDGenerator()
Returns the {@link org.apache.batik.svggen.SVGIDGenerator} that has been set.
ImageHandlergetImageHandler()
Returns the {@link org.apache.batik.svggen.ImageHandler} that has been set.
intgetPrecision()
Returns the current precision used by this context
StyleHandlergetStyleHandler()
Returns the {@link org.apache.batik.svggen.StyleHandler} that has been set.
booleanisEmbeddedFontsOn()
Returns true if we should generate SVG Fonts for texts.
voidsetComment(String generatorComment)
Sets the comment to be used.
voidsetDOMFactory(Document domFactory)
Sets the DOM Factory to be used.
voidsetEmbeddedFontsOn(boolean svgFont)
Sets if we should generate SVG Fonts for texts.
voidsetErrorHandler(ErrorHandler errorHandler)
Sets the {@link org.apache.batik.svggen.ErrorHandler} to be used.
voidsetExtensionHandler(ExtensionHandler extensionHandler)
Sets the {@link org.apache.batik.svggen.ExtensionHandler} to be used.
voidsetGenericImageHandler(GenericImageHandler genericImageHandler)
Sets the {@link org.apache.batik.svggen.GenericImageHandler} to be used.
voidsetGraphicContextDefaults(SVGGeneratorContext.GraphicContextDefaults gcDefaults)
Sets the default to be used for the graphic context.
voidsetIDGenerator(SVGIDGenerator idGenerator)
Sets the {@link org.apache.batik.svggen.SVGIDGenerator} to be used.
voidsetImageHandler(ImageHandler imageHandler)
Sets the {@link org.apache.batik.svggen.ImageHandler} to be used.
voidsetPrecision(int precision)
Sets the precision used by this context.
voidsetStyleHandler(StyleHandler styleHandler)
Sets the {@link org.apache.batik.svggen.StyleHandler} to be used.

Field Detail

decimalFormat

protected DecimalFormat decimalFormat
Current double value formatter

decimalFormats

protected static DecimalFormat[] decimalFormats

dsf

protected static DecimalFormatSymbols dsf

Constructor Detail

SVGGeneratorContext

protected SVGGeneratorContext(Document domFactory)
Builds an instance of SVGGeneratorContext with the given domFactory but let the user set later the other contextual information. Please note that none of the parameter below should be null.

See Also: SVGGeneratorContext SVGGeneratorContext SVGGeneratorContext SVGGeneratorContext SVGGeneratorContext

Method Detail

createDefault

public static SVGGeneratorContext createDefault(Document domFactory)
Creates an instance of SVGGeneratorContext with the given domFactory and with the default values for the other information.

See Also: SVGIDGenerator DefaultExtensionHandler ImageHandlerBase64Encoder DefaultStyleHandler DefaultErrorHandler

doubleString

public final String doubleString(double value)
Converts the input double value to a string with a number of decimal places controlled by the precision attribute.

getComment

public final String getComment()
Returns the comment to be generated in the SVG file.

getDOMFactory

public final Document getDOMFactory()
Returns the DOM Factory that has been set.

getErrorHandler

public final ErrorHandler getErrorHandler()
Returns the {@link org.apache.batik.svggen.ErrorHandler} that has been set.

getExtensionHandler

public final ExtensionHandler getExtensionHandler()
Returns the {@link org.apache.batik.svggen.ExtensionHandler} that has been set.

getGraphicContextDefaults

public final SVGGeneratorContext.GraphicContextDefaults getGraphicContextDefaults()
Returns the set of defaults which should be used for the GraphicContext.

getIDGenerator

public final SVGIDGenerator getIDGenerator()
Returns the {@link org.apache.batik.svggen.SVGIDGenerator} that has been set.

getImageHandler

public final ImageHandler getImageHandler()
Returns the {@link org.apache.batik.svggen.ImageHandler} that has been set.

getPrecision

public final int getPrecision()
Returns the current precision used by this context

getStyleHandler

public final StyleHandler getStyleHandler()
Returns the {@link org.apache.batik.svggen.StyleHandler} that has been set.

isEmbeddedFontsOn

public final boolean isEmbeddedFontsOn()
Returns true if we should generate SVG Fonts for texts.

setComment

public final void setComment(String generatorComment)
Sets the comment to be used. It can be null if you want to disable it.

setDOMFactory

public final void setDOMFactory(Document domFactory)
Sets the DOM Factory to be used. It should not be null.

setEmbeddedFontsOn

public final void setEmbeddedFontsOn(boolean svgFont)
Sets if we should generate SVG Fonts for texts. Default value is false.

setErrorHandler

public final void setErrorHandler(ErrorHandler errorHandler)
Sets the {@link org.apache.batik.svggen.ErrorHandler} to be used. It should not be null.

setExtensionHandler

public final void setExtensionHandler(ExtensionHandler extensionHandler)
Sets the {@link org.apache.batik.svggen.ExtensionHandler} to be used. It should not be null.

setGenericImageHandler

public final void setGenericImageHandler(GenericImageHandler genericImageHandler)
Sets the {@link org.apache.batik.svggen.GenericImageHandler} to be used.

setGraphicContextDefaults

public final void setGraphicContextDefaults(SVGGeneratorContext.GraphicContextDefaults gcDefaults)
Sets the default to be used for the graphic context. Note that gcDefaults may be null and that any of its attributes may be null.

setIDGenerator

public final void setIDGenerator(SVGIDGenerator idGenerator)
Sets the {@link org.apache.batik.svggen.SVGIDGenerator} to be used. It should not be null.

setImageHandler

public final void setImageHandler(ImageHandler imageHandler)
Sets the {@link org.apache.batik.svggen.ImageHandler} to be used. It should not be null.

setPrecision

public final void setPrecision(int precision)
Sets the precision used by this context. The precision controls the number of decimal places used in floating point values output by the SVGGraphics2D generator. Note that the precision is clipped to the [0,12] range.

setStyleHandler

public final void setStyleHandler(StyleHandler styleHandler)
Sets the {@link org.apache.batik.svggen.StyleHandler} to be used. It should not be null.
Copyright B) 2007 Apache Software Foundation. All Rights Reserved.