Called to set or clear the drop location during a DnD operation. In some cases, the component may need to use it's internal selection temporarily to indicate the drop location. To help facilitate this, this method returns and accepts as a parameter a state object. This state object can be used to st
(TransferHandler.DropLocation location,
Object state,
boolean forDrop)
| 1428 | * @return any saved state for this component, or <code>null</code> if none |
| 1429 | */ |
| 1430 | Object setDropLocation(TransferHandler.DropLocation location, |
| 1431 | Object state, |
| 1432 | boolean forDrop) { |
| 1433 | |
| 1434 | Object retVal = null; |
| 1435 | DropLocation treeLocation = (DropLocation)location; |
| 1436 | |
| 1437 | if (dropMode == DropMode.USE_SELECTION) { |
| 1438 | if (treeLocation == null) { |
| 1439 | if (!forDrop && state != null) { |
| 1440 | setSelectionPaths(((TreePath[][])state)[0]); |
| 1441 | setAnchorSelectionPath(((TreePath[][])state)[1][0]); |
| 1442 | setLeadSelectionPath(((TreePath[][])state)[1][1]); |
| 1443 | } |
| 1444 | } else { |
| 1445 | if (dropLocation == null) { |
| 1446 | TreePath[] paths = getSelectionPaths(); |
| 1447 | if (paths == null) { |
| 1448 | paths = new TreePath[0]; |
| 1449 | } |
| 1450 | |
| 1451 | retVal = new TreePath[][] {paths, |
| 1452 | {getAnchorSelectionPath(), getLeadSelectionPath()}}; |
| 1453 | } else { |
| 1454 | retVal = state; |
| 1455 | } |
| 1456 | |
| 1457 | setSelectionPath(treeLocation.getPath()); |
| 1458 | } |
| 1459 | } |
| 1460 | |
| 1461 | DropLocation old = dropLocation; |
| 1462 | dropLocation = treeLocation; |
| 1463 | firePropertyChange("dropLocation", old, dropLocation); |
| 1464 | |
| 1465 | return retVal; |
| 1466 | } |
| 1467 | |
| 1468 | /** |
| 1469 | * Called to indicate to this component that DnD is done. |
nothing calls this directly
no test coverage detected