DockingPath path = DockingPath.create(dockable);
info.setPath(path);
}
private void updateRelative(Dockable dockable) {
DockingState info = getDockingState(dockable);
DockingPort port = dockable.getDockingPort();
// don't update relative info for tabbed layout, since we
// technically have more than one relative.
if(port.getDockedComponent()!=dockable.getComponent())
return;
Component comp = ((Component)port).getParent();
// if we're not inside a split pane, then there is no relative
if(!(comp instanceof JSplitPane)) {
setNullRelative(info);
return;
}
JSplitPane splitPane = (JSplitPane)comp;
Component siblingComp = SwingUtility.getOtherComponent(splitPane, (Component)port);
if(!(siblingComp instanceof DockingPort)) {
setNullRelative(info);
return;
}
Component otherDocked = ((DockingPort)siblingComp).getDockedComponent();
Dockable sibling = otherDocked instanceof JSplitPane || otherDocked instanceof JTabbedPane? null: DockingManager.getDockable(otherDocked);
if(sibling==null) {
setNullRelative(info);
return;
}
// if we got here, then we are definitely sharing a split layout with another dockable.
String region = DefaultDockingStrategy.findRegion(dockable.getComponent());
float ratio = SwingUtility.getDividerProportion(splitPane);
// set the relative docking info
info.setRelativeParent(sibling);
info.setRegion(region);
info.setSplitRatio(ratio);
// make the sibling aware of us
info = getDockingState(sibling);
info.setRelativeParent(dockable);
info.setRegion(DockingUtility.flipRegion(region));
info.setSplitRatio(ratio);
}