Hello,

I'm currently playing with AJAX in Wicket using WicketStuff YUI integration.

Is there any way to refuse a drop ? There's a behavior called Droppable
which includes an accept() method but I can't figure out how to add it to my
component tree / call it.

Here's a working code snippet :

-----
final WebMarkupContainer list1;

        final List<String> list1items = new ArrayList<String>();
        list1items.add("1.1");
        list1items.add("1.2");

        add(list1 = new WebMarkupContainer("list1"));
        list1.setOutputMarkupId(true);

list1.add(new YuiDDTarget("LIST") {
            private static final long serialVersionUID =
-62687283825213344L;

            @Override
            public void onDrop(AjaxRequestTarget target, Component
component) {
                String newItem = ((ListItem<String>)
component).getModelObject();
                list1items.add(newItem);
                target.addComponent(list1);
            }

        });

-----

But then, I'm trying to add a new Droppable() to my list1 component but
neither onDrop() nor accept() are called :

-----
Droppable d = new Droppable() {

       private static final long serialVersionUID = -3647700662771836452L;
            @Override
            protected boolean accept(Draggable draggable) {
                return super.accept(draggable);
            }

            @Override
            public void onDrop(AjaxRequestTarget target, Component
component, int index) {
            }

        };
list1.add(d);
-----


A clue, anyone ?

Regards,

Pierre


-- 
Sans amis était le grand maître des mondes,
Eprouvait manque, ce pour quoi il créa les esprits,
Miroirs bienveillants de sa béatitude.
Mais au vrai, il ne trouva aucun égal,
Du calice du royaume total des âmes
Ecume jusqu'à lui l'infinité.

(Schiller, "l'amitié")

Reply via email to