public CombinerTarget prepare(final CombinerSource source, boolean force) { DockableDisplayer displayer = source.getOldDisplayer(); if (displayer != null) { DisplayerCombinerTarget operation = displayer.prepareCombination(source, force); if (operation != null) { return new DisplayerTarget(operation); } } if (!force) { return null; } return new CombinerTarget() { public void paint( Graphics g, Component component, StationPaint paint, Rectangle stationBounds, Rectangle dockableBounds) { paint.drawInsertion(g, source.getParent(), stationBounds, dockableBounds); } public DisplayerCombinerTarget getDisplayerCombination() { 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; } }
private Combiner get(CombinerSource source) { return controller.getTheme().getCombiner(source.getParent()); }