Hello all,

I have a dynamically set JSVGCanvas and I am attempting to append a document to it. If I stream out the current SVGDocument before hand and after, I can see that the node elements were added correctly, but they don't update visually on the canvas. I have tried it with and without the UpdateManager to no avail. Here's a code snippet..

UpdateManager um = canvas.getUpdateManager();
if(um == null)
System.out.println("Manager returned null. Now i know why it doesn't work...");
else
  um.getUpdateRunnableQueue().invokeLater(new Runnable(){
                public void run() {
// ...loop code to retrieve a node
// now append it docRootNode.appendChild(doc.importNode(incomingNodes.item(j).cloneNode(true), true));
                     }
                   System.out.println("Append Completed.....?");
                   System.out.println(convertDocToString(doc));
                }
            });

Here's a svg snippet of the original, what I am adding from, and the after (i took out most of it since one element from each should suffice):

ORIGINAL SVG Document

<svg contentScriptType="text/ecmascript" width="254"
xmlns:xlink="http://www.w3.org/1999/xlink"; zoomAndPan="magnify"
contentStyleType="text/css" viewBox="0 0 25400 19100" height="191"
preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg";
version="1.0">
<g style="stroke:none;fill:rgb(255,255,255)">
   <polygon points="0,0 25400,0 25400,19050 0,19050 0,0"/>
</g>
<g style="font-family:Times New Roman;font-size:494;font-weight:400">
   <g style="stroke:none;fill:rgb(0,0,0)">
       <text x="19924" y="18352">
           edited for post
       </text>
   </g>
</g>
</svg>

SVG Document to Import elements from:

<svg contentScriptType="text/ecmascript"
xmlns:xlink="http://www.w3.org/1999/xlink"; zoomAndPan="magnify"
contentStyleType="text/css" preserveAspectRatio="xMidYMid meet"
xmlns="http://www.w3.org/2000/svg"; version="1.0">
<polyline stroke-linecap="round" points="13264,9409,14770,11761,15334,12560"
         fill="none" scribbleOrder="0" stroke-linejoin="round"
         opacity="0.9" stroke="#40F" user="Alice" stroke-width="400"/>

Document AFTER

<svg contentScriptType="text/ecmascript" width="254"
xmlns:xlink="http://www.w3.org/1999/xlink"; zoomAndPan="magnify"
contentStyleType="text/css" viewBox="0 0 25400 19100" height="191"
preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg";
version="1.0">
<g style="stroke:none;fill:rgb(255,255,255)">
   <polygon points="0,0 25400,0 25400,19050 0,19050 0,0"/>
</g>
<g style="font-family:Times New Roman;font-size:494;font-weight:400">
   <g style="stroke:none;fill:rgb(0,0,0)">
       <text x="19924" y="18352">
           text edited for post
       </text>
   </g>
</g>
<polyline stroke-linecap="round" points="13264,9409,14770,11761,15334,12560"
         fill="none" scribbleOrder="0" stroke-linejoin="round"
         opacity="0.9" stroke="#40F" user="Alice" stroke-width="400"/>
</svg>



On a side note, I have essentially a "paint" program with events based off mouse movements (drag etc..) originally I used the updatemanager to draw, however recently switched to not using it, since a mouse movement triggers the repaint anyway and having a thread with each dragging mouse movement seemed offensive. I know some about threading, I'm just not sure how java uses/implements them and whether the overhead of using that runnable every time is truly wrong. I have noticed that not using the updatemanager for this causes an occasionaly "white out" of the dirty area, while it waits to re-render. Any thoughts on which is better?

Thanks for your time and any help,
--Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to