/** Enables/disables dropping support. * @param state true means drops into view are allowed, * false forbids any drops into this view. */ public void setDropTarget (boolean state) { if (state == dropActive) return; dropActive = state; // create drop support if needed if (dropActive && (dropSupport == null)) dropSupport = new ListViewDropSupport(this, list); // activate / deactivate support according to the state dropSupport.activate(dropActive); }
/** Activates or deactivates Drag support on asociated JTree * component * @param active true if the support should be active, false * otherwise */ public void activate(boolean active) { if (this.active == active) { return; } this.active = active; getDropTarget().setActive(active); }
/** User is starting to drag over us */ public void dragEnter (DropTargetDragEvent dtde) { lastIndex = indexWithCheck(dtde); if (lastIndex < 0) dtde.rejectDrag(); else { dtde.acceptDrag(dtde.getDropAction()); NodeRenderer.dragEnter( list.getModel().getElementAt(lastIndex)); list.repaint(list.getCellBounds(lastIndex, lastIndex)); } }
if (index < 0 || !canDrop (dropNode, dropAction)) { dtde.rejectDrop(); return;
/** User is starting to drag over us */ public void dragEnter (DropTargetDragEvent dtde) { lastIndex = indexWithCheck(dtde); if (lastIndex < 0) dtde.rejectDrag(); else { dtde.acceptDrag(dtde.getDropAction()); NodeRenderer.dragEnter( list.getModel().getElementAt(lastIndex)); list.repaint(list.getCellBounds(lastIndex, lastIndex)); } }
if (index < 0 || !canDrop (dropNode, dropAction)) { dtde.rejectDrop(); return;
/** Enables/disables dropping support. * @param state true means drops into view are allowed, * false forbids any drops into this view. */ public void setDropTarget (boolean state) { if (state == dropActive) return; dropActive = state; // create drop support if needed if (dropActive && (dropSupport == null)) dropSupport = new ListViewDropSupport(this, list); // activate / deactivate support according to the state dropSupport.activate(dropActive); }
/** 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)); } }
/** Activates or deactivates Drag support on asociated JTree * component * @param active true if the support should be active, false * otherwise */ public void activate (boolean active) { if (this.active == active) return; this.active = active; getDropTarget().setActive(active); }
if ((index < 0) || !canDrop(dropNode, dropAction, dtde.getTransferable(), index)) { dtde.rejectDrop();
/** Enables/disables dropping support. * @param state true means drops into view are allowed, * false forbids any drops into this view. */ public void setDropTarget(boolean state) { if (state == dropActive) { return; } dropActive = state; // create drop support if needed if (dropActive && (dropSupport == null)) { dropSupport = new ListViewDropSupport(this, list); } // activate / deactivate support according to the state dropSupport.activate(dropActive); }
/** User drags over us */ public void dragOver (DropTargetDragEvent dtde) { 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(dtde.getDropAction()); if (lastIndex != index) { if (lastIndex < 0) lastIndex = index; NodeRenderer.dragExit(); NodeRenderer.dragEnter(list.getModel().getElementAt(index)); list.repaint(list.getCellBounds(lastIndex, index)); lastIndex = index; } } }
/** Activates or deactivates Drag support on asociated JTree * component * @param active true if the support should be active, false * otherwise */ public void activate (boolean active) { if (this.active == active) return; this.active = active; getDropTarget().setActive(active); }
/** User drags over us */ public void dragOver (DropTargetDragEvent dtde) { 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(dtde.getDropAction()); if (lastIndex != index) { if (lastIndex < 0) lastIndex = index; NodeRenderer.dragExit(); NodeRenderer.dragEnter(list.getModel().getElementAt(index)); list.repaint(list.getCellBounds(lastIndex, index)); lastIndex = index; } } }
/** 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; } } }