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 2006/11/08 15:11:57 UTC

Setting the viewBox property on the JSVGCanvas's document?

I get an error when manipulating the view box of the document on the JSVGCanvas.  I do this to "resize" a document:

public void setSize(String width, String height) {
        svgDocument.getDocumentElement().setAttribute(
            SVGConstants.SVG_WIDTH_ATTRIBUTE, width);
        svgDocument.getDocumentElement().setAttribute(
            SVGConstants.SVG_HEIGHT_ATTRIBUTE, height);
        svgDocument.getDocumentElement().setAttribute(
            SVGConstants.SVG_VIEW_BOX_ATTRIBUTE, "0 0 " + width + " " + height);
}

To make things stranger, it only happens when I make the size smaller than it currently is.  640x480 -> 800x600 is fine.  Then, going from 800x600 -> 700x600 causes the error.

Setting the width and height causes no problems, but the line that sets the view box causes this error to pop-up in the JSVGCanvas:

java.lang.NullPointerException
 at java.awt.geom.AffineTransform.<init>(AffineTransform.java:395)
 at org.apache.batik.bridge.SVGSVGElementBridge.handleDOMAttrModifiedEvent(Unknown Source)
 at org.apache.batik.bridge.BridgeContext$DOMAttrModifiedEventListener.handleEvent(Unknown Source)
 at org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown Source)
 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.dom.AbstractElement.fireDOMAttrModifiedEvent(Unknown Source)
 at org.apache.batik.dom.AbstractAttr.setNodeValue(Unknown Source)
 at org.apache.batik.dom.AbstractAttr.setValue(Unknown Source)
 at org.apache.batik.dom.AbstractElement.setAttribute(Unknown Source)
 at mil.jfcom.cie.whiteboard.ui.managers.SVGDocumentManager.setSize(SVGDocumentManager.java:137)
 at mil.jfcom.cie.whiteboard.ui.runnables.ResizeRunnable.run(ResizeRunnable.java:75)
 at org.apache.batik.util.RunnableQueue.run(Unknown Source)
 at java.lang.Thread.run(Thread.java:595)

Michael Bishop

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


RE: Setting the viewBox property on the JSVGCanvas's document?

Posted by th...@kodak.com.
Hi Michael,

"Bishop, Michael W. CONTR J9C880" <Mi...@je.jfcom.mil> wrote on 
11/10/2006 08:54:37 AM:

> OK, thanks for looking into it.  I will start compiling the builds I'm 
using 
> with debug on.  Could you let me know when you commit a fix so I'll get 
the 
> right nightly build to test with?

   I've committed the fix. I'm not entirely sure that nightly builds are 
working at the moment (they moved stuff on the server) I'll try and 
make sure they are working again.



> Michael Bishop
> 
> ________________________________
> 
> From: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com]
> Sent: Fri 11/10/2006 6:07 AM
> To: batik-users@xmlgraphics.apache.org
> Cc: batik-users@xmlgraphics.apache.org
> Subject: Re: Setting the viewBox property on the JSVGCanvas's document?
> 
> 
> 
> Hi Michael,
> 
> "Bishop, Michael W. CONTR J9C880" <Mi...@je.jfcom.mil> wrote on
> 11/08/2006 09:11:57 AM:
> 
> > I get an error when manipulating the view box of the document on the
> > JSVGCanvas.  I do this to "resize" a document:
> 
> > To make things stranger, it only happens when I make the size smaller
> than it
> > currently is.  640x480 -> 800x600 is fine.  Then, going from 800x600 
->
> > 700x600 causes the error.
> 
>    There is a bunch of conditional code that tries to avoid a total
> rebuild
> of the GVT tree.  Probably in the above case 800x600 -> 700x600 avoided 
a
> total rebuild (vertical dimension was the same so scale didn't change) 
and
> 
> hit this bug.   I'll commit a fix shortly.
> 
> > Setting the width and height causes no problems, but the line that 
sets
> the
> > view box causes this error to pop-up in the JSVGCanvas:
> >
> > java.lang.NullPointerException
> >  at java.awt.geom.AffineTransform.<init>(AffineTransform.java:395)
> >  at org.apache.batik.bridge.SVGSVGElementBridge.
> > handleDOMAttrModifiedEvent(Unknown Source)
> 
>     It would be nice if you would compile Batik with debug turned on.
> Assuming you are using our build.xml this can be done by creating a
> file 'build.properties' in the same directory as build.xml and putting
> the line: "debug=on"  in it.  Then your stack traces will have line
> numbers.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> [attachment "winmail.dat" deleted by Thomas E. DeWeese/449433/EKC] 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org

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


RE: Setting the viewBox property on the JSVGCanvas's document?

Posted by "Bishop, Michael W. CONTR J9C880" <Mi...@je.jfcom.mil>.
OK, thanks for looking into it.  I will start compiling the builds I'm using with debug on.  Could you let me know when you commit a fix so I'll get the right nightly build to test with?
 
Michael Bishop

________________________________

From: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com]
Sent: Fri 11/10/2006 6:07 AM
To: batik-users@xmlgraphics.apache.org
Cc: batik-users@xmlgraphics.apache.org
Subject: Re: Setting the viewBox property on the JSVGCanvas's document?



Hi Michael,

"Bishop, Michael W. CONTR J9C880" <Mi...@je.jfcom.mil> wrote on
11/08/2006 09:11:57 AM:

> I get an error when manipulating the view box of the document on the
> JSVGCanvas.  I do this to "resize" a document:

> To make things stranger, it only happens when I make the size smaller
than it
> currently is.  640x480 -> 800x600 is fine.  Then, going from 800x600 ->
> 700x600 causes the error.

   There is a bunch of conditional code that tries to avoid a total
rebuild
of the GVT tree.  Probably in the above case 800x600 -> 700x600 avoided a
total rebuild (vertical dimension was the same so scale didn't change) and

hit this bug.   I'll commit a fix shortly.

> Setting the width and height causes no problems, but the line that sets
the
> view box causes this error to pop-up in the JSVGCanvas:
>
> java.lang.NullPointerException
>  at java.awt.geom.AffineTransform.<init>(AffineTransform.java:395)
>  at org.apache.batik.bridge.SVGSVGElementBridge.
> handleDOMAttrModifiedEvent(Unknown Source)

    It would be nice if you would compile Batik with debug turned on.
Assuming you are using our build.xml this can be done by creating a
file 'build.properties' in the same directory as build.xml and putting
the line: "debug=on"  in it.  Then your stack traces will have line
numbers.


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



Re: Setting the viewBox property on the JSVGCanvas's document?

Posted by th...@kodak.com.
Hi Michael,

"Bishop, Michael W. CONTR J9C880" <Mi...@je.jfcom.mil> wrote on 
11/08/2006 09:11:57 AM:

> I get an error when manipulating the view box of the document on the 
> JSVGCanvas.  I do this to "resize" a document:

> To make things stranger, it only happens when I make the size smaller 
than it 
> currently is.  640x480 -> 800x600 is fine.  Then, going from 800x600 -> 
> 700x600 causes the error.

   There is a bunch of conditional code that tries to avoid a total 
rebuild
of the GVT tree.  Probably in the above case 800x600 -> 700x600 avoided a 
total rebuild (vertical dimension was the same so scale didn't change) and 

hit this bug.   I'll commit a fix shortly.

> Setting the width and height causes no problems, but the line that sets 
the 
> view box causes this error to pop-up in the JSVGCanvas:
> 
> java.lang.NullPointerException
>  at java.awt.geom.AffineTransform.<init>(AffineTransform.java:395)
>  at org.apache.batik.bridge.SVGSVGElementBridge.
> handleDOMAttrModifiedEvent(Unknown Source)

    It would be nice if you would compile Batik with debug turned on.
Assuming you are using our build.xml this can be done by creating a
file 'build.properties' in the same directory as build.xml and putting
the line: "debug=on"  in it.  Then your stack traces will have line 
numbers.


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