WidgetInfo widget = (WidgetInfo) object;
// reorder, use same "position" element
{
Position position = getPosition(m_widget, widget);
if (position == Position.this) {
DocumentElement targetElement = target.getElement();
int targetIndex = target.getIndex();
targetElement.moveChild(object.getElement().getParent(), targetIndex);
return;
}
}
// create new "position" element
target = prepareTarget(target);
super.move(object, target, oldParent, newParent);
}
private ElementTarget prepareTarget(ElementTarget target) {
// prepare "position" element
String tag = m_widget.getElement().getTagNS() + m_description.getTag();
DocumentElement positionElement = new DocumentElement(tag);
// add "position" element
DocumentElement targetElement = target.getElement();
int targetIndex = target.getIndex();
targetElement.addChild(positionElement, targetIndex);
// prepare new target
return new ElementTarget(positionElement, 0);
}
};
}