// dockingPort.
Component docked = getDockedComponent();
remove(docked);
// add the components to their new parents.
DockingStrategy strategy = getDockingStrategy();
DockingPort oldContent = strategy.createDockingPort(this);
DockingPort newContent = strategy.createDockingPort(this);
addCmp(oldContent, docked);
dockCmp(newContent, comp);
JSplitPane newDockedContent = strategy.createSplitPane(this, region);
// put the ports in the correct order and add them to a new wrapper
// panel
DockingPort[] ports = putPortsInOrder(oldContent, newContent, region);
if (ports[0] instanceof JComponent) {
((JComponent) ports[0]).setMinimumSize(new Dimension(0, 0));
}
if (ports[1] instanceof JComponent) {
((JComponent) ports[1]).setMinimumSize(new Dimension(0, 0));
}
if (ports[0] instanceof Component)
newDockedContent.setLeftComponent((Component) ports[0]);
if (ports[1] instanceof Component)
newDockedContent.setRightComponent((Component) ports[1]);
// set the split in the middle
double ratio = .5;
if (docked instanceof Dockable
&& newDockedContent instanceof DockingSplitPane) {
Float siblingRatio = ((Dockable) docked).getDockingProperties()
.getSiblingSize(region);
if (siblingRatio != null) {
ratio = siblingRatio.doubleValue();
}
((DockingSplitPane) newDockedContent).setInitialDividerRatio(ratio);
}
newDockedContent.setDividerLocation(ratio);
// now set the wrapper panel as the currently docked component
setComponent(newDockedContent);
// if we're currently showing, then we can exit now
if (isShowing())
return true;
// otherwise, we have unrealized components whose sizes cannot be
// determined until after we're visible. cache the desired size
// values now for use later during rendering.
double proportion = strategy.getDividerProportion(this,
newDockedContent);
SwingUtility.putClientProperty((Component) oldContent,
DefaultDockingStrategy.PREFERRED_PROPORTION, new Float(
proportion));
SwingUtility.putClientProperty((Component) newContent,