PanelDefinitionImpl implements PanelDefinition { public void setParent(PanelDefinition parent) { if (this.parent != null && parent != null) { throw new IllegalStateException("Can't change parent: this panel still belongs to " + this.parent); } this.parent = parent; } @JsIgnore  PanelDefinitionImpl(); @JsIgnore  PanelDefinitionImpl(final String type); @Override PanelDefinition getParent(); void setParent(PanelDefinition parent); @Override String getElementId(); @Override void setElementId(String id); @Override void addPart(final PartDefinition part); @Override PartDefinition addPart(String partSpec); @Override boolean removePart(PartDefinition part); @Override @JsIgnore Set<PartDefinition> getParts(); @Override @JsIgnore List<PanelDefinition> getChildren(); @Override void insertChild(final Position position,
                            final PanelDefinition panel); @Override void appendChild(final Position position,
                            final PanelDefinition panel); @Override void appendChild(final PanelDefinition panel); @Override PanelDefinition getChild(final Position position); @Override void removeChild(final Position position); @Override boolean isRoot(); void setRoot(boolean isRoot); @Override String getPanelType(); @Override void setPanelType(String fqcn); @Override @JsIgnore Integer getHeight(); @Override @JsIgnore void setHeight(Integer height); @Override @JsIgnore Integer getWidth(); @Override @JsIgnore void setWidth(Integer width); @Override @JsIgnore final Integer getMinHeight(); @Override @JsIgnore final void setMinHeight(Integer minHeight); @Override @JsIgnore final Integer getMinWidth(); @Override @JsIgnore final void setMinWidth(Integer minWidth); @Override final Position getPosition(); @Override void setPosition(final Position position); @Override boolean isMaximized(); @Override ContextDefinition getContextDefinition(); @Override void setContextDefinition(final ContextDefinition contextDefinition); @Override ContextDisplayMode getContextDisplayMode(); @Override void setContextDisplayMode(final ContextDisplayMode contextDisplayMode); @Override String toString();  }
@Test(expected = IllegalStateException.class) public void settingTwoDifferentParentsShouldThrowException() throws Exception { panelDefinition.setParent(otherPanel); panelDefinition.setParent(parent); }