/** Gets the singleton instance of this window dnd manager. */ static synchronized ExplorerDnDManager getDefault() { if (defaultDnDManager == null) { defaultDnDManager = new ExplorerDnDManager(); } return defaultDnDManager; }
if (ExplorerDnDManager.getDefault().getNodeAllowedActions() == DnDConstants.ACTION_NONE) { return false; Node[] nodes = ExplorerDnDManager.getDefault().getDraggedNodes(); if (nodes != null) { for (int i = 0; i < nodes.length; i++) { Transferable trans = ExplorerDnDManager.getDefault().getDraggedTransferable( (DnDConstants.ACTION_MOVE & dropAction) != 0 );
@Override public void valueChanged(TreeSelectionEvent ev) { TreePath[] paths = tree.getSelectionPaths(); if (paths == null) { // part of bugfix #37279, if DnD is active then is useless select a nearby node if (ExplorerDnDManager.getDefault().isDnDActive()) { return; } callSelectionChanged(new Node[0]); } else { // we need to force no changes to nodes hierarchy => // we are requesting read request, but it is not necessary // to execute the next action immediatelly, so postReadRequest // should be enough readAccessPaths = paths; Children.MUTEX.postReadRequest(this); } }
public void dragDropEnd(DragSourceDropEvent dsde) { // not transferable for MOVE nor COPY exDnD.setDraggedTransferable(null, true); exDnD.setDraggedTransferable(null, false); // no nodes are dragged exDnD.setDraggedNodes(null); // no drop candidate NodeRenderer.dragExit(); // no more active exDnD.setDnDActive(false); }
public void dragDropEnd (DragSourceDropEvent dsde) { // not transferable for MOVE nor COPY exDnD.setDraggedTransferable (null, true); exDnD.setDraggedTransferable (null, false); // no nodes are dragged exDnD.setDraggedNodes (null); // no drop candidate NodeRenderer.dragExit (); }
/** User exits the dragging */ public void dragExit(DropTargetEvent dte) { dropIndex = -1; ExplorerDnDManager.getDefault().setMaybeExternalDragAndDrop( false ); stopDragging(); }
exDnD = ExplorerDnDManager.getDefault(); exDnD.setNodeAllowedActions(possibleNodeAction); exDnD.setDraggedTransferable(transferable, true); exDnD.setDraggedTransferable(transferable, false); } else if ((possibleNodeAction & DnDConstants.ACTION_COPY) != 0) { exDnD.setDraggedTransferable(transferable, false); } else { exDnD.setDraggedTransferable(transferable, false); exDnD.setDraggedNodes(nodes); exDnD.setDnDActive(true); dge.startDrag(null, transferable, this); exDnD.setDnDActive(false); } catch (IOException exc) { exDnD.setDnDActive(false);
Node[] nodes = ExplorerDnDManager.getDefault().getDraggedNodes(); Transferable trans = ExplorerDnDManager.getDefault().getDraggedTransferable( (DnDConstants.ACTION_MOVE & dropAction) != 0 );
private boolean canReorderWhenMoving(Node folder, Node[] dragNodes) { if ((ExplorerDnDManager.getDefault().getNodeAllowedActions() & DnDConstants.ACTION_MOVE) == 0) { return false; } return canReorder( folder, dragNodes ); }
public void dropActionChanged (DropTargetDragEvent dtde) { // check if the nodes are willing to do selected action Node[] nodes = ExplorerDnDManager.getDefault ().getDraggedNodes (); int dropAction = dtde.getDropAction (); 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 ; }
@Override public void dragDropEnd(DragSourceDropEvent dsde) { Node[] dropedNodes = exDnD.getDraggedNodes(); super.dragDropEnd(dsde); exDnD.setDnDActive(false);
ExplorerDnDManager.getDefault().setMaybeExternalDragAndDrop( true ); dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( dropAction, allowedDropActions); } else { Node[] draggedNodes = ExplorerDnDManager.getDefault().getDraggedNodes(); if( null != draggedNodes && canReorderWhenMoving(dropNode, draggedNodes) ) {
/** Default constructor. */ public ListView() { initializeList (); // activation of drop target if (DragDropUtilities.dragAndDropEnabled) { ExplorerDnDManager.getDefault ().addFutureDropTarget (this); // note: drag target is activated on focus gained } // no border, window system manages outer border itself setBorder (BorderFactory.createEmptyBorder()); setViewportBorder (BorderFactory.createEmptyBorder()); }
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; }
int dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( dtde.getDropAction(), view.getAllowedDropActions() );
int dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( dtde.getDropAction(), view.getAllowedDropActions() ); ExplorerDnDManager.getDefault().setMaybeExternalDragAndDrop( false ); Transferable t = ExplorerDnDManager.getDefault().getDraggedTransferable((DnDConstants.ACTION_MOVE & dropAction) != 0); if( null == t ) t = dtde.getTransferable();
ExplorerDnDManager.getDefault ().getDraggedTransferable ((DnDConstants.ACTION_MOVE & dropAction) != 0), dropAction); if (pt == null) { dtde.dropComplete(false);
/** 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)); } }
int getAdjustedDropAction(int action, int allowed) { int possibleAction = action; if ((possibleAction & allowed) == 0) { possibleAction = allowed; } if ((possibleAction & getNodeAllowedActions()) == 0) { possibleAction = getNodeAllowedActions(); } return possibleAction; }
public void dragGestureRecognized (DragGestureEvent dge) { super.dragGestureRecognized (dge); // notify tree cell editor that DnD operationm is active if (exDnD.isDnDActive ()) { TreeCellEditor tce = ((JTree)tree).getCellEditor (); if (tce instanceof TreeViewCellEditor) ((TreeViewCellEditor)tce).setDnDActive (true); } }