List of usage examples for java.awt.dnd DropTargetDragEvent acceptDrag
public void acceptDrag(int dragOperation)
From source file:com.igormaznitsa.sciareto.ui.editors.MMDEditor.java
@Override public void dragOver(@Nonnull final DropTargetDragEvent dtde) { if (acceptOrRejectDragging(dtde)) { dtde.acceptDrag(DnDConstants.ACTION_MOVE); } else {/* www . ja v a 2s . com*/ dtde.rejectDrag(); } repaint(); }
From source file:com.mirth.connect.client.ui.components.MirthTree.java
public void dragEnter(DropTargetDragEvent dtde) { try {//w w w.j a va2 s.c o m Transferable tr = dtde.getTransferable(); if (parent.currentContentPage == parent.channelEditPanel.transformerPane && tr.isDataFlavorSupported(supportedDropFlavor)) { dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE); } else { dtde.rejectDrag(); } } catch (Exception e) { dtde.rejectDrag(); } }
From source file:de.tor.tribes.ui.algo.AttackTimePanel.java
@Override public void dragEnter(DropTargetDragEvent dtde) { if (dtde.getDropTargetContext().getComponent().equals(jTimeFrameList)) { dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE); }//from ww w .j a v a2s . c om }
From source file:de.tor.tribes.ui.algo.AttackTimePanel.java
@Override public void dragOver(DropTargetDragEvent dtde) { if (dtde.getDropTargetContext().getComponent().equals(jTimeFrameList)) { dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE); }/*from www. j av a 2s . com*/ }
From source file:com.qspin.qtaste.ui.TestCaseTree.java
public void dragEnter(DropTargetDragEvent dtde) { dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE); }
From source file:PanelDropTarget.java
protected boolean acceptOrRejectDrag(DropTargetDragEvent dtde) { int dropAction = dtde.getDropAction(); int sourceActions = dtde.getSourceActions(); boolean acceptedDrag = false; DnDUtils.debugPrintln("\tSource actions are " + DnDUtils.showActions(sourceActions) + ", drop action is " + DnDUtils.showActions(dropAction)); // Reject if the object being transferred // or the operations available are not acceptable. if (!acceptableType || (sourceActions & DnDConstants.ACTION_COPY_OR_MOVE) == 0) { DnDUtils.debugPrintln("Drop target rejecting drag"); dtde.rejectDrag();/*from www . j a va 2s .co m*/ } else if ((dropAction & DnDConstants.ACTION_COPY_OR_MOVE) == 0) { // Not offering copy or move - suggest a copy DnDUtils.debugPrintln("Drop target offering COPY"); dtde.acceptDrag(DnDConstants.ACTION_COPY); acceptedDrag = true; } else { // Offering an acceptable operation: accept DnDUtils.debugPrintln("Drop target accepting drag"); dtde.acceptDrag(dropAction); acceptedDrag = true; } return acceptedDrag; }
From source file:com.igormaznitsa.sciareto.ui.editors.MMDEditor.java
@Override public void dragEnter(@Nonnull final DropTargetDragEvent dtde) { this.dragAcceptableType = checkDragType(dtde); if (!this.dragAcceptableType) { dtde.rejectDrag();/*from w w w.ja v a 2 s . c o m*/ } else { dtde.acceptDrag(DnDConstants.ACTION_MOVE); } repaint(); }
From source file:EditorDropTarget2.java
protected boolean acceptOrRejectDrag(DropTargetDragEvent dtde) { int dropAction = dtde.getDropAction(); int sourceActions = dtde.getSourceActions(); boolean acceptedDrag = false; DnDUtils.debugPrintln("\tSource actions are " + DnDUtils.showActions(sourceActions) + ", drop action is " + DnDUtils.showActions(dropAction)); // Reject if the object being transferred // or the operations available are not acceptable if (!acceptableType || (sourceActions & DnDConstants.ACTION_COPY_OR_MOVE) == 0) { DnDUtils.debugPrintln("Drop target rejecting drag"); dtde.rejectDrag();// w ww .j a v a 2 s .com } else if (!draggingFile && !pane.isEditable()) { // Can't drag text to a read-only JEditorPane DnDUtils.debugPrintln("Drop target rejecting drag"); dtde.rejectDrag(); } else if ((dropAction & DnDConstants.ACTION_COPY_OR_MOVE) == 0) { // Not offering copy or move - suggest a copy DnDUtils.debugPrintln("Drop target offering COPY"); dtde.acceptDrag(DnDConstants.ACTION_COPY); acceptedDrag = true; } else { // Offering an acceptable operation: accept DnDUtils.debugPrintln("Drop target accepting drag"); dtde.acceptDrag(dropAction); acceptedDrag = true; } return acceptedDrag; }
From source file:EditorDropTarget4.java
protected boolean acceptOrRejectDrag(DropTargetDragEvent dtde) { int dropAction = dtde.getDropAction(); int sourceActions = dtde.getSourceActions(); boolean acceptedDrag = false; DnDUtils.debugPrintln("\tSource actions are " + DnDUtils.showActions(sourceActions) + ", drop action is " + DnDUtils.showActions(dropAction)); // Reject if the object being transferred // or the operations available are not acceptable. if (!acceptableType || (sourceActions & DnDConstants.ACTION_COPY_OR_MOVE) == 0) { DnDUtils.debugPrintln("Drop target rejecting drag"); dtde.rejectDrag();//from www.j av a 2 s . c o m } else if (!draggingFile && !pane.isEditable()) { // Can't drag text to a read-only JEditorPane DnDUtils.debugPrintln("Drop target rejecting drag"); dtde.rejectDrag(); } else if ((dropAction & DnDConstants.ACTION_COPY_OR_MOVE) == 0) { // Not offering copy or move - suggest a copy DnDUtils.debugPrintln("Drop target offering COPY"); dtde.acceptDrag(DnDConstants.ACTION_COPY); acceptedDrag = true; } else { // Offering an acceptable operation: accept DnDUtils.debugPrintln("Drop target accepting drag"); dtde.acceptDrag(dropAction); acceptedDrag = true; } return acceptedDrag; }
From source file:com.mirth.connect.client.ui.editors.filter.FilterPane.java
public void dragEnter(DropTargetDragEvent dtde) { try {/*from w w w . j a va2s .c om*/ Transferable tr = dtde.getTransferable(); if (tr.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE); List fileList = (List) tr.getTransferData(DataFlavor.javaFileListFlavor); Iterator iterator = fileList.iterator(); if (iterator.hasNext() && fileList.size() == 1) { String fileName = ((File) iterator.next()).getName(); if (!fileName.substring(fileName.lastIndexOf(".")).equalsIgnoreCase(".xml")) { dtde.rejectDrag(); } } else { dtde.rejectDrag(); } } else if (tr.isDataFlavorSupported(TreeTransferable.RULE_DATA_FLAVOR)) { dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE); } else { dtde.rejectDrag(); } } catch (Exception e) { dtde.rejectDrag(); } }