// get layout element:
Object layoutObj = getLayoutElement (layout, id, "", 1);
if (layoutObj == null) return false;
// do the job:
Layout lay;
if (layoutObj instanceof NamedItem)
lay = ((NamedItem)layoutObj).getLayout();
else
lay = (Layout) layoutObj;
try {
// an empty item can not be handled by the LayoutFactory, do the job manual:
if (lay == null) {
List items = ((NamedItem)layoutObj).getParent().getItems();
for (ListIterator iter = items.listIterator(); iter.hasNext(); ) {
Item itemElem = (Item) iter.next();
if( itemElem.equals(layoutObj)) {
items.remove (iter.nextIndex()-1);
return true;
}
}
} else if(lay.getParent() instanceof NamedItem) {
// FIXME: Causes that only the contents inside a tab are deleted instead of the tab
NamedItem par = (NamedItem) lay.getParent();
par.setLayout(null);
} else {
lf.remove(lay);
}