@Override public void dragOver(DropTargetDragEvent dtde) { if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { dtde.acceptDrag(DnDConstants.ACTION_COPY); return; } dtde.rejectDrag(); }
private void acceptDrag(DropTargetDragEvent dtde) { int dragaction = dtde.getDropAction(); if (dragaction != 0) { dtde.acceptDrag(dragaction); } else { dtde.acceptDrag(ALL_ACTIONS); } }
public void dragOver(DropTargetDragEvent e) { if (IJ.debugMode) IJ.log("DragOver: " + e.getLocation()); Point loc = e.getLocation(); int buttonSize = Toolbar.getButtonSize(); int width = IJ.getInstance().getSize().width; openAsVirtualStack = width - loc.x <= buttonSize; if (openAsVirtualStack) IJ.showStatus("<<Open as Virtual Stack>>"); else IJ.showStatus("<<Drag and Drop>>"); }
/** {@inheritDoc} */ public void dragEnter(DropTargetDragEvent evt) { target = (JComponent) evt.getDropTargetContext().getComponent(); TransferHandler th = target.getTransferHandler(); canImport = th.canImport(target, evt.getCurrentDataFlavors()); if (canImport) { saveComponentState(target); lastPosition = evt.getLocation(); } }
/** Called when a drag operation has encountered the DropTarget. */ public void dragEnter(DropTargetDragEvent dtde) { log("DropTargetDragEvent-dragEnter"); supportDropTargetDragEvent(dtde); if (fLastX == 0) { fLastX = dtde.getLocation().x; } if (fLastY == 0) { fLastY = dtde.getLocation().y; } }
private void checkDrag(DropTargetDragEvent dtde) { int da = dtde.getDropAction(); if (dtde.getCurrentDataFlavors().length == 0) { JConfig.log().logVerboseDebug("Zero length accepted... (" + da + ")"); acceptDrag(dtde); return; } if (testAllFlavors(dtde) != null) { JConfig.log().logVerboseDebug("Accepting drag! (" + da + ")"); acceptDrag(dtde); } else { dtde.rejectDrag(); JConfig.log().logVerboseDebug("Rejecting drag! (" + da + ")"); } }
/** {@inheritDoc} */ public void dragOver(DropTargetDragEvent evt) { if (canImport) { Point p = evt.getLocation(); updateInsertionLocation(target, p); lastPosition = p; } }
public void dragEnter(DropTargetDragEvent event) { if (!isDragAcceptable(event)) { event.rejectDrag(); return; } }
public void dragOver(DropTargetDragEvent e) { if (!((mxGraphTransferHandler) graphContainer.getTransferHandler()).isLocalDrag() && JTableRenderer.this != dragSource) { Point p = e.getLocation(); int row = rowAtPoint(p); getSelectionModel().setSelectionInterval(row, row); } }
public boolean isDragAcceptable(DropTargetDragEvent event) { // usually, you // check the // available // data flavors // here // in this program, we accept all flavors return (event.getDropAction() & DnDConstants.ACTION_COPY_OR_MOVE) != 0; }
protected Point getTableLocationForEvent(DropTargetDragEvent dropTargetDragEvent) { Point dragTargetPoint = dropTargetDragEvent.getLocation(); int column = _underlyingTable.columnAtPoint(dragTargetPoint); int row = _underlyingTable.rowAtPoint(dragTargetPoint); if ((row < 0) || (column < 0)) { return null; } return new Point(row, column); }
private boolean testFlavor(DataFlavor inFlavor, DropTargetDragEvent t) { if (inFlavor != null) { if (t.isDataFlavorSupported(inFlavor)) { /* * I think this has been debugged enough. This gets annoying. */ JConfig.log().logVerboseDebug("Accepting(1): " + inFlavor.getMimeType()); return true; } } return false; }
/** Called when a drag operation is ongoing on the DropTarget. */ public void dragOver(DropTargetDragEvent dtde) { // log("DropTargetDragEvent-dragOver"); if (supportDropTargetDragEvent(dtde) == true) { int x = dtde.getLocation().x; int y = dtde.getLocation().y; if ((Math.abs(x - fLastX) > 0) || (Math.abs(y - fLastY) > 0)) { // FigureEnumeration fe = view().selectionElements(); // while (fe.hasNextFigure()) { // fe.nextFigure().moveBy(x - fLastX, y - fLastY); // System.out.println("moving Figures " + view()); // } // view().drawing().update(); fLastX = x; fLastY = y; } } }
public void dropActionChanged(DropTargetDragEvent dtde) { if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE); } }
/** * Tests wether the Drag event is of a type that we support handling Check the DND interface and * support the events it says it supports if not a dnd interface comp, then dont support! because * we dont even really know what kind of view it is. */ protected boolean supportDropTargetDragEvent(DropTargetDragEvent dtde) { if (dtde.isDataFlavorSupported(DNDFiguresTransferable.DNDFiguresFlavor) == true) { if ((dtde.getDropAction() & DnDConstants.ACTION_COPY_OR_MOVE) != 0) { dtde.acceptDrag(dtde.getDropAction()); return true; } else { dtde.rejectDrag(); return false; } } else if (dtde.isDataFlavorSupported(DNDHelper.ASCIIFlavor) == true) { dtde.acceptDrag(dtde.getDropAction()); // accept everything because i am too lazy to fix yet return true; } else if (dtde.isDataFlavorSupported(DataFlavor.stringFlavor) == true) { dtde.acceptDrag(dtde.getDropAction()); // accept everything because i am too lazy to fix yet return true; } else if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor) == true) { dtde.acceptDrag(dtde.getDropAction()); // accept everything because i am too lazy to fix yet return true; } else { dtde.rejectDrag(); return false; } }
public void dropActionChanged(DropTargetDragEvent event) { if (!isDragAcceptable(event)) { event.rejectDrag(); return; } }
public void dragEnter(DropTargetDragEvent e) { IJ.showStatus("<<Drag and Drop>>"); if (IJ.debugMode) IJ.log("DragEnter: " + e.getLocation()); e.acceptDrag(DnDConstants.ACTION_COPY); openAsVirtualStack = false; }
public void dragEnter(DropTargetDragEvent dtde) { JConfig.log().logVerboseDebug("DragEnter!"); checkDrag(dtde); if (JConfig.queryConfiguration("debug.uber", "false").equals("true") && JConfig.debugging) dumpDataFlavors(dtde.getCurrentDataFlavors()); }