Examples of DropTargetDropEvent


Examples of java.awt.dnd.DropTargetDropEvent

            dataObject = new WinDataTransfer.IDataObject(dataObjectPtr);
            DataSnapshot snapshot = new DataSnapshot(dataObject);
            transferable = new DataProxy(snapshot);
        }

        DropTargetDropEvent e = new DropTargetDropEvent(
                context, new Point(x, y),
                WinDragSource.getDndActions(userAction),
                WinDragSource.getDndActions(sourceActions));
       
        int ret = dispatchEvent(e, DRAG_DROP);
View Full Code Here

Examples of java.awt.dnd.DropTargetDropEvent

                dropAction = e.getDropAction();
                break;
            }
            case DRAG_DROP:
            {
                DropTargetDropEvent e = (DropTargetDropEvent)currentEvent;
                context.getDropTarget().drop(e);
                dropAction = e.getDropAction();
                break;
            }
            case DRAG_LEAVE:
            {
                context.getDropTarget().dragExit(currentEvent);
View Full Code Here

Examples of java.awt.dnd.DropTargetDropEvent

        AbstractComponent mockCanvasComponent = new TestComponent();
        AbstractComponent mockDropComponent = new TestComponent();
        CanvasManifestation canvas = new CanvasManifestation(mockCanvasComponent, mockCanvasViewInfo);
        DropTarget dt = canvas.getDropTarget();
       
        DropTargetDropEvent mockDTDE = Mockito.mock(DropTargetDropEvent.class);
        Transferable mockTransferable = Mockito.mock(Transferable.class);
        View[] mockViews = { Mockito.mock(View.class) };
       
        Mockito.when(mockViews[0].getManifestedComponent()).thenReturn(mockDropComponent);
        Mockito.when(mockViews[0].getInfo()).thenReturn(mockCanvasViewInfo);
        Mockito.when(mockPersistence.getComponent(Mockito.anyString())).thenReturn(mockDropComponent);
        Mockito.when(mockDTDE.getTransferable()).thenReturn(mockTransferable);
        Mockito.when(mockTransferable.isDataFlavorSupported(View.DATA_FLAVOR)).thenReturn(true);
        Mockito.when(mockDTDE.getLocation()).thenReturn(new Point(0,0));
        Mockito.when(mockTransferable.getTransferData(View.DATA_FLAVOR)).thenReturn(mockViews);
       
        dt.drop(mockDTDE);
    }
View Full Code Here

Examples of java.awt.dnd.DropTargetDropEvent

    private TransferSupport createPasteTransferSupport(Component comp, Transferable transferable) {
        return new TransferSupport(comp, transferable);
    }
   
    private TransferSupport createDropTransferSupport(Component comp, Transferable transferable, DataFlavor[] flavors) throws Exception {
        DropTargetDropEvent event = mock(DropTargetDropEvent.class);
        when(event.getTransferable()).thenReturn(transferable);
        when(event.getCurrentDataFlavors()).thenReturn(flavors);
        when(event.getLocation()).thenReturn(new Point(0,0));
       
        Constructor<TransferSupport> constructor = TransferSupport.class.getDeclaredConstructor(Component.class, DropTargetEvent.class);
        constructor.setAccessible(true);
        return constructor.newInstance(comp, event);
    }
View Full Code Here

Examples of java.awt.dnd.DropTargetDropEvent

            dataObject = new WinDataTransfer.IDataObject(dataObjectPtr);
            DataSnapshot snapshot = new DataSnapshot(dataObject);
            transferable = new DataProxy(snapshot);
        }

        DropTargetDropEvent e = new DropTargetDropEvent(
                context, new Point(x, y),
                WinDragSource.getDndActions(userAction),
                WinDragSource.getDndActions(sourceActions));
       
        int ret = dispatchEvent(e, DRAG_DROP);
View Full Code Here

Examples of java.awt.dnd.DropTargetDropEvent

                dropAction = e.getDropAction();
                break;
            }
            case DRAG_DROP:
            {
                DropTargetDropEvent e = (DropTargetDropEvent)currentEvent;
                context.getDropTarget().drop(e);
                dropAction = e.getDropAction();
                break;
            }
            case DRAG_LEAVE:
            {
                context.getDropTarget().dragExit(currentEvent);
View Full Code Here

Examples of java.awt.dnd.DropTargetDropEvent

            // Set transferable
            try {
                // XXX Java 1.3 and 1.4 workaround for:
                // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4378091
                Transferable transferable =
                    new DropTargetDropEvent(dtde.getDropTargetContext(),
                                            dtde.getLocation(), 0, 0)
                        .getTransferable();
                // Transferable transferable = dtde.getTransferable();
                DataFlavor[] flavors = transferable.getTransferDataFlavors();
                for (int i = 0; i < flavors.length; i++) {
View Full Code Here

Examples of java.awt.dnd.DropTargetDropEvent

                if ((local = getJVMLocalSourceTransferable()) != null)
                    setCurrentJVMLocalSourceTransferable(null);
            }

            try {
                ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
                                                                      hots,
                                                                      currentDA,
                                                                      currentSA,
                                                                      local != null));
            } finally {
View Full Code Here

Examples of java.awt.dnd.DropTargetDropEvent

            sourceActions = ev.getSourceActions();
            flavors = ev.getCurrentDataFlavors();
            location = ev.getLocation();
        }
        else if (e instanceof DropTargetDropEvent) {
            DropTargetDropEvent ev = (DropTargetDropEvent)e;
            currentAction = ev.getDropAction();
            sourceActions = ev.getSourceActions();
            flavors = ev.getCurrentDataFlavors();
            location = ev.getLocation();
        }
        if (isSupported(flavors)) {
            int availableActions = getDropActionsForFlavors(flavors);
            currentAction = getDropAction(e, currentAction, sourceActions, availableActions);
            if (currentAction != DragHandler.NONE) {
View Full Code Here

Examples of java.awt.dnd.DropTargetDropEvent

                    + " act=" + DragHandler.actionString(ev.getDropAction());
            }
            else if (e instanceof DropTargetDropEvent) {
                DropTargetContext dtc = e.getDropTargetContext();
                DropTarget dt = dtc.getDropTarget();
                DropTargetDropEvent ev = (DropTargetDropEvent)e;
                msg += ": src=" + DragHandler.actionString(ev.getSourceActions())
                + " tgt=" + DragHandler.actionString(dt.getDefaultActions())
                + " act=" + DragHandler.actionString(ev.getDropAction());
            }
            if (!msg.equals(lastAction)) {
                System.out.println(lastAction = msg);
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.