int dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( dtde.getDropAction(), view.getAllowedDropActions() );
/** User is starting to drag over us */ public void dragEnter(DropTargetDragEvent dtde) { ExplorerDnDManager.getDefault().setMaybeExternalDragAndDrop( true ); int dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( dtde.getDropAction(), view.getAllowedDropActions() ); lastIndex = indexWithCheck(dtde); if (lastIndex < 0) { dtde.rejectDrag(); } else { dtde.acceptDrag(dropAction); NodeRenderer.dragEnter(list.getModel().getElementAt(lastIndex)); list.repaint(list.getCellBounds(lastIndex, lastIndex)); } }
/** User is starting to drag over us */ public void dragEnter(DropTargetDragEvent dtde) { int dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( dtde.getDropAction(), view.getAllowedDropActions() ); //TODO dnd // ExplorerDnDManager.getDefault().prepareCursor( // DragDropUtilities.chooseCursor( // dtde.getDropTargetContext().getComponent(), dropAction, (dropAction & view.getAllowedDropActions()) != 0 // ) // ); lastIndex = indexWithCheck(dtde); if (lastIndex < 0) { dtde.rejectDrag(); } else { dtde.acceptDrag(dropAction); // TODO // NodeRenderer.dragEnter(list.getModel().getElementAt(lastIndex)); // list.repaint(list.getCellBounds(lastIndex, lastIndex)); } }
int dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( dtde.getDropAction(), view.getAllowedDropActions() );
/** @return The tree path to the node the cursor is above now or * null if no such node currently exists or if conditions were not * satisfied to continue with DnD operation. */ int indexWithCheck(DropTargetDragEvent dtde) { int dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( dtde.getDropAction(), view.getAllowedDropActions() ); // check actions if ((dropAction & view.getAllowedDropActions()) == 0) { return -1; } // check location int index = table.rowAtPoint(dtde.getLocation()); if (index == -1) return -1; Object obj = view.getNodeFromRow(index); if (index < 0) { return -1; } if (!(obj instanceof Node)) { return -1; } // succeeded return index; }
public void dropActionChanged(DropTargetDragEvent dtde) { // check if the nodes are willing to do selected action Node[] nodes = ExplorerDnDManager.getDefault().getDraggedNodes(); if( null != nodes ) { int dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( dtde.getDropAction(), view.getAllowedDropActions() ); for (int i = 0; i < nodes.length; i++) { if ( ((view.getAllowedDropActions() & dropAction) == 0) || !DragDropUtilities.checkNodeForAction(nodes[i], dropAction) ) { // this action is not supported dtde.rejectDrag(); return; } } } return; }
/** User drags over us */ public void dragOver(DropTargetDragEvent dtde) { ExplorerDnDManager.getDefault().setMaybeExternalDragAndDrop( true ); int dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( dtde.getDropAction(), view.getAllowedDropActions() ); int index = indexWithCheck(dtde); if (index < 0) { dtde.rejectDrag(); if (lastIndex >= 0) { NodeRenderer.dragExit(); list.repaint(list.getCellBounds(lastIndex, lastIndex)); lastIndex = -1; } } else { dtde.acceptDrag(dropAction); if (lastIndex != index) { if (lastIndex < 0) { lastIndex = index; } NodeRenderer.dragExit(); NodeRenderer.dragEnter(list.getModel().getElementAt(index)); list.repaint(list.getCellBounds(lastIndex, index)); lastIndex = index; } } }
public void dropActionChanged(DropTargetDragEvent dtde) { // check if the nodes are willing to do selected action Node[] nodes = ExplorerDnDManager.getDefault().getDraggedNodes(); if( null == nodes ) return; int dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( dtde.getDropAction(), view.getAllowedDropActions(dtde.getTransferable()) ); for (int i = 0; i < nodes.length; i++) { if ( ((view.getAllowedDropActions(dtde.getTransferable()) & dropAction) == 0) || !DragDropUtilities.checkNodeForAction(nodes[i], dropAction) ) { // this action is not supported dtde.rejectDrag(); return; } } return; }
int dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( dtde.getDropAction(), view.getAllowedDropActions() );
Node dropNode = view.getNodeFromRow(index); int dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( dtde.getDropAction(), view.getAllowedDropActions() );
int dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( dtde.getDropAction(), view.getAllowedDropActions(dtde.getTransferable()) );
int dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( dtde.getDropAction(), view.getAllowedDropActions() );
int allowedDropActions = view.getAllowedDropActions(); dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( dropAction, allowedDropActions);
dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( dropAction, allowedDropActions);