本文整理汇总了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;
}
}
示例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;
}
}
}
示例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;
}
示例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;
}
}
}
示例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;
}
}
});
}
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
});
}
}
}
示例12: isListItemDrop
import javax.swing.TransferHandler.TransferSupport; //导入依赖的package包/类
public static boolean isListItemDrop(TransferSupport info) {
return info.isDataFlavorSupported(JDDLTransferData.DATA_FLAVOR);
}
示例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);
}
示例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);
}
示例15: canImport
import javax.swing.TransferHandler.TransferSupport; //导入依赖的package包/类
@Override
public boolean canImport(TransferSupport support) {
return delegate.canImport(support);
}