Q:

change moved widget on drop with gwt-dnd 3.3.0

situation
I'm writing a admintool to change a GWT based GUI via Browser.
I want the Admin to use drag and drop to create and change the GUI.
To realize the dnd I use gwt-dnd 3.3.0
I have a toolbar in my admintool, from which I can drag the different objects.
Every object in the toolbar is a plain HTML widget with text inside.
I would like to change the Widget when it is droped.It should change from the HTML widget to the original widget I like to use.
problem & tried solution
At the moment I can change the widget on Drop, then it throws an exception and the "moving widget" don't get removed from the page. The "moving widget" is still dragable and shows the "move designe"
I think this happens, because the Drag or Drophandler do not know the moving widget, because i changed the drop widget...
Here is the code:
dragController.addDragHandler(new DragHandler(){
    public void onDragEnd(DragEndEvent event) {
    ...
    }
    public void onDragStart(DragStartEvent event) {
        ...
    }
    public void onPreviewDragEnd(DragEndEvent event)
          throws VetoDragException {
        final DragContext mycontent = event.getContext();
        List<Widget> mywl = mycontent.selectedWidgets;
        for(int i = 0; i < mywl.size(); i++)
        {
            String stemp = ((HTML)mywl.get(i)).getText();
            if(stemp.contains("Container")&&!stemp.contains("SubContainer"))
            {
                FlowPanel mypanel = new FlowPanel();
                HTML htmltemp = new HTML("Label");
                htmltemp.setStyleName("edit-dndcontainer");
                mypanel.add(htmltemp);
                mypanel.setStyleName("edit-dndcontainer");

                mywl.add(i, mypanel);
                dragController.makeDraggable(mypanel);
                mywl.get(i).removeFromParent();
                mywl.remove(i+1);

                mycontent.selectedWidgets = mywl;
            }
            else if(stemp.contains("Label"))
            {
                ...
            }
            else
            {
                ...
                throw new VetoDragException();
            }
        }
    }
    public void onPreviewDragStart(DragStartEvent event)
          throws VetoDragException
    {
        ...
    }
});

question

Is gwt-dnd the correct lib to use for this behaviour, or should I use native dnd of GWT?
How can I change the dnd-widget on drop with gwt-dnd?

Thanks for your help

A:

My approach was not that bad, but instead of working with the DragContext, I have to work with the getSelectedWidgets().iterator() from the DragController.
edit
I switched my code to onDragEnd(), in this case I don't screw up the moving widget. And I changed the Draggable widget to a Panel. I just have to add and remove widgets from it.
answer
Samplecode:
dragController.addDragHandler(new DragHandler(){
    public void onDragEnd(DragEndEvent event) {
        Iterable<Widget> myiterable = myDragCTRL_subcont.getSelectedWidgets();
        Widget mywidget = myiterable.iterator().next();

        FlowPanel flowtemp = ((FlowPanel)mywidget);
        flowtemp.add(new HTML("label"));
        ...
        ...
    }
    public void onDragStart(DragStartEvent event) {
        ...
    }
    public void onPreviewDragEnd(DragEndEvent event)
          throws VetoDragException {
        ...
    }
    public void onPreviewDragStart(DragStartEvent event)
          throws VetoDragException {
        ...
    }
});

