//-- Component --//
public void beforeChildAdded(Component newChild, Component refChild) {
if (newChild instanceof Caption) {
if (_caption != null && _caption != newChild)
throw new UiException("Only one caption is allowed: "+this);
} else if (refChild instanceof Caption) {
throw new UiException("caption must be the first child");
} else if (newChild instanceof Panelchildren) {
if (_panelchildren != null && _panelchildren != newChild)
throw new UiException("Only one panelchildren child is allowed: "+this);
} else if (newChild instanceof Toolbar) {
if (refChild instanceof Panelchildren
|| (refChild == null && (getChildren().isEmpty()))) {
if(_tbar != null && _tbar != newChild)
throw new UiException("Only one top toolbar child is allowed: "+this);
} else if (refChild == null || refChild == _fbar) {
if (_bbar != null && _bbar != newChild) {
if (refChild != null && refChild == _fbar)
throw new UiException("Only one bottom toolbar child is allowed: "+this);
if (_fbar != null && _fbar != newChild)
throw new UiException("Only one foot toolbar child is allowed: "+this);
}
} else {
throw new UiException("Only three toolbars child is allowed: " + this);
}
} else {
throw new UiException("Unsupported child for Panel: " + newChild);
}
super.beforeChildAdded(newChild, refChild);
}