Hi,
> On 07/01/2011 12:14 PM, Eduard Gamonal wrote:
>> I guess I have to serialize the svg element of the svg widget, right?
>> ( svgWidget.getSvg() ). I tried this in a sandbox and it was ok.
>> However, I can't figure out how to use it once it's been serialised. I
>> was expecting a method to create an object out of the string.
>
> Unfortunately, no such method exists. By serializing to a string, you
> lose the qooxdoo data (class info, etc). You can still create a DOM
> element out of the string and add the resulting element to the document
> (see below), but you lose the qooxdoo interface by doing so.
well, it's not a big deal. I still get a string representation of my
doodles so I can append them to a DOM element.
> I think you should only send over the part of the image that changed,
> not the entire SVG document. This will be easy if you use groups to
> separate the drawing - you just have to serialize the group and send the
> string to the other clients.
I thought I may need both methods (send only changes and send all the
doodles) because there are two scenarios:
1- attendee joins the presentation in time. the drawing is built
incrementally, by receiving doodles from other attendees.
2- attendee joins late the presentation. he needs the canvas to be
updated, so the full canvas should be requested.
anyway, the same/similar method will apply: serialize something and
sent it over the network.
>> The thing is that I have a vector of objects (Slide) and doodle are
>> slide-dependant, so the n-th set of doodles are related to the n-th
>> slide. When user changes slides, the svg object should update the
>> doodles. I can do that with the slide image,
>
> Instead of swapping slide contents, you could also have a group for each
> slide, and selectively display/hide the groups. The group element has a
> display property to allow for that.
If I build numSlides groups of {slideImage, attendeesDoodles,
myDoodles} i'll have to refactor too much code for my taste and too
many requests may be sent at once to the server, to fetch the slides.
how about:
- a group for a svg.struct.Image slide. I change the source of the
image and it works.
- a group with numSlides groups of {attendeesDoodles, myDoodles}
Thus I can keep my object orientation, I think. I can have getters and
setters for Slide.doodle property. Using the display property for
groups I can follow your advise. The only part I dislike is that there
won't be any semantic relation between the slide and the doodles.
it'll be just an identifier.
> After some trial and error I came up with the following, which seems to
> work, except when you use it on the SVG root element:
>
> //on the sending client:
> var str = qx.xml.Element.serialize(someElement.getDomElement());
>
> //on the receiving client:
> var node = qx.xml.Document.fromString(str);
> qx.dom.Element.insertEnd(node.documentElement, targetGroup.getDomElement());
>
> This will take the string and add it as a child node under the
> targetGroup (which is an svg.struct.Group instance).
>
that makes sense and looks quite close to what I was trying, but I
didn't succeed when explored the qx.dom.Element API :P
> I hope this info helps. :)
you've helped me more than I could have ever asked!
Regards,
Edu
>
> Regards,
> Marc
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2d-c2
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel