xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bibek Sahu <scor...@dodds.net>
Subject getting calculated property (fill/weight/etc.)
Date Tue, 10 Feb 2004 20:51:31 GMT

Howdy all,

How do I get the calculated property associated with an element?  For
example, suppose I have the code:

<tspan id="outer" fill="red" style="font-style:italic"> this is <tspan
id="inner" style="font-weight:bold">bold</tspan>. </tspan>



Now, that whole chunk of text should be in red-italics, and only the world
"bold" (in tspan "inner") should be in boldface.  So suppose I have the
SVGTSpanElement whose id="inner": how would I find the color it should be
rendered in?  The style (italics)?  [This is from inside my Java code, so
I also have access to the GVT tree, etc.]

I've tried using SVGStylable.getPresentationAttribute(DOMString), but I
keep getting DOMExceptions:

cssValue = org.apache.batik.dom.svg.SVGStylableElement$PresentationAttributeValue@1a8fb1b
getProperty: caught DOMException: code=11
org.w3c.dom.DOMException:
        at org.apache.batik.dom.svg.SVGStylableElement$PresentationAttributeValue.getValue(Unknown
Source)
        at org.apache.batik.css.dom.CSSOMValue.getCssText(Unknown Source)
        at org.globalcircle.svg.SVGUtils.getProperty(SVGUtils.java:277)
        at org.globalcircle.svg.modehandlers.TextModeHandler.updateCaret(TextModeHandler.java:133)
        at org.globalcircle.svg.modehandlers.TextModeHandler.setCaretPosition(TextModeHandler.java:113)
        at org.globalcircle.svg.modehandlers.TextModeHandler$1.handleEvent(TextModeHandler.java:167)
        at org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown Source)
        at org.apache.batik.dom.events.EventSupport.dispatchEvent(Unknown Source)
        at org.apache.batik.dom.AbstractNode.dispatchEvent(Unknown Source)
        at org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Unknown
Source)
        at org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Unknown
Source)
        at org.apache.batik.bridge.BridgeEventSupport$Listener.mouseClicked(Unknown Source)
        at org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(Unknown Source)
        at org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(Unknown Source)
        at org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(Unknown Source)
        at org.apache.batik.gvt.event.AWTEventDispatcher.mouseClicked(Unknown Source)
        at org.apache.batik.swing.svg.JSVGComponent$17.run(Unknown Source)
        at org.apache.batik.util.RunnableQueue.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:534)
        caretPosition=9, weight=bold, style=, fill=null, stroke=null, stroke-width=null, color=null


(this is using the CVS version of Batik)


I notice that interface CSSValue only has one method of potential-value to
me: "String getCSSText()"... which is the one throwing the exception...


Ideas?  Suggestions?

Thanks!
- Bibek


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message