Package java.awt.dnd

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


  void testNullLoc(TestHarness h)
  {
    caught = false;
    try
      {
        new DropTargetDropEvent(dtc, null, DnDConstants.ACTION_COPY,
                                DnDConstants.ACTION_COPY, false);
      }
    catch (NullPointerException npe)
      {
        caught = true;
View Full Code Here

  void testDropAction(TestHarness h)
  {
    caught = false;
    try
      {
        new DropTargetDropEvent(dtc, loc, 4, DnDConstants.ACTION_COPY, false);
      }
    catch (IllegalArgumentException iae)
      {
        caught = true;
      }
View Full Code Here

  void testSrcAction(TestHarness h)
  {
    caught = false;
    try
      {
        new DropTargetDropEvent(dtc, loc, DnDConstants.ACTION_COPY, 4,false);
      }
    catch (IllegalArgumentException iae)
      {
        caught = true;
      }
View Full Code Here

  }
 
  void testNormal(TestHarness h)
  {
    caught = false;
    DropTargetDropEvent dtde = null;
    try
      {
        dtde = new DropTargetDropEvent(dtc, loc, DnDConstants.ACTION_COPY,
                                DnDConstants.ACTION_COPY, true);
      }
    catch (Exception e)
      {
        caught = true;
      }
   
    h.check(!caught);   
    h.check(dtde != null && dtde.getDropAction() == DnDConstants.ACTION_COPY);
    h.check(dtde != null && dtde.getSourceActions() == DnDConstants.ACTION_COPY);
    h.check(dtde != null && dtde.getLocation().equals(loc));
    h.check(dtde != null && dtde.isLocalTransfer());
  }
View Full Code Here

      public void onViewCreated(Container nodeView) {
        NodeView node = (NodeView) nodeView;
        final DropTarget dropTarget = new DropTarget(node.getMainView(), new MNodeDropListener() {
          public void drop(final DropTargetDropEvent dtde) {
            DropTargetDropEvent evt = dtde;
            if(dtde.getTransferable().isDataFlavorSupported(WorkspaceTransferable.WORKSPACE_NODE_FLAVOR)) {
              evt = new DropTargetDropEvent(dtde.getDropTargetContext(), dtde.getLocation(), dtde.getDropAction(), dtde.getSourceActions(), false);
            }
            super.drop(evt);
          }
        });
        dropTarget.setActive(true);
View Full Code Here

            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

                    + " 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

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

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

            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

TOP

Related Classes of java.awt.dnd.DropTargetDropEvent

Copyright © 2018 www.massapicom. 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.