/** * This base implementation should be sufficient for most panels. It modifies the panel definition * and adds the child view to this panel's view. In case the requested position is already in use * for this panel, this method will throw an {@link IllegalStateException}. Subclasses may * override and implement some other collision avoidance strategy. */ @Override public void addPanel(final WorkbenchPanelPresenter child, final Position position) { if (childPanels.containsKey(position)) { throw new IllegalStateException("This panel already has a " + position + " child"); } definition.insertChild(position, child.getDefinition()); getPanelView().addPanel(child.getDefinition(), child.getPanelView(), position); childPanels.put(position, child); child.setParent(this); }
@Override public boolean removePanel(WorkbenchPanelPresenter child) { Position position = positionOf(child); if (position == null) { return false; } getPanelView().removePanel(child.getPanelView()); definition.removeChild(position); childPanels.remove(position); child.setParent(null); return true; }