private void afterUnmarshal() { if (_caption != null) _caption = (Caption) getChildren().get(_caption.getParent().getChildren().indexOf(_caption)); if (_tbar != null) _tbar = (Toolbar) getChildren().get(_tbar.getParent().getChildren().indexOf(_tbar)); if (_panelchildren != null) _panelchildren = (Panelchildren) getChildren() .get(_panelchildren.getParent().getChildren().indexOf(_panelchildren)); if (_bbar != null) _bbar = (Toolbar) getChildren().get(_bbar.getParent().getChildren().indexOf(_bbar)); if (_fbar != null) _fbar = (Toolbar) getChildren().get(_fbar.getParent().getChildren().indexOf(_fbar)); }
if (super.insertBefore(newChild, refChild)) { if (refChild instanceof Panelchildren || (refChild == null && (getChildren().size() == (_caption != null ? 2 : 1)))) { _tbar = (Toolbar) newChild; } else if (refChild == null || refChild == _fbar) {
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); }