target.add(list);
}
}
}.drag("div.item").initiate("span.initiate"));
DropTarget dropTarget = new DropTarget()
{
@Override
public Set<Operation> getOperations()
{
return dropOperations();
}
@Override
public String[] getTypes()
{
return types();
}
@Override
public void onDrop(AjaxRequestTarget target, Transfer transfer, Location location)
{
if (location.getComponent() == list)
{
foos.add(operate(transfer));
}
else
{
Foo foo = location.getModelObject();
switch (location.getAnchor())
{
case TOP :
case LEFT :
foos.addBefore(operate(transfer), foo);
break;
case BOTTOM :
case RIGHT :
foos.addAfter(operate(transfer), foo);
break;
default :
transfer.reject();
}
target.add(list);
}
}
};
if ("vertical".equals(id))
{
dropTarget.dropTopAndBottom("div.item");
}
else
{
dropTarget.dropLeftAndRight("div.item");
}
list.add(dropTarget);
return list;
}