*/
if (dropEvent.getTransferable() instanceof WrapperTransferable) {
WrapperTransferable transferable = (WrapperTransferable) dropEvent
.getTransferable();
Component sourceComponent = transferable
.getSourceComponent();
Component draggedComponent = transferable
.getDraggedComponent();
DropTarget target = dropEvent.getTargetDetails()
.getTarget();
WrappedLabel wrappedLabel = new WrappedLabel(
draggedComponent.toString());
if (target instanceof WrappedLabel) {
int i = 1; // add next to reference by default
Iterator<Component> componentIterator = cssLayout
.getComponentIterator();
Component next = componentIterator.next();
while (next != target && componentIterator.hasNext()) {
if (next != sourceComponent) {
// don't count on index if component is being
// moved
i++;