-->
<!DOCTYPE elements [
-<!ELEMENT elements (element+) >
+<!ELEMENT elements (commonAttributes+, element+) >
<!ATTLIST elements
prefix CDATA #REQUIRED
ns CDATA #REQUIRED>
<!ELEMENT element (tagname, attributes) >
<!ELEMENT tagname (#PCDATA) >
-<!ELEMENT attributes (attribute+) >
+<!ELEMENT attributes ((attribute | includeAttributes)+) >
+<!ELEMENT commonAttributes ((attribute | includeAttributes)+) >
+<!ATTLIST commonAttributes
+ ref CDATA #REQUIRED>
<!ELEMENT attribute (#PCDATA) >
+<!ELEMENT includeAttributes (#PCDATA) >
+<!ATTLIST includeAttributes
+ ref CDATA #REQUIRED>
</xsl:choose>
</xsl:template>
+<xsl:template match="attributes"><xsl:apply-templates/></xsl:template>
+
+<xsl:template match="includeAttributes">
+<xsl:variable name="attr-ref">
+ <xsl:value-of select="@ref"/>
+</xsl:variable>
+<xsl:for-each select="/elements/commonAttributes">
+ <xsl:choose>
+ <xsl:when test="@ref = $attr-ref">
+ <xsl:apply-templates/>
+ </xsl:when>
+ </xsl:choose>
+</xsl:for-each>
+</xsl:template>
+
+<xsl:template match="attribute">"<xsl:apply-templates/>"<xsl:if test="not(position()=last())">, </xsl:if></xsl:template>
+
<xsl:template match="elements">
<xsl:apply-templates select="element"/>
</xsl:template>
public class <xsl:value-of select="$classname"/> extends SVGObj {
/**
- * inner class for making A objects.
+ * inner class for making <xsl:apply-templates select="tagname"/> objects.
*/
public static class Maker extends FObj.Maker {
/**
- * make a A object.
+ * make a <xsl:apply-templates select="tagname"/> object.
*
* @param parent the parent formatting object
* @param propertyList the explicit properties of this object
*
- * @return the A object
+ * @return the <xsl:apply-templates select="tagname"/> object
*/
public FObj make(FObj parent,
PropertyList propertyList) throws FOPException {
/**
* returns the maker for this object.
*
- * @return the maker for A objects
+ * @return the maker for <xsl:apply-templates select="tagname"/> objects
*/
public static FObj.Maker maker() {
return new <xsl:value-of select="$classname"/>.Maker();
}
/**
- * constructs a A object (called by Maker).
+ * constructs a <xsl:apply-templates select="tagname"/> object (called by Maker).
*
* @param parent the parent formatting object
* @param propertyList the explicit properties of this object
super(parent, propertyList);
this.name = "<xsl:value-of select="//@prefix"/>:<xsl:value-of select="$name"/>";
tagName = "<xsl:value-of select="$name"/>";
- props = new String[] {
- <xsl:for-each select="attributes/attribute">
- "<xsl:apply-templates/>"<xsl:if test="not(position()=last())">, </xsl:if>
- </xsl:for-each>
- };
+ props = new String[] {<xsl:apply-templates select="attributes"/>};
}
<xsl:if test="@addText">
<?xml version="1.0" ?>
-<elements prefix="svg" ns="http:">
+<elements prefix="svg" ns="http://www.w3.org/2000/svg">
+ <commonAttributes ref="stdAttrs">
+ <attribute>id</attribute>
+ <attribute>class</attribute>
+ </commonAttributes>
+ <commonAttributes ref="langSpaceAttrs">
+ <attribute>xml:lang</attribute>
+ <attribute>xml:space</attribute>
+ </commonAttributes>
+ <commonAttributes ref="testAttrs">
+ <attribute>requiredFeatures</attribute>
+ <attribute>requiredExtensions</attribute>
+ <attribute>systemLanguage</attribute>
+ </commonAttributes>
+ <commonAttributes ref="PresentationAttributes-All">
+ <includeAttributes ref="PresentationAttributes-Containers"/>
+ <includeAttributes ref="PresentationAttributes-feFlood"/>
+ <includeAttributes ref="PresentationAttributes-FillStroke"/>
+ <includeAttributes ref="PresentationAttributes-FontSpecification"/>
+ <includeAttributes ref="PresentationAttributes-Gradients"/>
+ <includeAttributes ref="PresentationAttributes-Graphics"/>
+ <includeAttributes ref="PresentationAttributes-Images"/>
+ <includeAttributes ref="PresentationAttributes-LightingEffects"/>
+ <includeAttributes ref="PresentationAttributes-Markers"/>
+ <includeAttributes ref="PresentationAttributes-TextContentElements"/>
+ <includeAttributes ref="PresentationAttributes-TextElements"/>
+ <includeAttributes ref="PresentationAttributes-Viewports"/>
+ </commonAttributes>
+ <commonAttributes ref="PresentationAttributes-Containers">
+ <attribute>enable-background</attribute>
+ </commonAttributes>
+ <commonAttributes ref="PresentationAttributes-feFlood">
+ <attribute>flood-color</attribute>
+ <attribute>flood-opacity</attribute>
+ </commonAttributes>
+ <commonAttributes ref="PresentationAttributes-FillStroke">
+ <attribute>fill</attribute>
+ <attribute>fill-opacity</attribute>
+ <attribute>fill-rule</attribute>
+ <attribute>stroke</attribute>
+ <attribute>stroke-dasharray</attribute>
+ <attribute>stroke-dashoffset</attribute>
+ <attribute>stroke-linecap</attribute>
+ <attribute>stroke-linejoin</attribute>
+ <attribute>stroke-miterlimit</attribute>
+ <attribute>stroke-opacity</attribute>
+ <attribute>stroke-width</attribute>
+ </commonAttributes>
+ <commonAttributes ref="PresentationAttributes-FontSpecification">
+ <attribute>font-family</attribute>
+ <attribute>font-size</attribute>
+ <attribute>font-size-adjust</attribute>
+ <attribute>font-stretch</attribute>
+ <attribute>font-style</attribute>
+ <attribute>font-variant</attribute>
+ <attribute>font-weight</attribute>
+ </commonAttributes>
+ <commonAttributes ref="PresentationAttributes-Gradients">
+ <attribute>stop-color</attribute>
+ <attribute>stop-opacity</attribute>
+ </commonAttributes>
+ <commonAttributes ref="PresentationAttributes-Graphics">
+ <attribute>clip-path</attribute>
+ <attribute>clip-rule</attribute>
+ <attribute>color</attribute>
+ <attribute>color-interpolation</attribute>
+ <attribute>color-rendering</attribute>
+ <attribute>cursor</attribute>
+ <attribute>display</attribute>
+ <attribute>filter</attribute>
+ <attribute>image-rendering</attribute>
+ <attribute>mask</attribute>
+ <attribute>opacity</attribute>
+ <attribute>pointer-events</attribute>
+ <attribute>space-rendering</attribute>
+ <attribute>text-rendering</attribute>
+ <attribute>visibility</attribute>
+ </commonAttributes>
+ <commonAttributes ref="PresentationAttributes-Images">
+ <attribute>color-profile</attribute>
+ </commonAttributes>
+ <commonAttributes ref="PresentationAttributes-LightingEffects">
+ <attribute>lighting-color</attribute>
+ </commonAttributes>
+ <commonAttributes ref="PresentationAttributes-Markers">
+ <attribute>marker-start</attribute>
+ <attribute>marker-mid</attribute>
+ <attribute>marker-end</attribute>
+ </commonAttributes>
+ <commonAttributes ref="PresentationAttributes-TextContentElements">
+ <attribute>alignment-baseline</attribute>
+ <attribute>baseline-shift</attribute>
+ <attribute>direction</attribute>
+ <attribute>glyph-orientation-horizontal</attribute>
+ <attribute>glyph-orientation-vertical</attribute>
+ <attribute>kerning</attribute>
+ <attribute>letter-spacing</attribute>
+ <attribute>text-decoration</attribute>
+ <attribute>unicode-bidi</attribute>
+ <attribute>word-spacing</attribute>
+ </commonAttributes>
+ <commonAttributes ref="PresentationAttributes-TextElements">
+ <attribute>writing-mode</attribute>
+ <attribute>text-anchor</attribute>
+ <attribute>dominant-baseline</attribute>
+ </commonAttributes>
+ <commonAttributes ref="PresentationAttributes-Viewports">
+ <attribute>clip</attribute>
+ <attribute>overflow</attribute>
+ </commonAttributes>
<element>
<tagname>a</tagname>
<attributes>
<element>
<tagname>circle</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="PresentationAttributes-FillStroke"/>
+ <includeAttributes ref="PresentationAttributes-Graphics"/>
<attribute>id</attribute>
<attribute>style</attribute>
<attribute>transform</attribute>
<element>
<tagname>altGlyph</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
</attributes>
</element>
<element>
<tagname>animate</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
</attributes>
</element>
<element>
<tagname>animateColor</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
</attributes>
</element>
<element>
<tagname>animateMotion</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
</attributes>
</element>
<element>
<tagname>animateTransform</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
</attributes>
</element>
<element>
<tagname>clipPath</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
<attribute>id</attribute>
<attribute>style</attribute>
<attribute>clipPathUnits</attribute>
<element>
<tagname>cursor</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
</attributes>
</element>
<element>
<tagname>defs</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
</attributes>
</element>
<element addText="true">
<element>
<tagname>ellipse</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
<attribute>id</attribute>
<attribute>style</attribute>
<attribute>transform</attribute>
<element>
<tagname>filter</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
</attributes>
</element>
<element>
<tagname>font</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
</attributes>
</element>
<element>
<tagname>g</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
<attribute>id</attribute>
<attribute>style</attribute>
<attribute>transform</attribute>
<element>
<tagname>glyph</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
</attributes>
</element>
<element>
<tagname>hkern</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
</attributes>
</element>
<element>
<tagname>image</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
<attribute>id</attribute>
<attribute>style</attribute>
<attribute>transform</attribute>
<element>
<tagname>line</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
<attribute>id</attribute>
<attribute>style</attribute>
<attribute>transform</attribute>
<element>
<tagname>linearGradient</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
<attribute>id</attribute>
<attribute>style</attribute>
<attribute>transform</attribute>
<element>
<tagname>marker</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
</attributes>
</element>
<element>
<tagname>mask</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
<attribute>id</attribute>
<attribute>style</attribute>
</attributes>
<element>
<tagname>missing-glyph</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
</attributes>
</element>
<element>
<tagname>path</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
<attribute>id</attribute>
<attribute>style</attribute>
<attribute>transform</attribute>
<element>
<tagname>pattern</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
<attribute>id</attribute>
<attribute>style</attribute>
<attribute>transform</attribute>
<element>
<tagname>polygon</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
<attribute>id</attribute>
<attribute>style</attribute>
<attribute>transform</attribute>
<element>
<tagname>polyline</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
<attribute>id</attribute>
<attribute>style</attribute>
<attribute>transform</attribute>
<element>
<tagname>radialGradient</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
<attribute>id</attribute>
<attribute>style</attribute>
<attribute>transform</attribute>
<element>
<tagname>rect</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="PresentationAttributes-FillStroke"/>
+ <includeAttributes ref="PresentationAttributes-Graphics"/>
<attribute>id</attribute>
<attribute>style</attribute>
<attribute>transform</attribute>
<element>
<tagname>set</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
</attributes>
</element>
<element>
<tagname>stop</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
<attribute>id</attribute>
<attribute>style</attribute>
<attribute>offset</attribute>
<element addText="true">
<tagname>style</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
</attributes>
</element>
<element>
<tagname>switch</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
<attribute>id</attribute>
<attribute>requiredFeatures</attribute>
<attribute>requiredExtensions</attribute>
<element>
<tagname>symbol</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
<attribute>id</attribute>
<attribute>style</attribute>
<attribute>viewBox</attribute>
<element>
<tagname>tref</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
<attribute>id</attribute>
<attribute>style</attribute>
<attribute>xlink:href</attribute>
<element addText="true">
<tagname>tspan</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
<attribute>id</attribute>
<attribute>style</attribute>
<attribute>x</attribute>
<element addText="true">
<tagname>text</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
<attribute>id</attribute>
<attribute>style</attribute>
<attribute>transform</attribute>
<element addText="true">
<tagname>textPath</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
<attribute>id</attribute>
<attribute>style</attribute>
<attribute>xlink:href</attribute>
<element addText="true">
<tagname>title</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
</attributes>
</element>
<element>
<tagname>use</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
<attribute>id</attribute>
<attribute>style</attribute>
<attribute>transform</attribute>
<element>
<tagname>vkern</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
</attributes>
</element>
</elements>
<name>offset</name>
<use-generic ispropclass="true">SVGStringProperty</use-generic>
</property>
-
<property>
<name>style</name>
<use-generic ispropclass="true">SVGStringProperty</use-generic>
<name>points</name>
<use-generic ispropclass="true">SVGStringProperty</use-generic>
</property>
+ <property>
+ <name>fill</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>fill-opacity</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>fill-rule</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>stroke</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>stroke-dasharray</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>stroke-dashoffset</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>stroke-linecap</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>stroke-linejoin</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>stroke-miterlimit</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>stroke-opacity</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>stroke-width</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>clip-path</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>clip-rule</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>color</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>color-interpolation</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>color-rendering</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>cursor</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>display</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>filter</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>image-rendering</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>opacity</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>mask</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>space-rendering</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>text-rendering</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>pointer-events</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
+ <property>
+ <name>visibility</name>
+ <use-generic ispropclass="true">SVGStringProperty</use-generic>
+ </property>
<property type="ref" family="fo">
<name>font-family</name>
import org.w3c.dom.svg.*;
+import org.apache.batik.bridge.*;
+import org.apache.batik.swing.svg.*;
+import org.apache.batik.swing.gvt.*;
+import org.apache.batik.gvt.*;
+import org.apache.batik.gvt.renderer.*;
+import org.apache.batik.gvt.filter.*;
+
import java.awt.*;
import java.awt.Image;
import java.awt.image.*;
Enumeration e = area.getChildren().elements();
while (e.hasMoreElements()) {
- org.apache.fop.layout.Box b =
- (org.apache.fop.layout.Box) e.nextElement();
+ org.apache.fop.layout.Box b = (org.apache.fop.layout.Box) e.nextElement();
+ if(b instanceof InlineArea) {
+ InlineArea ia = (InlineArea)b;
+ this.currentYPosition = ry - ia.getYOffset();
+ } else {
+ this.currentYPosition = ry - area.getPlacementOffset();
+ }
b.render(this);
}
this.currentXPosition += area.getContentWidth();
}
-
public void renderSVGArea(SVGArea area) {
- int x = this.currentAreaContainerXPosition;
+ int x = this.currentXPosition;
int y = this.currentYPosition;
int w = area.getContentWidth();
int h = area.getHeight();
- this.currentYPosition -= h;
+// this.currentYPosition -= h;
+
+ SVGDocument doc = area.getSVGDocument();
+
+ UserAgent userAgent = new MUserAgent(new AffineTransform());
+ GVTBuilder builder = new GVTBuilder();
+ GraphicsNodeRenderContext rc = getRenderContext();
+ BridgeContext ctx = new BridgeContext(userAgent, rc);
+ GraphicsNode root;
+ try {
+ root = builder.build(ctx, doc);
+ //rc.setTransform(new AffineTransform(1, 0, x, 0, 1, y));
+ graphics.translate(x / 1000f, pageHeight - y / 1000f);
+ root.paint(graphics, rc);
+ graphics.translate(-x / 1000f, y / 1000f - pageHeight);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ this.currentXPosition += area.getContentWidth();
+
+/* final JSVGComponent svgComponent = new JSVGComponent(userAgent, true, true);
+// JFrame frame = new JFrame();
+// frame.setSize(300, 300);
+// frame.getContentPane().add(svgComponent);
+// frame.setVisible(true);
+ svgComponent.setSVGDocument(doc);
+
+ svgComponent.addGVTTreeRendererListener(new GVTTreeRendererListener() {
+ public void gvtRenderingPrepare(GVTTreeRendererEvent e)
+ {
+ System.out.println("rendering prepare:" + e);
+ }
+
+ public void gvtRenderingStarted(GVTTreeRendererEvent e)
+ {
+ System.out.println("rendering started:" + e);
+ }
+
+ public void gvtRenderingCancelled(GVTTreeRendererEvent e)
+ {
+ }
+
+ public void gvtRenderingFailed(GVTTreeRendererEvent e)
+ {
+ }
+
+ public void gvtRenderingCompleted(GVTTreeRendererEvent e)
+ {
+ System.out.println("rendering complete:" + e);
+ Object src = e.getSource();
+ Image im = e.getImage();
+ svgComponent.paint(graphics);
+ }
+ });*/
}
+ public GraphicsNodeRenderContext getRenderContext() {
+ GraphicsNodeRenderContext nodeRenderContext = null;
+ if (nodeRenderContext == null) {
+ RenderingHints hints = new RenderingHints(null);
+ hints.put(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+
+ hints.put(RenderingHints.KEY_INTERPOLATION,
+ RenderingHints.VALUE_INTERPOLATION_BILINEAR);
+
+ FontRenderContext fontRenderContext =
+ new FontRenderContext(new AffineTransform(), true, true);
+
+ TextPainter textPainter = new StrokingTextPainter();
+
+ GraphicsNodeRableFactory gnrFactory =
+ new ConcreteGraphicsNodeRableFactory();
+
+ nodeRenderContext =
+ new GraphicsNodeRenderContext(new AffineTransform(),
+ null,
+ hints,
+ fontRenderContext,
+ textPainter,
+ gnrFactory);
+ }
+
+ return nodeRenderContext;
+ }
public void setProducer(String producer) {
area.getObject().render(this);
}
-}
+ protected class MUserAgent implements UserAgent {
+ AffineTransform currentTransform = null;
+ /**
+ * Creates a new SVGUserAgent.
+ */
+ protected MUserAgent(AffineTransform at) {
+ currentTransform = at;
+ }
+
+ /**
+ * Displays an error message.
+ */
+ public void displayError(String message) {
+ System.err.println(message);
+ }
+
+ /**
+ * Displays an error resulting from the specified Exception.
+ */
+ public void displayError(Exception ex) {
+ ex.printStackTrace(System.err);
+ }
+
+ /**
+ * Displays a message in the User Agent interface.
+ * The given message is typically displayed in a status bar.
+ */
+ public void displayMessage(String message) {
+ System.out.println(message);
+ }
+
+ /**
+ * Returns a customized the pixel to mm factor.
+ */
+ public float getPixelToMM() {
+ return 0.264583333333333333333f; // 72 dpi
+ }
+
+ /**
+ * Returns the language settings.
+ */
+ public String getLanguages() {
+ return "en";//userLanguages;
+ }
+
+ /**
+ * Returns the user stylesheet uri.
+ * @return null if no user style sheet was specified.
+ */
+ public String getUserStyleSheetURI() {
+ return null;//userStyleSheetURI;
+ }
+ /**
+ * Returns the class name of the XML parser.
+ */
+ public String getXMLParserClassName() {
+ String parserClassName =
+ System.getProperty("org.xml.sax.parser");
+ if (parserClassName == null) {
+ parserClassName = "org.apache.xerces.parsers.SAXParser";
+ }
+ return parserClassName;//application.getXMLParserClassName();
+ }
+ /**
+ * Opens a link in a new component.
+ * @param doc The current document.
+ * @param uri The document URI.
+ */
+ public void openLink(SVGAElement elt)
+ {
+ //application.openLink(uri);
+ }
+ public Point getClientAreaLocationOnScreen()
+ {
+ return new Point(0, 0);
+ }
+
+ public void setSVGCursor(java.awt.Cursor cursor)
+ {
+ }
+
+ public AffineTransform getTransform()
+ {
+ return currentTransform;
+ }
+
+ public Dimension2D getViewportSize()
+ {
+ return new Dimension(100, 100);
+ }
+ }
+}
DefaultSVGContext dc = new DefaultSVGContext() {
public float getPixelToMM() {
- return 12;
+ return 0.264583333333333333333f; // 72 dpi
}
public float getViewportWidth() {
return 100;
};
doc.setSVGContext(dc);
- System.out.println("tag:" + tagName);
+ //System.out.println("tag:" + tagName);
Element topLevel = doc.createElementNS("http://www.w3.org/2000/svg", tagName);
for(int count = 0; count < props.length; count++) {
String rf = this.properties.get(props[count]).getString();
Element element = doc.createElementNS("http://www.w3.org/2000/svg", tagName);
// Element element = doc.createElement(tagName);
for(int count = 0; count < props.length; count++) {
- String rf = this.properties.get(props[count]).getString();
- element.setAttribute(props[count], rf);
+ if(this.properties.get(props[count]) != null) {
+ String rf = this.properties.get(props[count]).getString();
+ element.setAttribute(props[count], rf);
+ }
}
parent.appendChild(element);
int numChildren = this.children.size();