MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / setDropLocation

Method setDropLocation

unused/javax/swing/JTree.java:1430–1466  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 9

setSelectionPathsMethod · 0.95
setLeadSelectionPathMethod · 0.95
getSelectionPathsMethod · 0.95
getLeadSelectionPathMethod · 0.95
setSelectionPathMethod · 0.95
getPathMethod · 0.95
firePropertyChangeMethod · 0.45

Tested by

no test coverage detected