Java 类javax.swing.TransferHandler.TransferSupport 实例源码

项目:pdfjumbler    文件:PdfList.java   
@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;
    }
}
项目:rapidminer    文件:AttributeDropTextField.java   
@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;

        }
    }
}
项目:audiveris    文件:FileDropHandler.java   
@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;
}
项目:rapidminer-studio    文件:AttributeDropTextField.java   
@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;

        }
    }
}
项目:rapidminer-5    文件:AttributeDropTextField.java   
@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;

        }
    }
}
项目:rapidminer    文件:ChartConfigurationPanel.java   
@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;

                    }
                }
            });
        }
    }
}
项目:Cognizant-Intelligent-Test-Scripter    文件:ObjectDnD.java   
@Override
public boolean canImport(TransferSupport ts) {
    return ts.getComponent().equals(tree)
            && ts.isDataFlavorSupported(OBJECT_FLAVOR)
            && getDestinationObject(ts) != null
            && !(getDestinationObject(ts) instanceof ORRootInf);
}
项目:Cognizant-Intelligent-Test-Scripter    文件:ObjectDnD.java   
@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;
}
项目:Cognizant-Intelligent-Test-Scripter    文件:ObjectDnD.java   
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;
}
项目:rapidminer-studio    文件:ChartConfigurationPanel.java   
@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;

                    }
                }
            });
        }
    }
}
项目:AppWoksUtils    文件:ClipboardUtils.java   
public static boolean hasSupport(final TransferSupport info) {
    if (info != null) {
        for (final DataFlavor flavor : info.getDataFlavors()) {
            if (ClipboardUtils.hasSupport(flavor)) {
                return true;
            }
        }
    }
    return false;
}
项目:libreveris    文件:FileDropHandler.java   
/**
 * {@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;
}
项目:rapidminer-5    文件:ChartConfigurationPanel.java   
@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;

                    }
                }
            });
        }
    }
}
项目:pdfjumbler    文件:DropUtil.java   
public static boolean isListItemDrop(TransferSupport info) {
    return info.isDataFlavorSupported(JDDLTransferData.DATA_FLAVOR);
}
项目:pdfjumbler    文件:DropUtil.java   
public static boolean isURIDrop(TransferSupport info) {
    return
        info.isDataFlavorSupported(DataFlavor.javaFileListFlavor) ||
        info.isDataFlavorSupported(DATA_FLAVOR_URILIST_STRING);
}
项目:pdfjumbler    文件:PdfList.java   
@Override
public boolean acceptDrop(Object sender, TransferSupport info) {
    return
        (info.getTransferable().isDataFlavorSupported(JDDLTransferData.DATA_FLAVOR)) ||
        DropUtil.isURIDrop(info);
}
项目:incubator-netbeans    文件:ClipboardHandler.java   
@Override
public boolean canImport(TransferSupport support) {
    return delegate.canImport(support);
}
项目:AppWoksUtils    文件:RemoveMEDataFlavor.java   
public static boolean removeMe(TransferSupport info) {
    return removeMe(info.getTransferable());
}
项目:AppWoksUtils    文件:RemoveMEDataFlavor.java   
public static boolean supported(TransferSupport info) {
    return supported(info.getTransferable());
}
项目:AppWoksUtils    文件:ClipboardUtils.java   
public static java.util.List<String> getLinks(final TransferSupport trans) {
    return ClipboardUtils.getLinks(trans.getTransferable());
}
项目:viskit    文件:ImageListTestApp.java   
@Override
public boolean canImport(ImageListView source, TransferSupport ts, int index, boolean isInsert) {
    return ts.isDataFlavorSupported(ilvListCellFlavor);
}
项目:binnavi    文件:DragAndDropSupportWrapper.java   
/**
 * 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;
}
项目:viskit    文件:DndSupport.java   
/**
 * 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);
项目:viskit    文件:DndSupport.java   
boolean importData(ImageListView source, TransferSupport ts, int index, boolean isInsert);
项目:FileTree    文件:IFileDragDropSupport.java   
public boolean canImport(TransferSupport support);