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


Java DropTargetDropEvent.rejectDrop方法代码示例

本文整理汇总了Java中java.awt.dnd.DropTargetDropEvent.rejectDrop方法的典型用法代码示例。如果您正苦于以下问题:Java DropTargetDropEvent.rejectDrop方法的具体用法?Java DropTargetDropEvent.rejectDrop怎么用?Java DropTargetDropEvent.rejectDrop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.dnd.DropTargetDropEvent的用法示例。


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

示例1: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
public void drop(DropTargetDropEvent e)
{
	if (dragSource != null)
	{
		e.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
		Point p = e.getLocation();
		int targetRow = rowAtPoint(p);

		Object edge = graph.insertEdge(null, null, null,
				dragSource.cell, JTableRenderer.this.cell, "sourceRow="
						+ sourceRow + ";targetRow=" + targetRow);
		graph.setSelectionCell(edge);

		// System.out.println("clearing drag source");
		dragSource = null;
		e.dropComplete(true);
	}
	else
	{
		e.rejectDrop();
	}
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:23,代码来源:JTableRenderer.java

示例2: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
public void drop(DropTargetDropEvent e) {
  if (dragSource != null) {
    e.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
    Point p = e.getLocation();
    int targetRow = rowAtPoint(p);

    Object edge = graph.insertEdge(null, null, null, dragSource.cell, JTableRenderer.this.cell,
        "sourceRow=" + sourceRow + ";targetRow=" + targetRow);
    graph.setSelectionCell(edge);

    // System.out.println("clearing drag source");
    dragSource = null;
    e.dropComplete(true);
  } else {
    e.rejectDrop();
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:18,代码来源:JTableRenderer.java

示例3: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
@Override
public void drop(DropTargetDropEvent dtde) {
    if (checkDropValid()) {
        int action = dtde.getDropAction();
        
        ProjectHandler project = ProjectHandler.getInstance();
        if (action == DnDConstants.ACTION_MOVE) {
            project.removeNodeFromParent(incomingNode);
        } else if (action == DnDConstants.ACTION_COPY) {
            incomingNode = incomingNode.copy();
        }
        
        project.insertNodeInto(incomingNode, targetNode, 0);
        expandPath(path);
        selectionModel.setSelectionPath(path.pathByAddingChild(incomingNode));

        dtde.acceptDrop(action);
    } else {
        dtde.rejectDrop();
    }
    
    finishDnD();
}
 
开发者ID:m-lima,项目名称:KATscans,代码行数:24,代码来源:DraggableTree.java

示例4: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
public void drop(DropTargetDropEvent e)
{
	if (dragSource != null)
	{
		e.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
		Point p = e.getLocation();
		int targetRow = rowAtPoint(p);

		Object edge = graph.insertEdge(null, null, null,
				dragSource.cell, JTableRenderer.this.cell, "sourceRow="
						+ sourceRow + ";targetRow=" + targetRow, null);
		graph.setSelectionCell(edge);

		// System.out.println("clearing drag source");
		dragSource = null;
		e.dropComplete(true);
	}
	else
	{
		e.rejectDrop();
	}
}
 
开发者ID:md-k-sarker,项目名称:OWLAx,代码行数:23,代码来源:JTableRenderer.java

示例5: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
@Override
public void drop(DropTargetDropEvent dtde) {
    if (dtde.isDataFlavorSupported(VillageTransferable.villageDataFlavor) || dtde.isDataFlavorSupported(DataFlavor.stringFlavor)) {
        dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
    } else {
        dtde.rejectDrop();
        return;
    }

    Transferable t = dtde.getTransferable();
    List<Village> v;
    MapPanel.getSingleton().setCurrentCursor(MapPanel.getSingleton().getCurrentCursor());
    try {
        v = (List<Village>) t.getTransferData(VillageTransferable.villageDataFlavor);
        fireVillagesDraggedEvent(v, dtde.getLocation());
    } catch (Exception ignored) {
    }
}
 
开发者ID:Torridity,项目名称:dsworkbench,代码行数:19,代码来源:AbstractDSWorkbenchFrame.java

示例6: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
@Override
public void drop(@Nonnull final DropTargetDropEvent dtde) {
  if (this.dragAcceptableType) {

    final Point dragPoint = dtde.getLocation();

    final TreePath path = getPathForLocation(dragPoint.x, dragPoint.y);

    if (path != null) {
      final Object dropTargetNode = path.getLastPathComponent();
      if (dropTargetNode instanceof NodeFileOrFolder) {
        final NodeFileOrFolder node = (NodeFileOrFolder) dropTargetNode;
        if (!node.isLeaf()) {
         //TODO processing of file drag in tree
         System.out.println("Not implemented yet!"); //NOI18N
        } else {
          dtde.rejectDrop();
        }
      }
    }

    repaint();
  }
}
 
开发者ID:raydac,项目名称:netbeans-mmd-plugin,代码行数:25,代码来源:DnDTree.java

示例7: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
@Override
public void drop(DropTargetDropEvent dtde) {
    setDragState(null, 0, 0);

    TabDragInfo dragInfo = getDragInfo(dtde.getTransferable());
    if (dragInfo != null) {
        if (dragInfo.tab != null && Utils.contains(dropZone, dtde.getLocation()) && isSnapInAllowed(dragInfo.tab)) {
            dtde.acceptDrop(dtde.getDropAction());
        } else {
            dtde.rejectDrop();
        }
    } else {
        dtde.rejectDrop();
    }

    dtde.dropComplete(true);
}
 
开发者ID:DJVUpp,项目名称:Desktop,代码行数:18,代码来源:JhromeTabbedPaneUI.java

示例8: getString

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
/**
 * Gets the string.
 *
 * @param event
 *            the event
 * @return the string
 * @throws IOException
 *             Signals that an I/O exception has occurred.
 * @throws UnsupportedFlavorException
 *             the unsupported flavor exception
 */
@SuppressWarnings("unchecked")
static String getString(DropTargetDropEvent event) throws IOException, UnsupportedFlavorException {
	String text = null;
	DataFlavor fileList = DataFlavor.javaFileListFlavor;

	if (event.isDataFlavorSupported(fileList)) {
		event.acceptDrop(DnDConstants.ACTION_COPY);
		List<File> list = (List<File>) event.getTransferable().getTransferData(fileList);
		text = list.get(0).getAbsolutePath();
	} else if (event.isDataFlavorSupported(DataFlavor.stringFlavor)) {
		event.acceptDrop(DnDConstants.ACTION_COPY);
		text = (String) event.getTransferable().getTransferData(DataFlavor.stringFlavor);
		if (text.startsWith("file://"))
			text = text.substring(7);
		text = stripSuffix(stripSuffix(text, "\n"), "\r").replaceAll("%20", " ");
	} else {
		event.rejectDrop();
		return null;
	}

	event.dropComplete(text != null);
	return text;
}
 
开发者ID:thorstenwagner,项目名称:ij-ridgedetection,代码行数:35,代码来源:GenericDialogPlus.java

示例9: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
@Override
public void drop(DropTargetDropEvent dtde) {
    try {
        final Transferable transferable = dtde.getTransferable();
        if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
            dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
            final List<File> fileList = (List<File>) transferable.getTransferData(DataFlavor.javaFileListFlavor);
            if (fileList.size() > 0) {
                final OpenProductAction open = new OpenProductAction();
                open.setFiles(fileList.toArray(new File[fileList.size()]));
                dtde.dropComplete(Boolean.TRUE.equals(open.execute()));
            }
        } else {
            dtde.rejectDrop();
        }
    } catch (UnsupportedFlavorException | IOException ignored) {
        dtde.rejectDrop();
    }
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:20,代码来源:ProductExplorerTopComponent.java

示例10: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
@Override
public void drop(DropTargetDropEvent dtde) {
    //System.out.println("drop(DropTargetDragEvent)");
    if (dtde.getSource() != dropTarget) {
        dtde.rejectDrop();
        panel.setDropLocation(-1, null);
        return;
    }
    Point dropPoint = dtde.getLocation();
    int index = list.locationToIndex(dropPoint);
    boolean dropped = false;
    if (index == -1 || index == draggedIndex) {
        //System.out.println("dropped onto self");
        dtde.rejectDrop();
        panel.setDropLocation(-1, null);
        return;
    }
    dtde.acceptDrop(DnDConstants.ACTION_MOVE);
    //System.out.println("accepted: " + draggedIndex + "/" + index);
    panel.setDropLocation(-1, null);
    panel.moveStep(draggedIndex, index);
    dropped = true;
    dtde.dropComplete(dropped);
}
 
开发者ID:mbraeunlein,项目名称:ExtendedHodoku,代码行数:25,代码来源:ListDragAndDrop.java

示例11: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
public void drop(DropTargetDropEvent event) {
    int dropAction = event.getDropAction();
    JComponent c = (JComponent) event.getDropTargetContext().getComponent();
    DataObjectTransferHandler transferHandler = (DataObjectTransferHandler) c.getTransferHandler();

    if (canImport && (transferHandler != null) && actionSupported(dropAction)) {
        event.acceptDrop(dropAction);
        try {
            Transferable transferable = event.getTransferable();
            transferHandler.setDropPoint(event.getLocation());
            transferHandler.setDropComponent(c);
            event.dropComplete(transferHandler.importData(c, transferable));
        } catch (RuntimeException e) {
            event.dropComplete(false);
        }
    } else {
        event.rejectDrop();
    }
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:20,代码来源:DataObjectTransferHandler.java

示例12: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void drop(DropTargetDropEvent dtde) {
	if (!dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
		dtde.rejectDrop();
		return;
	}
	dtde.acceptDrop(dtde.getDropAction());
	try {
		Transferable transferable = dtde.getTransferable();
		List<File> transferData = (List<File>) transferable.getTransferData(DataFlavor.javaFileListFlavor);
		if (transferData != null && transferData.size() > 0) {
			dtde.dropComplete(true);
			// load first file
			mainWindow.openFile(transferData.get(0));
		}
	} catch (Exception e) {
		LOG.error("File drop operation failed", e);
	}
}
 
开发者ID:skylot,项目名称:jadx,代码行数:21,代码来源:MainDropTarget.java

示例13: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
public void drop(DropTargetDropEvent dtde) {
    try {
        Transferable tr = dtde.getTransferable();
        if (tr.isDataFlavorSupported(DataFlavor.stringFlavor)) {
            dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
            String data = (String) tr.getTransferData(DataFlavor.stringFlavor);
            // create the new TreeTable containing the selected dragged path
            this.addSelectedTestdirectoryToMetaCampaign(data);
            dtde.getDropTargetContext().dropComplete(true);
        } else {
            System.err.println("Rejected");
            dtde.rejectDrop();
        }
    } catch (IOException | UnsupportedFlavorException io) {
        logger.error(io);
        dtde.rejectDrop();
    }
}
 
开发者ID:qspin,项目名称:qtaste,代码行数:19,代码来源:TestCaseTree.java

示例14: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
public synchronized void drop(DropTargetDropEvent dropTargetDropEvent) {
    try {
        final Transferable transferable = dropTargetDropEvent.getTransferable();
        if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
            dropTargetDropEvent.acceptDrop(DnDConstants.ACTION_COPY);
            dropTargetDropEvent.getDropTargetContext().dropComplete(true);
        }
        else {
            dropTargetDropEvent.rejectDrop();
        }
    }
    catch (Exception ex) {
        Log.error(ex);
        dropTargetDropEvent.rejectDrop();
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:17,代码来源:FileDragLabel.java

示例15: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void drop(DropTargetDropEvent dtde) {
	try {
		Transferable t = dtde.getTransferable();
		List<File> files = null;
		if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
			dtde.acceptDrop(DnDConstants.ACTION_REFERENCE);
			files = (List<File>) t
					.getTransferData(DataFlavor.javaFileListFlavor);
		} else if (uriFlavor != null && t.isDataFlavorSupported(uriFlavor)) {
			dtde.acceptDrop(DnDConstants.ACTION_REFERENCE);
			files = textURIListToFileList((String) t
					.getTransferData(uriFlavor));
		} else
			dtde.rejectDrop();

		if (files != null && files.size() == 1) {
			openFile(files.get(0));
			dtde.dropComplete(true);
		} else
			dtde.dropComplete(false);
	} catch (UnsupportedFlavorException ex) {
		dtde.rejectDrop();
	} catch (IOException e) {
		dtde.rejectDrop();
	}
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:29,代码来源:FileDropTargetListener.java


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