ilog.views.svg
Class SVGDocumentBuilder

java.lang.Object
  extended by ilog.views.svg.SVGDocumentBuilder

public class SVGDocumentBuilder
extends Object

This class populates an SVGDocument with the translation of the IlvGraphic instances of an IlvGraphicBag. It is used by the SVGInputStream to translate the contents of an IlvManager to an SVG file. However, you can also use this class by itself to build an SVGDocument from any kind of IlvGraphicBag. You can also subclass it to specialize its behavior.


Constructor Summary
SVGDocumentBuilder(SVGDocumentBuilderConfigurator conf)
          Builds an instance of SVGDocumentBuilder from the given configurator.
 
Method Summary
protected  void afterBuildingDocument()
          Called after building the SVGDocument to add additional information to it.
 void appendStyle(String attribute, String value)
          Called to append a style value to the style list of the currently written element.
 org.w3c.dom.svg.SVGDocument buildDocument(IlvGraphicSet set)
          Creates and fills an SVGDocument with SVGElement instances translated from the graphic objects of the IlvGraphicSet.
 org.w3c.dom.svg.SVGDocument buildDocument(IlvManager manager)
          Creates and fills an SVGDocument with SVGElement instances translated from the graphic objects of the IlvManager.
 org.w3c.dom.svg.SVGElement buildSVGElement(org.w3c.dom.svg.SVGDocument document, IlvManager manager)
          Creates and fills an SVGDocument with sub SVGElement instances translated from the graphic objects of the IlvManager.
 void endStylingElement()
          Closes the styling session on the current element.
 SVGDocumentBuilderConfigurator getConfigurator()
          Returns the SVGDocumentBuilderConfigurator for this builder.
 org.w3c.dom.svg.SVGDefsElement getDefinition()
          Returns the definition node of the SVG document.
 org.w3c.dom.svg.SVGDocument getDocument()
          Returns the SVG document.
 org.w3c.dom.svg.SVGSVGElement getMainSVGElement()
          Returns the main SVG element of the SVG document.
 Element getMetadata()
          Returns the metadata node of the SVG document.
 void startStylingElement(Element element, IlvGraphic graphic)
          Called to initiate a styling session on the given Element.
protected  Element translate(IlvGraphic graphic, IlvTransformer t)
          Returns an Element for the given graphic object.
protected  Element translate(IlvManagerLayer layer)
          Returns an Element for the given IlvManagerLayer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SVGDocumentBuilder

public SVGDocumentBuilder(SVGDocumentBuilderConfigurator conf)
Builds an instance of SVGDocumentBuilder from the given configurator.

Method Detail

getDocument

public final org.w3c.dom.svg.SVGDocument getDocument()
Returns the SVG document. This method should be used as a factory to create your own Element instances when specializing SVGDocumentBuilder or writing your own SVGDocumentBuilderConfigurator.GraphicTranslator.


getDefinition

public final org.w3c.dom.svg.SVGDefsElement getDefinition()
Returns the definition node of the SVG document. This method allows you to add definitions to it when specializing SVGDocumentBuilder or writing your own SVGDocumentBuilderConfigurator.GraphicTranslator.


getMetadata

public final Element getMetadata()
Returns the metadata node of the SVG document. This method allows you to add definitions to it when specializing SVGDocumentBuilder or writing your own SVGDocumentBuilderConfigurator.GraphicTranslator.

Since:
JViews 5.5

getMainSVGElement

public final org.w3c.dom.svg.SVGSVGElement getMainSVGElement()
Returns the main SVG element of the SVG document.


getConfigurator

public final SVGDocumentBuilderConfigurator getConfigurator()
Returns the SVGDocumentBuilderConfigurator for this builder.

Since:
JViews 5.0

afterBuildingDocument

protected void afterBuildingDocument()
Called after building the SVGDocument to add additional information to it. The default implementation does nothing.


buildSVGElement

public org.w3c.dom.svg.SVGElement buildSVGElement(org.w3c.dom.svg.SVGDocument document,
                                                  IlvManager manager)
Creates and fills an SVGDocument with sub SVGElement instances translated from the graphic objects of the IlvManager.

Since:
JViews 5.0

buildDocument

public org.w3c.dom.svg.SVGDocument buildDocument(IlvManager manager)
Creates and fills an SVGDocument with SVGElement instances translated from the graphic objects of the IlvManager.


buildDocument

public org.w3c.dom.svg.SVGDocument buildDocument(IlvGraphicSet set)
Creates and fills an SVGDocument with SVGElement instances translated from the graphic objects of the IlvGraphicSet.


translate

protected Element translate(IlvManagerLayer layer)
Returns an Element for the given IlvManagerLayer. If it returns null, the layer will not be added to the generated SVG Document.

Parameters:
layer - The layer to be translated.
Since:
JViews 5.5

translate

protected Element translate(IlvGraphic graphic,
                            IlvTransformer t)
Returns an Element for the given graphic object. It calls the SVGDocumentBuilderConfigurator.GraphicTranslator specific to the graphic object class. You should not redefine this method to translate your own graphic object. You should instead have a look at the SVGDocumentBuilderConfigurator.putTranslator(java.lang.String, ilog.views.svg.SVGDocumentBuilderConfigurator.GraphicTranslator) method.

Parameters:
graphic - The graphic to be translated.
t - The transformer to apply to the graphic before translating it.

startStylingElement

public final void startStylingElement(Element element,
                                      IlvGraphic graphic)
Called to initiate a styling session on the given Element. If the Element that should be styled represents an IlvGraphic, you can pass it as a parameter to add additional styling information coming from a previous SVG import into the IlvManager.

See Also:
appendStyle(String, String), SVGDocumentBuilderConfigurator.getStylingMode(), SVGDocumentBuilderConfigurator.getCompactMode()

appendStyle

public final void appendStyle(String attribute,
                              String value)
Called to append a style value to the style list of the currently written element. This method should be called only in a styling session opened by startStylingElement(Element,IlvGraphic) and closed by endStylingElement().


endStylingElement

public final void endStylingElement()
Closes the styling session on the current element.

See Also:
appendStyle(String, String)


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.