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 "Bishop, Michael W. CONTR J9C880" <Mi...@je.jfcom.mil> on 2005/10/21 15:18:18 UTC

Resize bug?

I know, I'm running the whole list today!  I have another issue.  I'm
trying to resize the document by setting width and height attributes:

 

public void setSize(String width, String height) {

 
svgDocument.getDocumentElement().setAttribute(SVGConstants.SVG_WIDTH_ATT
RIBUTE, width);

 
svgDocument.getDocumentElement().setAttribute(SVGConstants.SVG_HEIGHT_AT
TRIBUTE, height);

}

 

I execute the above code in the run() method of a Runnable class which I
then execute in the UpdateManager.  More often than not, it causes the
entire application to hang.  No button response.  No CPU spike.  No
error message.  Just locks up.  With System.out, I've determined that
the code never exits from the above setSize() method.  Does anyone have
any tips on why this would happen?  Is there some kind of deadlock with
running a Runnable in the UpdateManager?  All my other operations; add
element, remove element, set the background element, etc. run without
issue.

 

Michael Bishop

 

 


Re: Resize bug?

Posted by Tonny Kohar <to...@kiyut.com>.
Hi,

On Fri, 2005-10-21 at 09:18 -0400, Bishop, Michael W. CONTR J9C880
wrote:

> public void setSize(String width, String height) {
> 
> svgDocument.getDocumentElement().setAttribute(SVGConstants.SVG_WIDTH_ATTRIBUTE, width);
> svgDocument.getDocumentElement().setAttribute(SVGConstants.SVG_HEIGHT_ATTRIBUTE, height);
> 
> }

I do not know why it is hang, but try to use
setAttributeNS(null,SVG_WIDTH_ATTRIBUTE,width)

Batik is namespace aware.

Regards
Tonny Kohar
-- 
Sketsa 
SVG Graphics Editor
http://www.kiyut.com


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


Re: Resize bug?

Posted by th...@kodak.com.
"Bishop, Michael W. CONTR J9C880" <Mi...@je.jfcom.mil> wrote on 
10/21/2005 09:18:18 AM:

> I know, I?m running the whole list today!  I have another issue.  I?m 
trying 
> to resize the document by setting width and height attributes:
> 
> public void setSize(String width, String height) {
>     svgDocument.getDocumentElement().setAttribute(SVGConstants.
> SVG_WIDTH_ATTRIBUTE, width);
>     svgDocument.getDocumentElement().setAttribute(SVGConstants.
> SVG_HEIGHT_ATTRIBUTE, height);
> }
> 
> I execute the above code in the run() method of a Runnable class which I 
then 
> execute in the UpdateManager.  More often than not, it causes the entire 

> application to hang. 

  I would guess that you are calling invokeAndWait on the RunnableQueue?
And you are doing this from the Swing thread?  If so this is a known 
issue,
basically in some cases Batik needs to get info from Swing in which case 
it
needs to call into the Swing Thread if you are sitting in it then it 
causes
a deadlock.  In this case you will need to either switch to invokeLater, 
or
move your call to invokeAndWait out of the Swing thread (into a third 
party
thread you control).

> No button response.  No CPU spike.  No error message. 
> Just locks up.  With System.out, I?ve determined that the code never 
exits 
> from the above setSize() method.  Does anyone have any tips on why this 
would 
> happen?  Is there some kind of deadlock with running a Runnable in the 
> UpdateManager?  All my other operations; add element, remove element, 
set the 
> background element, etc. run without issue.

  You can get a thread dump in windows by running the 
application from the command line and pressing ctrl-break in
the DOS Window, from Unix you can use 'kill -QUIT <java processes id>'.
This should make it clear what the problem is.


> 

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