Hi Andun, This is my bug with text elements (in function which calculates text width). It works in Chrome, but fails in Firefox. Now I've found and corrected them. But right now I can't build compiled whiteboard.js and will do this later in afternoon.
As soon as you map all elements to JavaObjects I send you the list of currently used elements and their attributes. See attached file. Regards, Andrey Пятница, 5 июля 2013, 3:08 +05:30 от Andun Sameera <andun...@gmail.com>: >Hi Andrey, > >Currently I am in the process of Mapping Whiteboard Elements to Java Objects. >There I noticed that Text fields are bit buggy. I have attached a screen shot. >When we draw a text box, we are shown a label. But I can find a place to edit >it. Also I tried with info tool. When I enter a text using that, it overlaps >as shown in screen shot. Is there a fault in my code ? You can look at it in >the git repo. > >Thanks! > >On Fri, Jul 5, 2013 at 2:10 AM, Andun Sameera < andun...@gmail.com > wrote: >>Hi All, >> >>I have create the https://github.com/andunslg/Whiteboard-Wicket repo. I have >>committed my POC code there and doing the development on that. >> >>Thanks! >> >> >>On Thu, Jul 4, 2013 at 12:10 PM, Maxim Solodovnik < solomax...@gmail.com > >>wrote: >>>sure, please create git repo! >>> >>>instead of using Wicket.ajax.get you can use normal *AjaxBehavior you can >>>also create functions of it using getCallbackFunction. >>>Old OM code had examples of that (was replaced with wicketjquieryui-calendar) >>> >>> >>>On Thu, Jul 4, 2013 at 3:45 AM, Andun Sameera < andun...@gmail.com > wrote: >>>>Hi All, >>>> >>>>I have successfully did a first step integration of Andrey's whiteboard >>>>with Wicket. Now I can send the JSON string successfully to the JAVA code. >>>>Now I know the way and will work on formalizing the thing! >>>> >>>> >>>>@Andrey >>>> >>>>Can you give me a example to add a onChnage method to main collection. I >>>>tried to do it. But is fails. >>>> >>>>@ Maxim >>>> >>>>Can I create a Git Repo for the task? Is it going to be a wicket-jquery-UI >>>>plug-in ? or else ? >>>> >>>>Thanks! >>>> >>>> >>>>On Wed, Jul 3, 2013 at 11:18 PM, Andun Sameera < andun...@gmail.com > >>>>wrote: >>>>>Hi Andrey, >>>>> >>>>>OK will do it like that! >>>>> >>>>>Thanks! >>>>> >>>>> >>>>>On Wed, Jul 3, 2013 at 11:15 PM, Bogdanov Andrey < ba...@mail.ru > wrote: >>>>>> Hi Andun, >>>>>> >>>>>>Unfortunately I can't help you with wicket-ajax (I'm nit familiar with >>>>>>wicket). >>>>>>Only one remark about onChange - defining onChange for prototype is not a >>>>>>good idea, because whiteboard use two auxilary collections which need not >>>>>>to be synchronized. onChange function should be defined only for one main >>>>>>collection. >>>>>> >>>>>>Regards, >>>>>>Andrey >>>>>> >>>>>> >>>>>>Среда, 3 июля 2013, 22:50 +05:30 от Andun Sameera < andun...@gmail.com >: >>>>>>>Hi, >>>>>>> >>>>>>>Considering the example which Andrey gave me early, I am planning to do >>>>>>>this, >>>>>>> >>>>>>> - Using the method given below, we can get a JSON string for any >>>>>>>update >>>>>>> happen in Closure WhiteBoard >>>>>>> >>>>>>>// to be defined on using of collection >>>>>>>bay.whiteboard.Collection.prototype.onChange = function(element){ >>>>>>> alert(this.getJson(element)); >>>>>>>} >>>>>>> >>>>>>> - I will do a Wicket.Ajax call in this JavaScript method to send this >>>>>>> JSON string to the Server Side >>>>>>> - There I process the string and map it to Java Objects >>>>>>> - Then Synchronization happens >>>>>>> >>>>>>>As the initial step to do that, I am trying to implement a simple, >>>>>>>application which can sent JavaScript Ajax calls to Wicket server. I use >>>>>>>this article >>>>>>> https://cwiki.apache.org/confluence/display/WICKET/Calling+Wicket+from+Javascript >>>>>>> . >>>>>>>I have created the application given below. >>>>>>> >>>>>>>public class HomePage extends WebPage { >>>>>>> private static final long serialVersionUID = 1L; >>>>>>> >>>>>>> public HomePage(final PageParameters parameters) { >>>>>>> super(parameters); >>>>>>> >>>>>>> >>>>>>> final AbstractDefaultAjaxBehavior behave = new >>>>>>>AbstractDefaultAjaxBehavior() { >>>>>>> protected void respond(final AjaxRequestTarget target) { >>>>>>> target.add(new Label("foo", "Yeah I was just called from >>>>>>>Javascript!")); >>>>>>> } >>>>>>> >>>>>>> public void renderHead(Component component,IHeaderResponse >>>>>>>response){ >>>>>>> >>>>>>> String componentMarkupId = component.getMarkupId(); >>>>>>> String callbackUrl = getCallbackUrl().toString(); >>>>>>> >>>>>>> response.render( >>>>>>>JavaScriptHeaderItem.forScript("var >>>>>>>componentMarkupId='"+componentMarkupId+"'; var >>>>>>>callbackUrl='"+callbackUrl+"';","values")); >>>>>>> } >>>>>>> }; >>>>>>> >>>>>>> add(behave); >>>>>>> >>>>>>> } >>>>>>> >>>>>>>} >>>>>>> >>>>>>>and my HomePage.html, >>>>>>> >>>>>>><!DOCTYPE HTML> >>>>>>><html> >>>>>>><body> >>>>>>><script src=" >>>>>>>http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js >>>>>>>"></script> >>>>>>><script type="text/javascript"> >>>>>>> $(function() { >>>>>>> var wcall = Wicket.Ajax.get({ u: '${callbackUrl}' + '' }); >>>>>>> alert(wcall); >>>>>>> }); >>>>>>></script> >>>>>>></body> >>>>>>></html> >>>>>>> >>>>>>>Still I cant get this to a working position. When I start this >>>>>>>application, >>>>>>>wicket-ajax.js file is not loading. Thus console gives following error, >>>>>>> >>>>>>>ReferenceError: Wicket is not defined >>>>>>>[Break On This Error] >>>>>>> >>>>>>>var wcall = Wicket.Ajax.get({ u: '${callbackUrl}' + '' }); >>>>>>> >>>>>>>Still cant find why wicket-ajax is not loaded to my application. Will let >>>>>>>you know further updates! >>>>>>> >>>>>>>Thanks! >>>>>>> >>>>>>> >>>>>>>On Tue, Jul 2, 2013 at 2:08 PM, Andun Sameera < andun...@gmail.com > >>>>>>>wrote: >>>>>>> >>>>>>>> OK Maxim. Will do it like that! >>>>>>>> >>>>>>>> >>>>>>>> On Tue, Jul 2, 2013 at 2:05 PM, Maxim Solodovnik < >>>>>>>> solomax...@gmail.com >wrote: >>>>>>>> >>>>>>>>> I would totally disagree with >>>>>>>>> "At the Wicket Java code we save these elements as Java Objecst which >>>>>>>>> contains the JSON strings." >>>>>>>>> >>>>>>>>> Java objects should contain normal fields like "Point center; int >>>>>>>>> radius;" and be (de)serialized (from)into JSON if necessary. >>>>>>>>> >>>>>>>>> >>>>>>>>> On Tue, Jul 2, 2013 at 2:27 PM, Andun Sameera < andun...@gmail.com >>>>>>>>> >wrote: >>>>>>>>> >>>>>>>>>> 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 < ba...@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 < >>>>>>>>>>> andun...@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 >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> WBR >>>>>>>>> Maxim aka solomax >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> 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 >>>>>>> >>>>>> >>>>>> >>>>>>-- >>>>>>Андрей Богданов >>>>> >>>>> >>>>> >>>>>-- >>>>>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 >>>> >>>> >>>> >>>> >>> >>> >>>-- >>>WBR >>>Maxim aka solomax >> >> >>-- >>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 > > > > -- Андрей Богданов
All elements of whiteboard are inherited from bay.whiteboard.Element. The basic attributes are: id (integer) index of the element in the collection list label (string) text label for the element color (string) color of the element trace (boolean) flag if the element should left trace when moved hidden (boolean) flag if the element hidden (not visible) type (string) type (class) of the element Each specific element has also own properties depending on it type. Types of elements are listed below: PointFree - point put on the board independetly (is defined by coordinates) x (double) x coordinate of the point y (double) y coordinate of the point PencilCurve - curve line p0 (integer) id of the starting point for curve x1 (double) x relative coordinate of the first point of curve y1 (double) y relative coordinate of the first point of curve x2 (double) x relative coordinate of the second point of curve y2 (double) y relative coordinate of the second point of curve ... x<i> (double) x relative coordinate of the i-th point of curve y<i> (double) y relative coordinate of the i-th point of curve PencilFreeLine - stright segment connecting two points p1 (integer) id of first point p2 (integer) id of second point PencilRect - rectangular frame (is defined by two diagonal angles) p1 (integer) id of point which is one angle p2 (integer) id of point which is second angle PencilPointAtRect - point at the rectangular frame obj (integer) id of rectangle (PencilRect) s (string) side (lefty, right, top, bottom) t (double) position in the side (0 - one end of the side, 1 - other end of the side) PencilCircle - circle with given center and going through the point p1 (integer) id of point which is center of the circle p2 (integer) id of point on the circle Text - text inside a rectangular frame r (integer) id of rectange (PencilRect) PointAtLine - point on the given stright line obj (integer) id of line t (double) position at the line PointAtCircle - point on the givemn circle obj (integer) id of circle x (double) x-coordinate of direction y (double) y-coordinate of direction Point_2l - intersection point of two lines obj1 (integer) id of the first line obj2 (integer) id of the second line Point_2c - intersection point of two circles obj1 (integer) id of the first circle obj2 (integer) id of the second circle num (integer) num,ber to choose one of two intersection points (0,1) Point_lc - intersection point of line and circles obj1 (integer) id of the line obj2 (integer) id of the circle num (integer) num,ber to choose one of two intersection points (0,1) LineGeneral - line given by the equation a*x+b*y+c=0 a (double) value of a b (double) value of b c (double) value of c Line_2p - line going through two points p1 (integer) id of first point p2 (integer) id of second point Segment - line segment connecting two points p1 (integer) id of first point p2 (integer) id of second point CircleGeneral - circle given by the equation (x-a)^2+(y-b)^2=c^2 a (double) value of a b (double) value of b c (double) value of c Circle_3p - circle given by center and two points which define radius length p1 (integer) id of center point p2 (integer) id of first point of radius p3 (integer) id of second point of radius