xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bishop, Michael W. CONTR J9C880" <Michael.Bis...@je.jfcom.mil>
Subject RE: Seemingly simple question...
Date Thu, 22 Dec 2005 21:13:34 GMT
OK, well in that case, working with CSS won't be so bad.  Now on the SAC
page, they have their own implementation, and they also say that Batik
has an implementation.  What kind of object is "e" where you can call
getStyle() on it?  Do you use the Batik 1.2 SAC or the standalone SAC
1.3?

Michael Bishop

-----Original Message-----
From: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] 
Sent: Thursday, December 22, 2005 4:08 PM
To: batik-users@xmlgraphics.apache.org
Subject: Re: Seemingly simple question...

Hi Michael,

"Bishop, Michael W. CONTR J9C880" <Michael.Bishop@je.jfcom.mil> wrote on

12/22/2005 01:51:14 PM:

> Is there any way to turn "off" an element?  Like show/hide?  I want to

apply a
> show/hide functionality to a g tag.  I don't see anything in my book
or 
the 
> spec on it, save the CSS property.  I don't want to hassle with CSS;
in 
order 
> to use it, I'd have to check for the style tag, see if there's a
display 
tag, 
> add one if it's not there, and preserve the other attributes

   There are two CSS properties which provide slightly different
versions
of this functionality: 'display', and 'visibility'.  There are a number
of ways to control them, the simplest is to use the 'presentation 
attributes'
these are normal xml attributes that are "reflected" in the CSS cascade.

   So assuming nothing else in CSS land is modifying the property on the
element you can just do:

        e.setAttributeNS(null, "display", "none");

   This will not win however if there is 'style="display: inline"' for 
example.
So the 'correct' way to do this is with the SAC (Simple API for CSS).
This
introduces a 'style' member to the element which you can use to get and 
set
properties on the element:

        e.getStyle().setProperty("display", "none", "");

   The third argument can be "!important" which boosts it's priority.

   Of the two if the element is likely to become visible again later it
is best to use 'visibility', there are some issues since visibility can
be 'overridden' further down in the tree.  Also when visibility is
hidden
it still takes up memory in the rendering tree.

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


Mime
View raw message