当前位置: 首页>>代码示例>>Java>>正文


Java TransferSupport类代码示例

本文整理汇总了Java中javax.swing.TransferHandler.TransferSupport的典型用法代码示例。如果您正苦于以下问题:Java TransferSupport类的具体用法?Java TransferSupport怎么用?Java TransferSupport使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TransferSupport类属于javax.swing.TransferHandler包,在下文中一共展示了TransferSupport类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleDrop

import javax.swing.TransferHandler.TransferSupport; //导入依赖的package包/类
@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;
	}
}
 
开发者ID:mgropp,项目名称:pdfjumbler,代码行数:21,代码来源:PdfList.java

示例2: dragStarted

import javax.swing.TransferHandler.TransferSupport; //导入依赖的package包/类
@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;

		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:20,代码来源:AttributeDropTextField.java

示例3: canImport

import javax.swing.TransferHandler.TransferSupport; //导入依赖的package包/类
@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;
}
 
开发者ID:Audiveris,项目名称:audiveris,代码行数:27,代码来源:FileDropHandler.java

示例4: dragStarted

import javax.swing.TransferHandler.TransferSupport; //导入依赖的package包/类
@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;
			
		}
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:19,代码来源:AttributeDropTextField.java

示例5: dragStarted

import javax.swing.TransferHandler.TransferSupport; //导入依赖的package包/类
@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;

					}
				}
			});
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:39,代码来源:ChartConfigurationPanel.java

示例6: canImport

import javax.swing.TransferHandler.TransferSupport; //导入依赖的package包/类
@Override
public boolean canImport(TransferSupport ts) {
    return ts.getComponent().equals(tree)
            && ts.isDataFlavorSupported(OBJECT_FLAVOR)
            && getDestinationObject(ts) != null
            && !(getDestinationObject(ts) instanceof ORRootInf);
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:8,代码来源:ObjectDnD.java

示例7: importData

import javax.swing.TransferHandler.TransferSupport; //导入依赖的package包/类
@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;
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:39,代码来源:ObjectDnD.java

示例8: getDestinationObject

import javax.swing.TransferHandler.TransferSupport; //导入依赖的package包/类
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;
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:13,代码来源:ObjectDnD.java

示例9: hasSupport

import javax.swing.TransferHandler.TransferSupport; //导入依赖的package包/类
public static boolean hasSupport(final TransferSupport info) {
    if (info != null) {
        for (final DataFlavor flavor : info.getDataFlavors()) {
            if (ClipboardUtils.hasSupport(flavor)) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:friedlwo,项目名称:AppWoksUtils,代码行数:11,代码来源:ClipboardUtils.java

示例10: canImport

import javax.swing.TransferHandler.TransferSupport; //导入依赖的package包/类
/**
 * {@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;
}
 
开发者ID:jlpoolen,项目名称:libreveris,代码行数:30,代码来源:FileDropHandler.java

示例11: dragStarted

import javax.swing.TransferHandler.TransferSupport; //导入依赖的package包/类
@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;
						
					}
				}
			});
		}
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:38,代码来源:ChartConfigurationPanel.java

示例12: isListItemDrop

import javax.swing.TransferHandler.TransferSupport; //导入依赖的package包/类
public static boolean isListItemDrop(TransferSupport info) {
	return info.isDataFlavorSupported(JDDLTransferData.DATA_FLAVOR);
}
 
开发者ID:mgropp,项目名称:pdfjumbler,代码行数:4,代码来源:DropUtil.java

示例13: isURIDrop

import javax.swing.TransferHandler.TransferSupport; //导入依赖的package包/类
public static boolean isURIDrop(TransferSupport info) {
	return
		info.isDataFlavorSupported(DataFlavor.javaFileListFlavor) ||
		info.isDataFlavorSupported(DATA_FLAVOR_URILIST_STRING);
}
 
开发者ID:mgropp,项目名称:pdfjumbler,代码行数:6,代码来源:DropUtil.java

示例14: acceptDrop

import javax.swing.TransferHandler.TransferSupport; //导入依赖的package包/类
@Override
public boolean acceptDrop(Object sender, TransferSupport info) {
	return
		(info.getTransferable().isDataFlavorSupported(JDDLTransferData.DATA_FLAVOR)) ||
		DropUtil.isURIDrop(info);
}
 
开发者ID:mgropp,项目名称:pdfjumbler,代码行数:7,代码来源:PdfList.java

示例15: canImport

import javax.swing.TransferHandler.TransferSupport; //导入依赖的package包/类
@Override
public boolean canImport(TransferSupport support) {
    return delegate.canImport(support);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:ClipboardHandler.java


注:本文中的javax.swing.TransferHandler.TransferSupport类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。