/** * Searches the size request of <code>dockable</code>. * * @param dockable some element * @return the size request or <code>null</code> */ protected RequestDimension getAndClearResizeRequest(Dockable dockable) { if (dockable instanceof CommonDockable) { CDockable cdock = ((CommonDockable) dockable).getDockable(); RequestDimension result = cdock.getAndClearResizeRequest(); if (result == null) return null; return result.clone(); } if (dockable instanceof StackDockStation) { RequestDimension max = new RequestDimension(); StackDockStation station = (StackDockStation) dockable; for (int i = 0, n = station.getDockableCount(); i < n; i++) { RequestDimension check = getAndClearResizeRequest(station.getDockable(i)); if (check != null) { Dimension sizeDockable = station.getDockable(i).getComponent().getSize(); Dimension sizeStation = station.getComponent().getSize(); if (check.isWidthSet()) { max.setWidth( Math.max( max.getWidth(), check.getWidth() + sizeStation.width - sizeDockable.width)); } if (check.isHeightSet()) { max.setHeight( Math.max( max.getHeight(), check.getHeight() + sizeStation.height - sizeDockable.height)); } } } if (max.isHeightSet() || max.isWidthSet()) return max; } return null; }
public Dockable combine(CombinerSource source, CombinerTarget target) { if (target instanceof DisplayerTarget) { return ((DisplayerTarget) target).execute(source); } else { DockStation parent = source.getParent(); PlaceholderMap placeholders = source.getPlaceholders(); StackDockStation stack = new StackDockStation(parent.getTheme()); stack.setController(parent.getController()); if (placeholders != null) { stack.setPlaceholders(placeholders); } stack.drop(source.getOld()); stack.drop(source.getNew()); return stack; } }