I have a vertical layout and I need to move the components in that vertical layout, up and down. I used DragAndDropWrapper, but I am not sure what to implement under DropHandler's drop function. I found examples for absoulte layout and it worked.
class MoveHandler implements DropHandler
{
public AcceptCriterion getAcceptCriterion()
{
return AcceptAll.get();
}
public void drop(DragAndDropEvent event)
{
WrapperTransferable t = (WrapperTransferable) event.getTransferable();
WrapperTargetDetails details = (WrapperTargetDetails) event.getTargetDetails();
// Calculate the drag coordinate difference
int xChange = details.getMouseEvent().getClientX() - t.getMouseDownEvent().getClientX();
int yChange = details.getMouseEvent().getClientY() - t.getMouseDownEvent().getClientY();
// Move the component in the absolute layout
ComponentPosition pos = ((AbsoluteLayout)
questionButtonLayout).getPosition(t.getSourceComponent());
pos.setLeftValue(pos.getLeftValue() + xChange);
pos.setTopValue(pos.getTopValue() + yChange);
}
}
Above is the code for the abstract layout. Not sure what to do for vertical layout.