xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cameron McCormack <cam-batik-us...@aka.mcc.id.au>
Subject Re: getting calculated property (fill/weight/etc.)
Date Tue, 10 Feb 2004 22:14:11 GMT
Hi Bibek.

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

> ...

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

getPresentationAttribute returns a CSSValue that represents the actual
XML presentation attribute, not the computed style property.  What you
really want to do is get the computed style declaration and then get
the individual properties from that.

  Element e = ...;
  SVGElement svg = (SVGElement) e.getOwnerDocument().getDocumentElement();
  CSSStyleDeclaration style = svg.getComputedStyle(e, null);
  // then you can get properties by string value...
  String value = style.getPropertyValue("fill");
  // ...or by CSSValue
  CSSValue value = style.getPropertyCSSValue("fill");

Cameron

-- 
Cameron McCormack
|  Web: http://mcc.id.au/
|  ICQ: 26955922

---------------------------------------------------------------------
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