Object layoutObj = getLayoutElement (layout, id, "", 1);
if (layoutObj == null) return false;
// do the job:
Layout lay;
Item item;
if (layoutObj instanceof NamedItem) {
lay = ((NamedItem)layoutObj).getLayout();
if (lay == null)
item = (NamedItem) layoutObj;
else
item = lay.getParent();
}
else {
lay = (Layout) layoutObj;
item = lay.getParent();
}
// find element in the list and move it:
List items = item.getParent().getItems();
for (ListIterator iter = items.listIterator(); iter.hasNext(); ) {
Item itemElem = (Item) iter.next();
if(itemElem.equals(item)) {
int pos = iter.nextIndex()-1;
int newpos = pos;
if (moveUp)
newpos --;