|
@@ -195,6 +195,7 @@ public class HolonView extends JPanel{
|
|
|
if(!support.isDataFlavorSupported(holonFlavor) && !support.isDataFlavorSupported(elementFlavor)) {
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
JTree.DropLocation location = (JTree.DropLocation)support.getDropLocation();
|
|
|
TreePath pathDrop = location.getPath();
|
|
|
DefaultMutableTreeNode node = (DefaultMutableTreeNode) pathDrop.getLastPathComponent();
|
|
@@ -202,12 +203,14 @@ public class HolonView extends JPanel{
|
|
|
if(!(node.getUserObject() instanceof HolonInfo)) {
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
JTree tree = (JTree) support.getComponent();
|
|
|
TreePath pathDrag = tree.getSelectionPath();
|
|
|
+
|
|
|
if(pathDrag.isDescendant(pathDrop)) {
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
@Override
|
|
@@ -251,8 +254,9 @@ public class HolonView extends JPanel{
|
|
|
if(path != null) {
|
|
|
DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
|
|
|
Object userObject = node.getUserObject();
|
|
|
- if(userObject instanceof HolonNode) {
|
|
|
- return ((HolonNode) userObject).getTransferable(this);
|
|
|
+
|
|
|
+ if(userObject instanceof HolonInfo) {
|
|
|
+ return ((HolonInfo) userObject).getTransferable(this);
|
|
|
|
|
|
}
|
|
|
}
|