public class SVGDocumentBuilderConfigurator extends Object
SVGDocumentBuilder
instance.
The generated SVG file will be different depending on this configuration.SVGDocumentBuilder
Modifier and Type | Class and Description |
---|---|
static interface |
SVGDocumentBuilderConfigurator.GraphicTranslator
This interface must be implemented by classes that want
to translate an
IlvGraphic to an instance
of an SVG DOM Element . |
static interface |
SVGDocumentBuilderConfigurator.RealToStringConverter
This interface must be implemented by classes that want to
define how the SVG DOM used by the
SVGDocumentBuilder will
translate real number values to DOM strings. |
Modifier and Type | Field and Description |
---|---|
static short |
BASIC_SVG
Generates SVG documents using the basic profile of SVG.
|
static int |
COMPACT_LOD
Performs compaction by not generating SVG for an
IlvManagerLayer that can be loaded only on demand for an
SVG client (layers that are not visible). |
static int |
COMPACT_POLY
Performs compaction by reducing the number of points of polylines,
polygons, and so forth.
|
static int |
COMPACT_STYLE
Performs style compaction on the generated SVG document.
|
static int |
COMPACT_VIEWBOX
Performs compaction by removing graphic elements outside of the
viewBox . |
static int |
COMPACT_VISIBLE
Performs compaction by removing invisible graphic elements from the
generated file.
|
static short |
FULL_SVG
Generates SVG documents using the full profile of SVG.
|
static String |
JVIEWS_GF_NAMESPACE_PREFIX
Rogue Wave JViews Graphics Framework XML Namespace default Prefix.
|
static String |
JVIEWS_GF_NAMESPACE_URI
Rogue Wave JViews Graphics Framework XML Namespace URI.
|
static short |
LOCAL_DTD
Uses a local DTD.
|
static int |
NO_COMPACT
Performs no compaction on the generated SVG document.
|
static short |
SVG_CSS
Uses the CSS styling capabilities of SVG.
|
static short |
SVG_XML
Uses the XML styling capabilities (presentation attributes) of SVG.
|
static short |
WEB_DTD
Uses the official W3C DTD on the Web.
|
Constructor and Description |
---|
SVGDocumentBuilderConfigurator()
Builds an
SVGDocumentBuilderConfigurator instance. |
Modifier and Type | Method and Description |
---|---|
String |
getAttribute(String attribute)
Returns the preset value of an attribute of the outermost SVG element.
|
int |
getCompactMode()
Returns the current compaction mode.
|
String |
getDTDID()
Returns the ID of the DTD.
|
short |
getDTDMode()
Returns the mode of the SVG DTD.
|
String |
getDTDURL()
Returns the URL string of the DTD location.
|
String |
getPrefix(String xmlNamespaceURI)
Returns the prefix used to generate metadata from the given XML namespace.
|
SVGDocumentBuilderConfigurator.RealToStringConverter |
getRealToStringConverter()
Returns the object that defines how real numbers are converted to
String . |
short |
getStylingMode()
Returns the SVG version output mode.
|
short |
getSVGProfile()
Returns the SVG profile used to generate SVG documents.
|
IlvTransformer |
getTransformer()
Returns the transformer used to dump the contents of the
IlvManager . |
SVGDocumentBuilderConfigurator.GraphicTranslator |
getTranslator(String className)
Returns the
GraphicTranslator that will be used to translate
the IlvGraphic instances of class className . |
IlvRect |
getViewBox()
Returns the
viewBox rectangle. |
boolean |
isEmbeddedImagesOn()
Returns
true if the translation of IlvIcon should
embed the images in the SVG file instead of referencing them. |
boolean |
isFullDocumentOn()
Returns
true if the SVGDocumentBuilder is
allowed to regenerate unknown
SVG elements and attributes or properties that were stored when
reading the SVG Document. |
boolean |
isMetadataOn(String xmlNamespaceURI)
Returns
true if the SVGDocumentBuilder will
generate special metadata from the given XML namespace if available. |
boolean |
isViewBoxOn()
Returns the
viewBox policy. |
void |
putTranslator(String className,
SVGDocumentBuilderConfigurator.GraphicTranslator translator)
Allows you to specialize the generation for a particular
IlvGraphic class by registering the
GraphicTranslator . |
void |
setAttribute(String attribute,
String value)
Sets the value of an attribute of the outermost SVG element except the
viewBox attribute. |
void |
setCompactMode(int val)
Sets one or a combination of flags to generate smaller SVG documents.
|
void |
setDTDMode(short mode)
Sets the mode of the output stream SVG DTD.
|
void |
setEmbeddedImagesOn(boolean value)
Specifies whether images are embedded or referenced.
|
void |
setFullDocumentOn(boolean val)
Allows the
SVGDocumentBuilder to regenerate unknown
SVG elements and attributes or properties that were stored
when reading the SVG Document. |
void |
setMetadataOn(String xmlNamespaceURI,
String xmlNamespacePrefix,
boolean value)
Allows you to tell the
SVGDocumentBuilder to generate special
metadata from the given XML namespace if available. |
void |
setRealToStringConverter(SVGDocumentBuilderConfigurator.RealToStringConverter converter)
Allows you to set the way real numbers are converted to
String . |
void |
setStylingMode(short style)
Sets the SVG styling mode.
|
void |
setSVGProfile(short profile)
Sets the SVG profile used to generate SVG documents.
|
void |
setTransformer(IlvTransformer t)
Allows you to change the transformer used to dump the contents
of the
IlvManager in SVG. |
void |
setViewBox(IlvRect rect)
Sets the rectangle that will define the
viewBox on the
resulting SVG document, in IlvManager coordinates. |
void |
setViewBoxOn(boolean value)
Sets the
viewBox policy. |
public static final short SVG_CSS
setStylingMode(short)
,
Constant Field Valuespublic static final short SVG_XML
setStylingMode(short)
,
Constant Field Valuespublic static final short WEB_DTD
public static final short LOCAL_DTD
public static final int NO_COMPACT
public static final int COMPACT_STYLE
public static final int COMPACT_VISIBLE
public static final int COMPACT_VIEWBOX
viewBox
.
This flag could be combined with other compaction flags.public static final int COMPACT_POLY
public static final int COMPACT_LOD
IlvManagerLayer
that can be loaded only on demand for an
SVG client (layers that are not visible).
This flag could be combined with other compaction flags. It will be taken
into account only if the configurator also generated metadata that allows
you to recover the layer later on, that is, if
JVIEWS_GF_NAMESPACE_URI
is set with setMetadataOn(java.lang.String, java.lang.String, boolean)
.public static final short FULL_SVG
public static final short BASIC_SVG
public static final String JVIEWS_GF_NAMESPACE_URI
setMetadataOn(java.lang.String, java.lang.String, boolean)
is
called with this value, the SVGDocumentBuilder
will generate
some metadata to better describe Rogue Wave JViews objects in the resulting SVG.
When used with the correct ECMAScript code on the client and the
IlvSVGManagerServlet
on the server, the
metadata data will allow the following on the SVG user agent, to:
IlvGraphic
IlvFixedSizeGraphic
and
IlvLabel
instancesJVIEWS_GF_NAMESPACE_PREFIX
prefix.public static final String JVIEWS_GF_NAMESPACE_PREFIX
JVIEWS_GF_NAMESPACE_URI
as a parameter of setMetadataOn(String, String, boolean)
JVIEWS_GF_NAMESPACE_URI
,
setMetadataOn(java.lang.String, java.lang.String, boolean)
,
Constant Field Valuespublic SVGDocumentBuilderConfigurator()
SVGDocumentBuilderConfigurator
instance.public final void setTransformer(IlvTransformer t)
IlvManager
in SVG.
The default is a null
value for the identity transformer.t
- The transformer to set.public final IlvTransformer getTransformer()
IlvManager
.public final void setStylingMode(short style)
SVG_CSS
.public final short getStylingMode()
setStylingMode(short)
public final void setDTDMode(short mode)
public final short getDTDMode()
setDTDMode(short)
public String getDTDURL()
public String getDTDID()
public final void setCompactMode(int val)
NO_COMPACT
.val
- A value representing one or more compaction flags.NO_COMPACT
,
COMPACT_STYLE
,
COMPACT_VISIBLE
,
COMPACT_VIEWBOX
,
COMPACT_POLY
,
COMPACT_LOD
public final int getCompactMode()
setCompactMode(int)
public final void setFullDocumentOn(boolean val)
SVGDocumentBuilder
to regenerate unknown
SVG elements and attributes or properties that were stored
when reading the SVG Document.
Examples are 'script' or 'filter' elements.
The default value is false
.val
- Set true
to allow full regeneration.public final boolean isFullDocumentOn()
true
if the SVGDocumentBuilder
is
allowed to regenerate unknown
SVG elements and attributes or properties that were stored when
reading the SVG Document.
The default value is false
.setFullDocumentOn(boolean)
public final void setViewBox(IlvRect rect)
viewBox
on the
resulting SVG document, in IlvManager
coordinates.
The viewBox
is the rectangle defining the objects that will be
visible in the drawing area of the generated SVG document.
The default value is null
; this means that the
viewBox
will be automatically computed to show all
the visible objects of the manager.rect
- The defining rectangle, in IlvManager
coordinates.setViewBoxOn(boolean)
public final IlvRect getViewBox()
viewBox
rectangle.setViewBox(ilog.views.IlvRect)
public final void setViewBoxOn(boolean value)
viewBox
policy. If set to true
, a
viewBox
will be computed or taken from getViewBox()
and added to the generated file. If set to false
, if the full
parsing mode is on (isFullDocumentOn()
), the values of the
original SVGDocument are used; or no viewBox
is set if there
is no original document.
The default value is true
.value
- true
to set a view box, or
false
otherwise.public final boolean isViewBoxOn()
viewBox
policy.setViewBoxOn(boolean)
public final void setAttribute(String attribute, String value)
viewBox
attribute. The attribute
parameter
should be a valid SVG attribute of the
'svg' element according to the SVG specification.
This is the proper way to set the x
, y
,
width
, and height
'svg' element attributes or
its preserveAspectRatio
or zoomAndPan
attribute.attribute
- The attribute.value
- The value of the attribute to set.setViewBox(ilog.views.IlvRect)
public final String getAttribute(String attribute)
null
if the attribute has not been preset.attribute
- The attribute to query.setAttribute(java.lang.String, java.lang.String)
public SVGDocumentBuilderConfigurator.GraphicTranslator getTranslator(String className)
GraphicTranslator
that will be used to translate
the IlvGraphic
instances of class className
.className
- The name of the IlvGraphic
class.putTranslator(java.lang.String, ilog.views.svg.SVGDocumentBuilderConfigurator.GraphicTranslator)
public final void putTranslator(String className, SVGDocumentBuilderConfigurator.GraphicTranslator translator)
IlvGraphic
class by registering the
GraphicTranslator
. This method is useful if
you want replace the generic mechanism by your own
IlvGraphic
classes
when saving your IlvManager
in SVG:
// IlvGraphic definition file package mycompany; public class MyGraphic { // ... } // GraphicTranslator definition file package mycompany; public class MyGraphicTranslator { public Element translate(IlvGraphic graphic, IlvTransformer t, SVGDocumentBuilder builder) { MyGraphic my = (MyGraphic)graphic; // for example we create an SVG g element Element elmt = builder.getDocument().createElementNS("http://www.w3.org/2000/svg", "g"); // ... fill the element ... return elmt; } } // used in another file: SVGStreamFactory factory = new SVGStreamFactory(); factory.getBuilderConfigurator().putTranslator("mycompany.MyGraphic", new MyGraphicTranslator()); myManager.setStreamFactory(factory); myManager.write("file.svg");
className
- The name of the IlvGraphic
class.translator
- The graphic translator to register.public final void setRealToStringConverter(SVGDocumentBuilderConfigurator.RealToStringConverter converter)
String
.converter
- The converter to set.SVGDocumentBuilderConfigurator.RealToStringConverter
,
getRealToStringConverter()
public final SVGDocumentBuilderConfigurator.RealToStringConverter getRealToStringConverter()
String
.
The default value is the instance of DefaultRealToStringConverter
.public final short getSVGProfile()
FULL_SVG
,
BASIC_SVG
,
setSVGProfile(short)
public final void setSVGProfile(short profile)
FULL_SVG
profile and the BASIC_SVG
profile of the SVG 1.1 specification.profile
- The SVG profile to set.public final boolean isEmbeddedImagesOn()
true
if the translation of IlvIcon
should
embed the images in the SVG file instead of referencing them.
The default is false
.setEmbeddedImagesOn(boolean)
public final void setEmbeddedImagesOn(boolean value)
true
will allow
IlvIcon
translations
to embed the images in the SVG file instead of referencing them.
The default is false
.value
- Set true
to embed the images, or
false
to reference the images.isEmbeddedImagesOn()
public final boolean isMetadataOn(String xmlNamespaceURI)
true
if the SVGDocumentBuilder
will
generate special metadata from the given XML namespace if available.
The only recognized namespace is JVIEWS_GF_NAMESPACE_URI
.xmlNamespaceURI
- The URI of the namespace.public final String getPrefix(String xmlNamespaceURI)
xmlNamespaceURI
- The URI of the namespace.public final void setMetadataOn(String xmlNamespaceURI, String xmlNamespacePrefix, boolean value)
SVGDocumentBuilder
to generate special
metadata from the given XML namespace if available.
The only recognized namespace is JVIEWS_GF_NAMESPACE_URI
, which must
be used with the JVIEWS_GF_NAMESPACE_PREFIX
prefix.xmlNamespaceURI
- The URI of the namespace.xmlNamespacePrefix
- The prefix that will be used for this namespace.value
- true
to instruct the
SVGDocumentBuilder
to generate metadata from this namespace.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.