if (targetDesktop == null) {
// deny drag gesture when desktops aren't compatible
if (underMouseNullDesktop != null) { // we've found a dock drop receiver
// we send a really simple event
DockDropEvent event = new DockDropEvent(desktop, dragSource, e);
((DockDropReceiver) underMouseNullDesktop).processDockableDrop(event);
// this event will be ignored
}
return false;
} else if (targetDesktop.getContext() != desktop.getContext()) { //2006/09/11
// contexts not compatible, stop here
return false;
}
// 2005/11/08 support for full height/width docking
DockingPanel dp = targetDesktop.getDockingPanel();
Insets i = targetDesktop.getDockingPanelInsets();
Rectangle deskBounds = new Rectangle(i.left, i.top,
targetDesktop.getWidth() - i.left - i.right, targetDesktop.getHeight() - i.top - i.bottom);
Rectangle innerBounds = new Rectangle(deskBounds);
innerBounds.x += 5;
innerBounds.y += 5;
innerBounds.width -= 10;
innerBounds.height -= 10;
if (deskBounds.contains(dragPoint) && !innerBounds.contains(dragPoint)) {
// at less than 5 pixels from a order, promote DockingPanel as the receiver
underMouse = dp;
}
// move up hierarchy till we find a drop receiver
while (underMouse != null && underMouse != targetDesktop &&
!(underMouse instanceof DockDropReceiver)) {
underMouse = underMouse.getParent();
}
umInfo.underMouse = underMouse; // resync
if (underMouse == null) {
// || isAncestorOf(dockableDragSource.getDockableContainer(), underMouse)){ 2007/01/08 moved to implementations
// it's not possible to drop a parent on one of its children
if (underMouse instanceof DockDropReceiver) {
// but we still have to use the reference on drop receiver to disaplay a floating drag shape
this.dropReceiver = (DockDropReceiver) underMouse;
}
DropProcess dropProcess = new DropProcess(e, dockableDragSource, umInfo);
if (dropProcess.canDockableBeDetached() && dropProcess.checkDockableWillBeDetached()) {
Point location = new Point(e.getPoint());
SwingUtilities.convertPointToScreen(location, e.getComponent());
dropProcess.setFloating(location);
return true;
} else {
// refused (vetoed)
return false;
}
} else if (underMouse instanceof DockDropReceiver && e.isControlDown()) { //2005/11/08 HOT SWAP FUNCTION
processHotSwap(underMouse, e.getComponent(), null, true);
return true;
} else if (underMouse instanceof DockDropReceiver) {
// MouseEvent convertMouse;
DropProcess process = new DropProcess(e, dockableDragSource, umInfo);
DockDragEvent event = process.findAcceptableEvent(e);
if (event.isDragAccepted() && process.isDockingActionAccepted()) {// triggers vetoable listeners
return process.dropIfPossible();
} else if (process.canDockableBeDetached() // Not accepted on the desktop //2005/10/07
&& process.checkDockableWillBeDetached()) {
Point location = new Point(e.getPoint());
SwingUtilities.convertPointToScreen(location, e.getComponent());