private int findDockbarEdge(Dockable dockable) {
RootWindow window = RootWindow.getRootContainer(dockable.getComponent());
if(window==null)
return DEFAULT_EDGE;
// get the dockable component and it's containing content pane
Component cmp = dockable.getComponent();
Container contentPane = window.getContentPane();
// get the bounds of the content pane and dockable, translating the dockable into the
// content pane's axes
Rectangle contentRect = new Rectangle(0, 0, contentPane.getWidth(), contentPane.getHeight());
Rectangle dockRect = SwingUtilities.convertRectangle(cmp.getParent(), cmp.getBounds(), contentPane);