Hi, Thomas
Ok, I have found certain things in your reply that could initiate
interesting discussion, but I will focus on my "burning" issue at this
moment.
Let's say that I create SVG elements using the SVGDocument as a factory.
<code>
Element myRect = document.createElementNS(svgNS, "rect");
</code>
After that I attach event listener to the rect:
<code>
((EventTarget)myRect).addEventListener("click", new CEventListener(),
false);
</code>
I use batik.dom.util.DOMUtilities methods to serialize myRect. But this
ignores all information about the event handlers attached to myRect.
My event handling is written in Java and cannot be transferred to
JavaScript.
How should I deal with this?
Thanks,
Nebojsa
thomas.deweese wrote:
>
> Hi Nebojša,
>
> Nebojša Miletić <[EMAIL PROTECTED]> wrote on 10/27/2006 01:39:09 PM:
>
>> I am working on complex relationship management desktop application. The
>> user can load or create some graph on the JSVGCanvas. He is able to edit
>> that graph (move nodes, edit relations etc).
>>
>> The user should be able to save the state of the edited graph and load
> that
>> state whenever he wants.
>
> Sure this is a pretty standard thing to do with SVG as well.
>
>> In some other (non-SVG) parts of my application, I use this kind of
>> serialization (and it works):
>>
>> <code>
>> import java.beans.XMLEncoder;
>> </code>
>>
>> The object I try to serialize is:
>> <code>
>> SVGOMRectElement serializedObject = new SVGOMRectElement("customNS",
>> jsvgCanvas.getDocument());
>> </code>
>
> This is not the correct way to create an SVG Rect element.
> You should use the document as a factory to create your elements:
>
> Element rect = jsvgCanvas.getDocument().createElement
> ("http://www.w3.org/2000/svg", "rect");
>
>> This is the reported exception:
>> java.lang.IllegalAccessException: Class sun.reflect.misc.Trampoline can
> not
>> access a member of class org.apache.batik.dom.svg.SVGOMRectElement with
>> modifiers "protected"
>
>> Is there some other way to serialize this (and deserialize it
> afterwards)?
>> Or I am doing something wrong?
>
> So I don't know much about XMLEncoder but I presume it
> uses reflection to try and turn the given Java object into XML.
> However, this would be a really round about way to serialize
> a DOM object into XML (A DOM object is essentially an in-memory
> version of an XML element). You can use the methods in
> batik.dom.util.DOMUtilities to serialize individual elements
> or whole documents.
>
>> Or I have to dive into the Batik source code and deal with the
> unaccessible
>> members?
>> Or any other suggestion?
>
> For this sort of stuff I would normally 'annotate'
> a standard SVG file with extra elements/attributes in
> a custom namespace. Often with this approach you can
> have a static SVG picture that any SVG client can
> display, but still enable editing within your application.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Serialization-with-FileStreams-tf2522028.html#a7051942
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]