You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Steven Huey <st...@stevenhuey.net> on 2005/02/18 19:34:24 UTC
Batik & Swing Questions
I'm starting to dig into the source code to try and figure out a few
things, but figured I ask here to try and save myself some time.
If I have a JSVGCanvas within a JSVGScroll pane does the document state
have to be set to ALWAYS_STATIC? If I do the following:
JPanel panel = new JPanel(new BorderLayout());
JSVGCanvas canvas = new JSVGCanvas();
JSVGScrollPane scrollPane = new JSVGScrollPane(canvas);
canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
canvas.setURI(someURI);
panel.add(scrollPane, BorderLayout.CENTER);
Nothing is drawn in the JFrame that the panel is added to, if I comment
out the fourth line it is drawn and scrolls just fine. Is there a way
to get ALWAYS_DYNAMIC documents to scroll within a JSVGScrollPane?
Secondly, what is the relationship between the SVG viewport, SVG
viewBox attribute, and the size of the JSVGCanvas? How are things
different (if at all) when the JSVGCanvas is placed inside a
JSVGScrollPane? What I'd like to be able to do is load a SVG document
into a JSVGCanvas within a JSVGScrollPane with the SVG document set to
display at a preset size, rather than automatically resizing to fit the
size of the JSVGCanvas. I need to set the document state to
ALWAYS_DYNAMIC so that I can dynamically modify the "display" attribute
of several elements at runtime.
Any help is appreciated, please let me know if you need any more
information.
Thanks,
Steven Huey
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Batik & Swing Questions
Posted by James Shaw <he...@btopenworld.com>.
Antonio Gomes wrote:
>Hello Steve ,
>
>how can I pull the code from CVS ?! I'm using Debian
>Sarge ...
>
>Thanks ..
>
>
>
Install cvs client (apt-get cvs) IIRC.
Then
cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic checkout xml-batik
This information is on the Batik website, so rtfm! ;-)
James Shaw
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Batik & Swing Questions
Posted by Antonio Gomes <to...@yahoo.com.br>.
Hello Steve ,
how can I pull the code from CVS ?! I'm using Debian
Sarge ...
Thanks ..
--- Steven Huey <st...@stevenhuey.net> escreveu:
> Thanks Thomas - I just tested things with the new
> code from CVS and
> it's working great!
>
> - Steve
>
> On Feb 23, 2005, at 6:28 AM, Thomas DeWeese wrote:
>
> > Hi Steven,
> > There should be a fix for this in CVS now.
> >
> > Steven Huey wrote:
> >> Wrong archive, sorry. It's fixed now, the URL is
> the same:
> >> http://www.stevenhuey.net/test.zip .
> >
> >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> batik-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail:
> batik-users-help@xml.apache.org
> >
> >
> >
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> batik-users-help@xml.apache.org
>
>
=====
Antônio Gomes
---------------
Embedded Linux Developer
Ciência da Computação - Universidade Federal do Amazonas
Laboratório de Linux Embarcado - "10LE"
Instituto Nokia de Tecnologia - INdT
_______________________________________________________
Yahoo! Acesso Grátis - Instale o discador do Yahoo! agora. http://br.acesso.yahoo.com/ - Internet rápida e grátis
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Batik & Swing Questions
Posted by Steven Huey <st...@stevenhuey.net>.
Thanks Thomas - I just tested things with the new code from CVS and
it's working great!
- Steve
On Feb 23, 2005, at 6:28 AM, Thomas DeWeese wrote:
> Hi Steven,
> There should be a fix for this in CVS now.
>
> Steven Huey wrote:
>> Wrong archive, sorry. It's fixed now, the URL is the same:
>> http://www.stevenhuey.net/test.zip .
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Batik & Swing Questions
Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Steven,
There should be a fix for this in CVS now.
Steven Huey wrote:
> Wrong archive, sorry. It's fixed now, the URL is the same:
> http://www.stevenhuey.net/test.zip .
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Batik & Swing Questions
Posted by Steven Huey <st...@stevenhuey.net>.
Wrong archive, sorry. It's fixed now, the URL is the same:
http://www.stevenhuey.net/test.zip .
- Steve
On Feb 22, 2005, at 2:45 PM, Thomas DeWeese wrote:
> Hi Steven,
>
> Steven Huey wrote:
>
>> I've placed a test program online at
>> http://www.stevenhuey.net/test.zip that illustrates the problems I'm
>> having. It can be compiled and run by either typing "ant clean
>> static" or "ant clean dynamic".
>
> This appears to be precompiled everything. There is no source or
> ant 'build.xml' file. There is not much I can do with this...
>
>> If you have a chance to test this on your machine, and to look at the
>> Test.java source and let me know if I've missed anything I'd
>> appreciate it.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Batik & Swing Questions
Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Steven,
Steven Huey wrote:
> I've placed a test program online at http://www.stevenhuey.net/test.zip
> that illustrates the problems I'm having. It can be compiled and run by
> either typing "ant clean static" or "ant clean dynamic".
This appears to be precompiled everything. There is no source or
ant 'build.xml' file. There is not much I can do with this...
> If you have a chance to test this on your machine, and to look at the
> Test.java source and let me know if I've missed anything I'd appreciate it.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Batik & Swing Questions
Posted by Steven Huey <st...@stevenhuey.net>.
Thomas,
I've placed a test program online at http://www.stevenhuey.net/test.zip
that illustrates the problems I'm having. It can be compiled and run by
either typing "ant clean static" or "ant clean dynamic". The first
command will set the document state to ALWAYS_STATIC, the second will
set it to ALWAYS_DYNAMIC. When static the SVG file appears fine, when
dynamic it doesn't at all. I've tested this on OS X and Windows 2000
and the behavior is the same. The JARs included are built from CVS over
the weekend.
If you have a chance to test this on your machine, and to look at the
Test.java source and let me know if I've missed anything I'd appreciate
it.
Thanks,
Steve
On Feb 18, 2005, at 2:25 PM, Thomas DeWeese wrote:
> Steven Huey wrote:
>> I'm starting to dig into the source code to try and figure out a few
>> things, but figured I ask here to try and save myself some time.
>> If I have a JSVGCanvas within a JSVGScroll pane does the document
>> state have to be set to ALWAYS_STATIC? If I do the following:
>
> No, not in my testing.
>
>> JPanel panel = new JPanel(new BorderLayout());
>> JSVGCanvas canvas = new JSVGCanvas();
>> JSVGScrollPane scrollPane = new JSVGScrollPane(canvas);
>> canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
>> canvas.setURI(someURI);
>> panel.add(scrollPane, BorderLayout.CENTER);
>> Nothing is drawn in the JFrame that the panel is added to, if I
>> comment out the fourth line it is drawn and scrolls just fine. Is
>> there a way to get ALWAYS_DYNAMIC documents to scroll within a
>> JSVGScrollPane?
>
> I suspect that the problem is that when you set the document
> the size of the JSVGCanvas is zero (it isn't parented). You should
> (must) have the Canvas connected (and packed?) before you set the
> URI. In your example I suspect that you just need to move all the
> swing building before the canvas manipulating.
>
> I'm a little surprised that it works for STATIC but the place
> where the desired size of the canvas is set is a bit different
> between the two.
>
>> Secondly, what is the relationship between the SVG viewport, SVG
>> viewBox attribute, and the size of the JSVGCanvas?
>
> Sure ask the simple questions ;)
>
> The requested size of the JSVGCanvas is controlled by the
> width/height attributes on the outermost SVG element.
>
> The viewBox is used to map the actually available screen space
> (the component size) to the provided userspace (or the other way around
> if you prefer). When either or both of these aren't specified there
> are a bunch of "fallbacks".
>
>> How are things different (if at all) when the JSVGCanvas is placed
>> inside a JSVGScrollPane?
>
> Things are a little bit different in this case. I believe(?) that
> the canvas/scrollpane set the desired size to the width/height
> attributes. However when the scrollPane (and hence the canvas) is
> resized the userspace->devicespace is not recomputed (as it is
> by default when the canvas is not in a scrollpane). This is why
> your canvas stays 1 pixel large when it is finally reparented into
> the swing tree and get's a real size (I still don't know why it
> works for static).
>
> In the JSVGScrollPane the viewbox is also used to determine the
> extent of scrolling allowed.
>
>> What I'd like to be able to do is load a SVG document into a
>> JSVGCanvas within a JSVGScrollPane with the SVG document set to
>> display at a
>> preset size, rather than automatically resizing to fit the size of
>> the JSVGCanvas.
>
> This should be easily accomplished by overriding the JSVGComponent
> method 'setMySize' to do nothing (it's a little unclear to me exactly
> how the ScrollPane get's it's size, I think it just goes with the
> flow with it's child/parent (i.e. default swing behaviour for a
> container).
>
>> I need to set the document state to ALWAYS_DYNAMIC so that I can
>> dynamically modify the "display" attribute of several elements at
>> runtime.
>
> I've done a fair amount of testing of this so I'm fairly certain
> this works.
>
> Hope that makes things clearer.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Batik & Swing Questions
Posted by Thomas DeWeese <Th...@Kodak.com>.
Steven Huey wrote:
> I'm starting to dig into the source code to try and figure out a few
> things, but figured I ask here to try and save myself some time.
>
> If I have a JSVGCanvas within a JSVGScroll pane does the document state
> have to be set to ALWAYS_STATIC? If I do the following:
No, not in my testing.
> JPanel panel = new JPanel(new BorderLayout());
> JSVGCanvas canvas = new JSVGCanvas();
> JSVGScrollPane scrollPane = new JSVGScrollPane(canvas);
> canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
> canvas.setURI(someURI);
> panel.add(scrollPane, BorderLayout.CENTER);
>
> Nothing is drawn in the JFrame that the panel is added to, if I comment
> out the fourth line it is drawn and scrolls just fine. Is there a way to
> get ALWAYS_DYNAMIC documents to scroll within a JSVGScrollPane?
I suspect that the problem is that when you set the document
the size of the JSVGCanvas is zero (it isn't parented). You should
(must) have the Canvas connected (and packed?) before you set the
URI. In your example I suspect that you just need to move all the
swing building before the canvas manipulating.
I'm a little surprised that it works for STATIC but the place
where the desired size of the canvas is set is a bit different
between the two.
> Secondly, what is the relationship between the SVG viewport, SVG viewBox
> attribute, and the size of the JSVGCanvas?
Sure ask the simple questions ;)
The requested size of the JSVGCanvas is controlled by the
width/height attributes on the outermost SVG element.
The viewBox is used to map the actually available screen space
(the component size) to the provided userspace (or the other way around
if you prefer). When either or both of these aren't specified there
are a bunch of "fallbacks".
> How are things different (if at all) when the JSVGCanvas is placed
> inside a JSVGScrollPane?
Things are a little bit different in this case. I believe(?) that
the canvas/scrollpane set the desired size to the width/height
attributes. However when the scrollPane (and hence the canvas) is
resized the userspace->devicespace is not recomputed (as it is
by default when the canvas is not in a scrollpane). This is why
your canvas stays 1 pixel large when it is finally reparented into
the swing tree and get's a real size (I still don't know why it
works for static).
In the JSVGScrollPane the viewbox is also used to determine the
extent of scrolling allowed.
> What I'd like to be able to do is load a SVG document into a JSVGCanvas
> within a JSVGScrollPane with the SVG document set to display at a
> preset size, rather than automatically resizing to fit the size of
> the JSVGCanvas.
This should be easily accomplished by overriding the JSVGComponent
method 'setMySize' to do nothing (it's a little unclear to me exactly
how the ScrollPane get's it's size, I think it just goes with the
flow with it's child/parent (i.e. default swing behaviour for a
container).
> I need to set the document state to ALWAYS_DYNAMIC so that I can
> dynamically modify the "display" attribute of several elements at runtime.
I've done a fair amount of testing of this so I'm fairly certain
this works.
Hope that makes things clearer.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org