@Override public boolean handleDrop(Object sender, TransferSupport info) { @SuppressWarnings("unchecked") JDragDropList<Page> list = (JDragDropList<Page>)sender; if (DropUtil.isURIDrop(info)) { ArrayList<File> files = new ArrayList<File>(); int position = list.getDropLocation().getIndex(); for (URI uri : DropUtil.getURIs(info)) { if (uri.getScheme().equals("file")) { files.add(new File(uri.getPath())); } } PdfJumbler.openFiles(PdfList.this, position, files); return true; } else { return false; } }
@Override public void dragStarted(Transferable t) { TransferSupport support = new TransferSupport(this, t); boolean doesSupportFlavor = ((DataTableColumnDropTextFieldTransferHandler) getTransferHandler()) .doesSupportFlavor(support); if (doesSupportFlavor) { switch (RapidMinerGUI.getDragHighlighteMode()) { case FULL: setBackground(ProcessDrawer.INNER_DRAG_COLOR); case BORDER: setBorder(ongoingDropBorder); break; default: break; } } }
@Override public boolean canImport (TransferSupport support) { /* For the time being, only support drops (not clipboard paste) */ if (!support.isDrop()) { return false; } /* Check that the drop contains a list of files */ if (!support.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { return false; } /* Check to see if the source actions contains the COPY action */ boolean copySupported = (COPY & support.getSourceDropActions()) == COPY; /* If COPY is supported, choose COPY and accept the transfer */ if (copySupported) { support.setDropAction(COPY); return true; } /* COPY isn't supported, so reject the transfer */ return false; }
@Override public void dragStarted(Transferable t) { TransferSupport support = new TransferSupport(this, t); boolean doesSupportFlavor = ((DataTableColumnDropTextFieldTransferHandler) getTransferHandler()).doesSupportFlavor(support); if (doesSupportFlavor) { switch(RapidMinerGUI.getDragHighlighteMode()){ case FULL: setBackground(ProcessRenderer.INNER_DRAG_COLOR); case BORDER: setBorder(ongoingDropBorder); break; default: break; } } }
@Override public void dragStarted(Transferable t) { TransferSupport support = new TransferSupport(this, t); boolean doesSupportFlavor = ((PlotConfigurationTreeTransferHandler) plotConfigurationTree.getTransferHandler()) .doesSupportFlavor(support); if (doesSupportFlavor) { if (SwingUtilities.isEventDispatchThread()) { switch (RapidMinerGUI.getDragHighlighteMode()) { case FULL: plotConfigurationTree.setBackground(ProcessDrawer.INNER_DRAG_COLOR); case BORDER: plotConfigurationTreeScrollPane.setBorder(ONGOING_DROP_BORDER); break; default: break; } } else { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { switch (RapidMinerGUI.getDragHighlighteMode()) { case FULL: plotConfigurationTree.setBackground(ProcessDrawer.INNER_DRAG_COLOR); case BORDER: plotConfigurationTreeScrollPane.setBorder(ONGOING_DROP_BORDER); break; default: break; } } }); } } }
@Override public boolean canImport(TransferSupport ts) { return ts.getComponent().equals(tree) && ts.isDataFlavorSupported(OBJECT_FLAVOR) && getDestinationObject(ts) != null && !(getDestinationObject(ts) instanceof ORRootInf); }
@Override public boolean importData(TransferSupport ts) { if (canImport(ts)) { ObjectRepDnD oDnd; try { oDnd = (ObjectRepDnD) ts.getTransferable().getTransferData(OBJECT_FLAVOR); } catch (UnsupportedFlavorException | IOException ex) { Logger.getLogger(ObjectDnD.class.getName()).log(Level.SEVERE, null, ex); return false; } Object object = getDestinationObject(ts); Boolean shouldCut = ts.isDrop() ? ts.getDropAction() == MOVE : isCut; if (object instanceof ORPageInf) { if (oDnd.isGroup()) { copyObjectGroups((ORPageInf) object, oDnd, shouldCut); return true; } else if (oDnd.isObject()) { copyObjects((ORPageInf) object, oDnd, shouldCut); return true; } } else if (object instanceof ObjectGroup) { if (oDnd.isObject()) { copyObjects((ObjectGroup) object, oDnd, shouldCut); return true; } } else if (object instanceof ORObjectInf) { if (oDnd.isObject()) { if (copyObjects(((ORObjectInf) object).getParent(), oDnd, shouldCut)) { if (((ORObjectInf) object).getParent().getChildCount() == 2) { reload(((ORObjectInf) object).getParent().getParent()); } } return true; } } } return false; }
private Object getDestinationObject(TransferSupport ts) { TreePath path; if (ts.isDrop()) { path = ((JTree.DropLocation) ts.getDropLocation()).getPath(); } else { path = ((JTree) ts.getComponent()).getSelectionPath(); } if (path != null) { return path.getLastPathComponent(); } return null; }
public static boolean hasSupport(final TransferSupport info) { if (info != null) { for (final DataFlavor flavor : info.getDataFlavors()) { if (ClipboardUtils.hasSupport(flavor)) { return true; } } } return false; }
/** * {@inheritDoc} */ @Override public boolean canImport (TransferSupport support) { /* For the time being, only support drops (not clipboard paste) */ if (!support.isDrop()) { return false; } /* Check that the drop contains a list of files */ if (!support.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { return false; } /* Check to see if the source actions contains the COPY action */ boolean copySupported = (COPY & support.getSourceDropActions()) == COPY; /* If COPY is supported, choose COPY and accept the transfer */ if (copySupported) { support.setDropAction(COPY); return true; } /* COPY isn't supported, so reject the transfer */ return false; }
@Override public void dragStarted(Transferable t) { TransferSupport support = new TransferSupport(this, t); boolean doesSupportFlavor = ((PlotConfigurationTreeTransferHandler) plotConfigurationTree.getTransferHandler()).doesSupportFlavor(support); if (doesSupportFlavor) { if (SwingUtilities.isEventDispatchThread()) { switch(RapidMinerGUI.getDragHighlighteMode()){ case FULL: plotConfigurationTree.setBackground(ProcessRenderer.INNER_DRAG_COLOR); case BORDER: plotConfigurationTreeScrollPane.setBorder(ONGOING_DROP_BORDER); break; default: break; } } else { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { switch(RapidMinerGUI.getDragHighlighteMode()){ case FULL: plotConfigurationTree.setBackground(ProcessRenderer.INNER_DRAG_COLOR); case BORDER: plotConfigurationTreeScrollPane.setBorder(ONGOING_DROP_BORDER); break; default: break; } } }); } } }
public static boolean isListItemDrop(TransferSupport info) { return info.isDataFlavorSupported(JDDLTransferData.DATA_FLAVOR); }
public static boolean isURIDrop(TransferSupport info) { return info.isDataFlavorSupported(DataFlavor.javaFileListFlavor) || info.isDataFlavorSupported(DATA_FLAVOR_URILIST_STRING); }
@Override public boolean acceptDrop(Object sender, TransferSupport info) { return (info.getTransferable().isDataFlavorSupported(JDDLTransferData.DATA_FLAVOR)) || DropUtil.isURIDrop(info); }
@Override public boolean canImport(TransferSupport support) { return delegate.canImport(support); }
public static boolean removeMe(TransferSupport info) { return removeMe(info.getTransferable()); }
public static boolean supported(TransferSupport info) { return supported(info.getTransferable()); }
public static java.util.List<String> getLinks(final TransferSupport trans) { return ClipboardUtils.getLinks(trans.getTransferable()); }
@Override public boolean canImport(ImageListView source, TransferSupport ts, int index, boolean isInsert) { return ts.isDataFlavorSupported(ilvListCellFlavor); }
/** * Sets the transfer support instance which contains all relevant information to handle the drag * and drop operation. * * @param support The transfer support for the drag and drop operation. */ public void setSupport(final TransferSupport support) { this.support = support; }
/** * The TransferSupport should only be needed for #isDataFlavorSupported, * really. May introduce our own abstraction interface instead. * * @param source * @param ts * @return */ boolean canImport(ImageListView source, TransferSupport ts, int index, boolean isInsert);
boolean importData(ImageListView source, TransferSupport ts, int index, boolean isInsert);
public boolean canImport(TransferSupport support);