Re: help with drag and drop (wicket-dnd)
Hi, it is not clear to me what you want to achieve. Please take at the list or table example from the wicket-dnd example: Usually you would create the table with a wicket repeater based on some model values. You can use/generate markup whatever you want. All what is needed that your Wicket components which represent the markup tags to drag or to drop on output their markup ids. Sven Am 27.02.2012 20:13, schrieb Dan12321: So I cannot modify html? Make html from this (it is without attributes): < table>< tr> < td>< span>AAA< /span>< /td> < td>< /td> < /tr>< /table> to this (span from first "td" was moved to second "td"): < table>< tr> < td>< /td> < td>< span>AAA< /span>< /td> < /tr>< /table> But, when i want to move content of first td to second td, I have to do something like this: < table>< tr> < td>< span>AAA< /span>< /td> < td>< span>< /span>< /td> < /tr>< /table> And in onDrop method change model of first span and second span element? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/help-with-drag-and-drop-wicket-dnd-tp4422338p4425713.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: help with drag and drop (wicket-dnd)
So I cannot modify html? Make html from this (it is without attributes): < table>< tr> < td>< span>AAA< /span>< /td> < td>< /td> < /tr>< /table> to this (span from first "td" was moved to second "td"): < table>< tr> < td>< /td> < td>< span>AAA< /span>< /td> < /tr>< /table> But, when i want to move content of first td to second td, I have to do something like this: < table>< tr> < td>< span>AAA< /span>< /td> < td>< span>< /span>< /td> < /tr>< /table> And in onDrop method change model of first span and second span element? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/help-with-drag-and-drop-wicket-dnd-tp4422338p4425713.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: help with drag and drop (wicket-dnd)
wicket-dnd doesn't change the HTML markup as popular Javascript libraries do. Instead the markup must be generated on the server side, as it's done with Wicket most of the time. You have to update your component tree in onDrop(), e.g. change models, persist something to the database. Then update the components view AjaxRequestTarget#add(). Hope this helps Sven Am 27.02.2012 19:21, schrieb Dan12321: Thank you. I look at example of ExampleLabel. But it do not help so much Now, I can drag element, I see that it was dragged and I can drop it on element, that is allowed by "}.dropCenter("span"));" Methods "onDrop" (in DropTarget) and "onAfterDrop" (in DragSource) are called. I use there code, that is in ExampleLabel. But the dragged element is not moved and it stay on original place. What I have to do for moving dragged element? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/help-with-drag-and-drop-wicket-dnd-tp4422338p4425523.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: help with drag and drop (wicket-dnd)
Thank you. I look at example of ExampleLabel. But it do not help so much Now, I can drag element, I see that it was dragged and I can drop it on element, that is allowed by "}.dropCenter("span"));" Methods "onDrop" (in DropTarget) and "onAfterDrop" (in DragSource) are called. I use there code, that is in ExampleLabel. But the dragged element is not moved and it stay on original place. What I have to do for moving dragged element? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/help-with-drag-and-drop-wicket-dnd-tp4422338p4425523.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: help with drag and drop (wicket-dnd)
Usually you do not have to override that method, please take a look at the examples. Sven Dan12321 schrieb: >Thanks. > >So what should be in method DragSource#onBeforeDrop()? I should set there >transfer data: transfer.setData(drag); ? > >I have Wicket 1.5.4 and wicket-dnd 0.5.0. > >-- >View this message in context: >http://apache-wicket.1842946.n4.nabble.com/help-with-drag-and-drop-wicket-dnd-tp4422338p4423719.html >Sent from the Users forum mailing list archive at Nabble.com. > >- >To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >For additional commands, e-mail: users-h...@wicket.apache.org >
Re: help with drag and drop (wicket-dnd)
Thanks. So what should be in method DragSource#onBeforeDrop()? I should set there transfer data: transfer.setData(drag); ? I have Wicket 1.5.4 and wicket-dnd 0.5.0. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/help-with-drag-and-drop-wicket-dnd-tp4422338p4423719.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: help with drag and drop (wicket-dnd)
Hi, your s have to output their markup id too. transfer.getData() allways NULL. What should be in transfer? The transfer objects hold whatever the dragsource puts into it. If you haven't overriden DragSource#onBeforeDrop() this is just the model object of the dragged element. BTW which version are you using? Regards Sven On 02/26/2012 08:22 PM, Dan12321 wrote: Thanks for answer. Yes, in the first "td" is "span" but in this forum it was formatted and span was not visible. The first td should be:< span wicket:id="aaa" class="aaa">www -- But I make little modification and html is: < span wicket:id="aaa" class="aaa">aaa < span wicket:id="bbb" class="bbb">bbb < span wicket:id="ccc" class="ccc">ccc And in java class was added: Label bbb = new Label("bbb", "bbb"); Label ccc = new Label("ccc", "ccc"); bbb.setOutputMarkupId(true); ccc.setOutputMarkupId(true); container.add(bbb); container.add(ccc); But in the methods is transfer.getData() allways NULL. What should be in transfer? The target element? Is there any way how to know what element was targeted (drop)? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/help-with-drag-and-drop-wicket-dnd-tp4422338p4422742.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: help with drag and drop (wicket-dnd)
yes it is valid and the html is: < span wicket:id="aaa" class="aaa">aaa< /span> < span wicket:id="bbb" class="bbb">bbb< /span> < span wicket:id="ccc" class="ccc">ccc< /span> -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/help-with-drag-and-drop-wicket-dnd-tp4422338p4422835.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: help with drag and drop (wicket-dnd)
Hi Dan, only a shot in the dark - but is your markup valid? validate with w3c. PS: Is it required to add the ending slash? Cheers Per Thanks for answer. Yes, in the first "td" is "span" but in this forum it was formatted and span was not visible. The first td should be:< span wicket:id="aaa" class="aaa">www -- But I make little modification and html is: < span wicket:id="aaa" class="aaa">aaa < span wicket:id="bbb" class="bbb">bbb < span wicket:id="ccc" class="ccc">ccc And in java class was added: Label bbb = new Label("bbb", "bbb"); Label ccc = new Label("ccc", "ccc"); bbb.setOutputMarkupId(true); ccc.setOutputMarkupId(true); container.add(bbb); container.add(ccc); But in the methods is transfer.getData() allways NULL. What should be in transfer? The target element? Is there any way how to know what element was targeted (drop)? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/help-with-drag-and-drop-wicket-dnd-tp4422338p4422742.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: help with drag and drop (wicket-dnd)
Thanks for answer. Yes, in the first "td" is "span" but in this forum it was formatted and span was not visible. The first td should be: < span wicket:id="aaa" class="aaa">www -- But I make little modification and html is: < span wicket:id="aaa" class="aaa">aaa < span wicket:id="bbb" class="bbb">bbb < span wicket:id="ccc" class="ccc">ccc And in java class was added: Label bbb = new Label("bbb", "bbb"); Label ccc = new Label("ccc", "ccc"); bbb.setOutputMarkupId(true); ccc.setOutputMarkupId(true); container.add(bbb); container.add(ccc); But in the methods is transfer.getData() allways NULL. What should be in transfer? The target element? Is there any way how to know what element was targeted (drop)? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/help-with-drag-and-drop-wicket-dnd-tp4422338p4422742.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: help with drag and drop (wicket-dnd)
Hi, with .drag("span") you tell the drag source that drags should start on span tags. > > > > www > aaa > aaa > > > Do you have a span tag in your markup? Sven On 02/26/2012 04:50 PM, Dan12321 wrote: I would like to use drag and drop functions in my wicket application. Into my pom.xml I add: wicket-dnd (http://code.google.com/p/wicket-dnd/) But my code do not work. Could you help me, please? I have got table. In the first cell ("td") is "span" element. I want this "span" drag and drop into another cell ("td") in the table. Thanks for help. WebMarkupContainer container = new WebMarkupContainer("container"); Model model = Model.of(new String("AAA")); container.add(new DragSource(Operation.values()) { public void onAfterDrop(AjaxRequestTarget target, Transfer transfer) { System.out.println("A"); } }.drag("span")); container.add(new DropTarget(Operation.values()) { public void onDrop(AjaxRequestTarget target, Transfer transfer, Location location) { // add transfer data System.out.println(""); } }.dropCenter("td")); Label label = new Label("aaa", model); label.setOutputMarkupId(true); container.add(label); add(container); and HTML: www aaa aaa -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/help-with-drag-and-drop-wicket-dnd-tp4422338p4422338.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
help with drag and drop (wicket-dnd)
I would like to use drag and drop functions in my wicket application. Into my pom.xml I add: wicket-dnd (http://code.google.com/p/wicket-dnd/) But my code do not work. Could you help me, please? I have got table. In the first cell ("td") is "span" element. I want this "span" drag and drop into another cell ("td") in the table. Thanks for help. WebMarkupContainer container = new WebMarkupContainer("container"); Model model = Model.of(new String("AAA")); container.add(new DragSource(Operation.values()) { public void onAfterDrop(AjaxRequestTarget target, Transfer transfer) { System.out.println("A"); } }.drag("span")); container.add(new DropTarget(Operation.values()) { public void onDrop(AjaxRequestTarget target, Transfer transfer, Location location) { // add transfer data System.out.println(""); } }.dropCenter("td")); Label label = new Label("aaa", model); label.setOutputMarkupId(true); container.add(label); add(container); and HTML: www aaa aaa -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/help-with-drag-and-drop-wicket-dnd-tp4422338p4422338.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org