Hi,

I wanted to make better use of JavaScript inheritance using Dojo. For example, using Java I can extend DojoDropContainer to implement (server-side) specific drop behavior. But I also wanted some specific behavior on the JavaScript side without having to copy/paste all the existing js code (such as creating the URL which includes the ID of the drag source, etc).

For example, I have a wastebin, and I want it to:
* highlight when a drag source can be dropped on it and hovers over it
* remove all html child elements after it's dropped (that is, remove the html of the dropped drag source)

Therefore, I created a dojo module named "wicketstuff", which can access anything under org.wicketstuff.dojo. For example, I now have a javascript class wicketstuff.dojodnd.DojoDropContainer (org/wicketstuff/dojo/dojodnd/DojoDropContainer.js). I can extend this class in JavaScript and override the onDrop function to handle my specific requirements (remove all html children after the drop). Same for the drop indicator.

I could also use the existing "dojoWicket" namespace, but I think it's nicer to have the JS classes in the same package as the associated Java classes. This is already the case in org.wicketstuff.dojo.dojodnd (it contains the Java classes and some JavaScript templates).

Is this something that is useful? It's a small change, that currently only affects DojoDragContainer and DojoDropContainer (and it shouldn't break dnd as far as I can see), so shall I check it in so that others can look at it?

Bart.

Reply via email to