You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openmeetings.apache.org by Bogdanov Andrey <ba...@mail.ru> on 2013/07/02 09:58:44 UTC

Re[2]: Google Closure Whiteboard

Here is some example;

collection.onChange = function(element){
   strElemJson = 
this.getJson(element)
; // get json string for changed element
   strAllJson = this.jsonCode(); // gets json string for all elements
}

I think it's better to exchange json string for single elements (because json for all elements could be big enough).
Json for a single element contains "id" attribute so it's easy to restore complete json using sequences of single-element-changes.
If you use this approach, then you don't need strAllJson and to apply changes at others whiteboard should use collection.acceptJsonStr(strElemJson); 

If you use complete json string, then code will be simplier - other whiteboard should call collection.parseJson(strAllJson) , but this requires more exchange traffic.

Regards,
Andrey Bogdanov


Вторник,  2 июля 2013, 12:57 +05:30 от Andun Sameera <an...@gmail.com>:
>Hi Andrey,
>
>Great! If you can give me a example for,
>
>collection.onChange(element)
>
>it will be highly appreciated.
>
>@Maxim,
>
>After some thinking I cam across of this idea. Please correct me If I am
>wrong.
>
>   - All the whiteboard elements can be represented as JSON strings (Have
>   to find a way to add PDF,DOCs, Pictures to whiteboard in this way)
>   - At the Wicket Java code we save these elements as Java Objecst which
>   contains the JSON strings.
>   - To synchronize white board we can send these object to all the viewers.
>   - To save/load we can use this already implemented JSON based
>   serialization and de-serialization.
>
>But have to find ways to get all these data from closure implementation to
>wicket!
>
>Thanks!
>On Tue, Jul 2, 2013 at 11:28 AM, Bogdanov Andrey < bay73@mail.ru > wrote:
>
>> Hi Andun,
>>
>> Whiteboard consists of two main objects: ui-component
>> "bay.whiteboard.Whiteboard", which contains functionality for user
>> interaction and collections of objects "bay.whiteboard.Collection" which
>> contains list of objects and some stuff to manipulate them.
>> After createing WB with
>>    whiteboard = bay.whiteboard.Create();
>> you could access to collection as
>>   collection = whiteboard.collections.main; or
>>   collection = whiteboard.getMainCollection(); - i've just added this
>> method
>>
>> After that you could define
>>    collection.onChange(element) - method wich will be invoked every time
>> when some drawing elements add or change.
>> Also you could use methods:
>>     collection.getJson(element); -  to obtain json code for an element
>>      collection.jsonCode();   -  to obtain json code for whole collection
>>      collection.acceptJsonStr(str); -  to add or change one element
>> described as json
>>      collection.parseJson(str); -  to rebuild all from the given json
>> string
>>
>>
>> As an example you could explore linkWebSocket method in ui.js, which
>> allows synchronize wb-content through webSocket
>>
>> Regards,
>> Andrey Bogdanov
>>
>> Вторник, 2 июля 2013, 1:25 +05:30 от Andun Sameera < andunslg@gmail.com >:
>>
>>   Hi Andrey,
>>
>> I am moving in to this new thread to discuss about the clarifications,
>> improvements and integration of your Whiteboard to wicket. I have looked at
>> your code which can be found  https://github.com/bay73/whiteboard . I have
>> following questions,
>>
>>    - In Wicket, I want map Whiteboard Elements(Rectangle, Circle, Text,
>>    etc.) to Java objects.
>>    - Thus we can send those object to all the Whiteboard viewers.
>>    - Using these objects there Whiteboards will be updated.
>>    - To do that, can I get some data from your code? which can be later
>>    used to create elements. I saw there is a serialization methods and
>>    deserilization method in base.js. If we can extend that mechanism to give
>>    some data when element is drawn or edited as an event, I can use them to
>>    create Java objects.
>>    - Also there should be a mechanism to draw elements on your Whiteboard
>>    by passing those data.
>>
>> Can we do these things?
>>
>> Thanks!
>> --
>> Regards
>> Andun S.L. Gunawardana
>> Undergraduate
>> Department of Computer Science And Engineering
>> University of Moratuwa
>> Sri Lanka
>>
>> Blog -  http://www.insightforfuture.blogspot.com/
>> LinkedIn -  http://www.linkedin.com/pub/andun-s-l-gunawardana/34/646/703
>> Twitter - http://twitter.com/AndunSLG
>>
>>
>>
>>
>>
>>
>>
>> --
>> Андрей Богданов
>>
>
>
>
>-- 
>Regards
>Andun S.L. Gunawardana
>Undergraduate
>Department of Computer Science And Engineering
>University of Moratuwa
>Sri Lanka
>
>Blog -  http://www.insightforfuture.blogspot.com/
>LinkedIn -  http://www.linkedin.com/pub/andun-s-l-gunawardana/34/646/703
>Twitter - http://twitter.com/AndunSLG
>


-- 
Андрей Богданов