boolean success = false;
DockingPort dockingPort = DockingUtility.getParentDockingPort(dragSrc);
// notify that we are about to undock
Map dragContext = DragManager.getDragContext(dockable);
DockingEvent dockingEvent = new DockingEvent(dockable, dockingPort,
dockingPort, DockingEvent.UNDOCKING_STARTED, dragContext);
EventManager.dispatch(dockingEvent);
// if(dockingEvent.isConsumed())
// return false;
if (dockingPort != null) {
// if 'dragSrc' is currently docked, then undock it instead of using
// a
// simple remove(). this will allow the DockingPort to do any of its
// own
// cleanup operations associated with component removal.
success = dockingPort.undock(dragSrc);
} else {
// otherwise, just remove the component
parent.remove(dragSrc);
success = true;
}
if (rootWin != null) {
SwingUtility.revalidate(rootWin.getContentPane());
SwingUtility.repaint(rootWin.getContentPane());
}
if (success) {
dockingEvent = new DockingEvent(dockable, dockingPort, dockingPort,
DockingEvent.UNDOCKING_COMPLETE, dragContext);
// notify the docking port and dockable
Object[] evtTargets = { dockingPort, dockable };
EventManager.dispatch(dockingEvent, evtTargets);
}