Java 类java.awt.dnd.DropTargetContext 实例源码

项目:Push2Display    文件:DOMDocumentTree.java   
/**
 * Sets the position indicator according to the current cursor location.
 *
 * @param dtde
 *            DropTargetDragEvent
 */
private void updatePositionIndicator(DropTargetDragEvent dtde) {
    Point p = dtde.getLocation();
    DropTargetContext dtc = dtde.getDropTargetContext();
    JTree tree = (JTree) dtc.getComponent();
    // Current path
    TreePath currentPath = tree.getPathForLocation(p.x, p.y);
    Rectangle bounds = tree.getPathBounds(currentPath);
    // Upper area of the tree node
    if (p.y <= bounds.y + visualTipOffset) {
        positionIndicator = BEFORE;
    }
    // Lower area of the tree node
    else if (p.y >= bounds.y + bounds.height - visualTipOffset) {
        positionIndicator = AFTER;
    }
    // Somewhere between the upper and the lower area of the tree node
    else {
        positionIndicator = CURRENT;
    }
}
项目:Push2Display    文件:DOMDocumentTree.java   
/**
 * Sets the position indicator according to the current cursor location.
 *
 * @param dtde
 *            DropTargetDragEvent
 */
private void updatePositionIndicator(DropTargetDragEvent dtde) {
    Point p = dtde.getLocation();
    DropTargetContext dtc = dtde.getDropTargetContext();
    JTree tree = (JTree) dtc.getComponent();
    // Current path
    TreePath currentPath = tree.getPathForLocation(p.x, p.y);
    Rectangle bounds = tree.getPathBounds(currentPath);
    // Upper area of the tree node
    if (p.y <= bounds.y + visualTipOffset) {
        positionIndicator = BEFORE;
    }
    // Lower area of the tree node
    else if (p.y >= bounds.y + bounds.height - visualTipOffset) {
        positionIndicator = AFTER;
    }
    // Somewhere between the upper and the lower area of the tree node
    else {
        positionIndicator = CURRENT;
    }
}
项目:marathonv5    文件:DnDHandler.java   
private DropTargetContext createDropTargetContext() throws SecurityException, NoSuchMethodException, IllegalArgumentException,
        InstantiationException, IllegalAccessException, InvocationTargetException {
    Constructor<DropTargetContext> c = DropTargetContext.class.getDeclaredConstructor(DropTarget.class);
    c.setAccessible(true);
    DropTargetContext inst = c.newInstance(dest.getDropTarget());
    inst.addNotify(createDropTargetContextPeer());
    return inst;
}
项目:Push2Display    文件:DOMDocumentTree.java   
public void drop(DropTargetDropEvent dtde) {
    Point p = dtde.getLocation();
    DropTargetContext dtc = dtde.getDropTargetContext();
    JTree tree = (JTree) dtc.getComponent();
    // Sets the original glass pane
    setOriginalGlassPane(tree);
    // Cancel tree item expanding
    dragOverTreePath = null;
    // Get the parent and sibling paths and nodes
    TreePath currentPath = tree.getPathForLocation(p.x, p.y);
    DefaultMutableTreeNode parent =
        (DefaultMutableTreeNode) getNodeForPath
            (getParentPathForPosition(currentPath));
    Node dropTargetNode = getDomNodeFromTreeNode(parent);
    DefaultMutableTreeNode sibling =
        (DefaultMutableTreeNode)
            getNodeForPath(getSiblingPathForPosition(currentPath));
    Node siblingNode = getDomNodeFromTreeNode(sibling);
    if (this.transferData != null) {
        ArrayList nodelist =
            getNodeListForParent(this.transferData.getNodeList(),
                                 dropTargetNode);
        fireDropCompleted
            (new DOMDocumentTreeEvent
                (new DropCompletedInfo
                    (dropTargetNode, siblingNode, nodelist)));
        dtde.dropComplete(true);
        return;
    }
    dtde.rejectDrop();
}
项目:Push2Display    文件:DOMDocumentTree.java   
/**
 * Gets the TreeNode from the DropTargetDragEvent
 *
 * @param dtde
 *            The DropTargetDragEvent
 * @return Associated TreeNode or null
 */
private TreeNode getNode(DropTargetDragEvent dtde) {
    Point p = dtde.getLocation();
    DropTargetContext dtc = dtde.getDropTargetContext();
    JTree tree = (JTree) dtc.getComponent();
    TreePath path = tree.getPathForLocation(p.x, p.y);
    if (path == null || path.getLastPathComponent() == null) {
        return null;
    }
    return (TreeNode) path.getLastPathComponent();
}
项目:bigtable-sql    文件:DropedFileExtractor.java   
private static List<File> _getFiles(DropTargetDropEvent dtde, IApplication app, boolean allowMoreThanOneFile)
{
   try
   {
      DropTargetContext context = dtde.getDropTargetContext();
      dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
      Transferable t = dtde.getTransferable();
      List<File> filesToOpen = new ArrayList<File>();

      if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
          filesToOpen = handleJavaFileListFlavor(t, app, allowMoreThanOneFile);
      } else if (t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
          filesToOpen = handleStringFlavor(t, app, allowMoreThanOneFile);
      } else {
          filesToOpen = handleUriListFlavor(t);
      }
      context.dropComplete(true);

      if (null != filesToOpen)
      {
         return filesToOpen;
      }
      else
      {
         return new ArrayList<File>();
      }
   }
   catch (Exception e)
   {
      throw new RuntimeException(e);
   }
}
项目:mobac    文件:DragDropController.java   
public synchronized void drop(DropTargetDropEvent dtde) {
    try {
        TreeNode sourceNode = (TreeNode) dtde.getTransferable().getTransferData(
                NodeTransferWrapper.ATLAS_OBJECT_FLAVOR);

        Point pt = dtde.getLocation();
        DropTargetContext dtc = dtde.getDropTargetContext();
        JTree tree = (JTree) dtc.getComponent();
        TreePath parentpath = tree.getClosestPathForLocation(pt.x, pt.y);
        TreeNode targetNode = (TreeNode) parentpath.getLastPathComponent();

        if (targetNode.equals(sourceNode) || targetNode.getParent().equals(sourceNode)) {
            dtde.rejectDrop();
            return;
        }
        AtlasTreeModel atlasTreeModel = (AtlasTreeModel) atlasTree.getModel();
        if (sourceNode instanceof LayerInterface && targetNode instanceof LayerInterface)
            mergeLayers(atlasTreeModel, (LayerInterface) sourceNode,
                    (LayerInterface) targetNode);

        if (targetNode instanceof MapInterface)
            // We can not make a map child of another map
            // -> use it's layer instead
            targetNode = targetNode.getParent();

        if (sourceNode instanceof MapInterface && targetNode instanceof LayerInterface)
            moveMap(atlasTreeModel, (MapInterface) sourceNode, (LayerInterface) targetNode);

    } catch (Exception e) {
        log.error("", e);
        atlasTree.getTreeModel().notifyStructureChanged();
        dtde.rejectDrop();
    }
}
项目:mobac    文件:DragDropController.java   
private TreeNode getNodeForEvent(DropTargetDragEvent dtde) {
    Point p = dtde.getLocation();
    DropTargetContext dtc = dtde.getDropTargetContext();
    JTree tree = (JTree) dtc.getComponent();
    TreePath path = tree.getClosestPathForLocation(p.x, p.y);
    return (TreeNode) path.getLastPathComponent();
}
项目:Push2Display    文件:DOMDocumentTree.java   
public void drop(DropTargetDropEvent dtde) {
    Point p = dtde.getLocation();
    DropTargetContext dtc = dtde.getDropTargetContext();
    JTree tree = (JTree) dtc.getComponent();
    // Sets the original glass pane
    setOriginalGlassPane(tree);
    // Cancel tree item expanding
    dragOverTreePath = null;
    // Get the parent and sibling paths and nodes
    TreePath currentPath = tree.getPathForLocation(p.x, p.y);
    DefaultMutableTreeNode parent =
        (DefaultMutableTreeNode) getNodeForPath
            (getParentPathForPosition(currentPath));
    Node dropTargetNode = getDomNodeFromTreeNode(parent);
    DefaultMutableTreeNode sibling =
        (DefaultMutableTreeNode)
            getNodeForPath(getSiblingPathForPosition(currentPath));
    Node siblingNode = getDomNodeFromTreeNode(sibling);
    if (this.transferData != null) {
        ArrayList nodelist =
            getNodeListForParent(this.transferData.getNodeList(),
                                 dropTargetNode);
        fireDropCompleted
            (new DOMDocumentTreeEvent
                (new DropCompletedInfo
                    (dropTargetNode, siblingNode, nodelist)));
        dtde.dropComplete(true);
        return;
    }
    dtde.rejectDrop();
}
项目:Push2Display    文件:DOMDocumentTree.java   
/**
 * Gets the TreeNode from the DropTargetDragEvent
 *
 * @param dtde
 *            The DropTargetDragEvent
 * @return Associated TreeNode or null
 */
private TreeNode getNode(DropTargetDragEvent dtde) {
    Point p = dtde.getLocation();
    DropTargetContext dtc = dtde.getDropTargetContext();
    JTree tree = (JTree) dtc.getComponent();
    TreePath path = tree.getPathForLocation(p.x, p.y);
    if (path == null || path.getLastPathComponent() == null) {
        return null;
    }
    return (TreeNode) path.getLastPathComponent();
}
项目:triple-triad-ai    文件:CardDropHandler.java   
@Override
public void drop(DropTargetDropEvent dtde)
{
    if (dtde.isDataFlavorSupported(CardFlavor.cardFlavor) && this.canDrop)
    {
        Transferable trans = dtde.getTransferable();
        try
        {
            Object data = trans.getTransferData(CardFlavor.cardFlavor);
            CardWindow card =(CardWindow)data;
            DropTargetContext context = dtde.getDropTargetContext();
            CardCollection comp = (CardCollection)context.getComponent();
            Container parent = comp.getParent();
            GameController.getController(false)
                .makeMove(CardCollection.getMoveFromIndex(comp.getCardMouseLocation(), new OrderedCard(card.card, card.cardLocation)));
            if (parent != null)
                parent.remove(card);
            comp.setCard(card, comp.getCardMouseLocation());
            dtde.acceptDrop(DnDConstants.ACTION_MOVE);
            comp.validate();
            comp.repaint();

            dtde.dropComplete(true);
        }
        catch (Exception e)
        {
            dtde.rejectDrop();
            dtde.dropComplete(false);
            JOptionPane.showMessageDialog(MainWindow.getMainWindow(), "Invalid move.", "Invalid Move Error", JOptionPane.ERROR_MESSAGE);
            e.printStackTrace();
        }
    }
    else
    {
        dtde.rejectDrop();
        dtde.dropComplete(false);
        JOptionPane.showMessageDialog(MainWindow.getMainWindow(), "Invalid move.", "Invalid Move Error", JOptionPane.ERROR_MESSAGE);
    }
}
项目:cn1    文件:WinDropTarget.java   
public WinDropTarget(WinDTK dtk, DropTargetContext context) {
    this.dtk = dtk;
    this.context = context;

    ComponentInternals ci = ComponentInternals.getComponentInternals();
    NativeWindow w = ci.getNativeWindow(context.getComponent());
    hwnd = w.getId();
    dropTargetPtr = registerDropTarget();
}
项目:freeVM    文件:WinDropTarget.java   
public WinDropTarget(WinDTK dtk, DropTargetContext context) {
    this.dtk = dtk;
    this.context = context;

    ComponentInternals ci = ComponentInternals.getComponentInternals();
    NativeWindow w = ci.getNativeWindow(context.getComponent());
    hwnd = w.getId();
    dropTargetPtr = registerDropTarget();
}
项目:freeVM    文件:WinDropTarget.java   
public WinDropTarget(WinDTK dtk, DropTargetContext context) {
    this.dtk = dtk;
    this.context = context;

    ComponentInternals ci = ComponentInternals.getComponentInternals();
    NativeWindow w = ci.getNativeWindow(context.getComponent());
    hwnd = w.getId();
    dropTargetPtr = registerDropTarget();
}
项目:vbrowser    文件:ResourceTreeDropTarget.java   
/** Drop On Node ! */ 

   public void drop(DropTargetDropEvent dtde)
   {
       // Global.debugPrintln(this,"Dropping:"+dtde); 

    DropTargetContext dtc = dtde.getDropTargetContext();
    Component comp = dtc.getComponent();
    Point p=dtde.getLocation();
    Transferable data = dtde.getTransferable();

    ResourceTreeNode rtnode = getRTNode(comp,p); 

    // check dropped data: 
    if (VTransferData.canConvertToVRLs(data))
    {
         // I: accept drop: 
           dtde.acceptDrop (DnDConstants.ACTION_COPY_OR_MOVE);

        // supply ResourceTree as (J)Component but TreeNode as VComponent ! 
        VTransferHandler.getDefault().interActiveDrop(comp,rtnode,p,data);
           // III: complete the drag ! 
           dtde.getDropTargetContext().dropComplete(true);
    }
    else
        dtde.rejectDrop(); 

   }
项目:vbrowser    文件:NodeDropTarget.java   
public void drop(DropTargetDropEvent dtde)
{
    //UIGlobal.debugPrintf(this,"drop:%s\n",dtde);

    DropTargetContext dtc = dtde.getDropTargetContext();
    Component comp = dtc.getComponent();
    Point p=dtde.getLocation();

    // II : get data: 
    Transferable data = dtde.getTransferable();

    // check dropped data: 
    if (VTransferData.canConvertToVRLs(data))
    {
        // I: accept drop: 
       dtde.acceptDrop (DnDConstants.ACTION_COPY_OR_MOVE);

        // Implementation now in VTransferHandler: 
        VTransferHandler.getDefault().interActiveDrop(comp,p,data); 

        // III: complete the drag ! 
        dtde.getDropTargetContext().dropComplete(true);
    }
    else
    {
        dtde.rejectDrop(); 
    }

}
项目:incubator-netbeans    文件:WidgetAction.java   
/**
 * @see DropTargetDragEvent
 */
public DropTargetContext getDropTargetContext () {
    return event.getDropTargetContext ();
}
项目:incubator-netbeans    文件:WidgetAction.java   
/**
 * @see DropTargetDropEvent
 */
public DropTargetContext getDropTargetContext () {
    return event.getDropTargetContext ();
}
项目:incubator-netbeans    文件:WidgetAction.java   
/**
 * @see DropTargetEvent
 */
public DropTargetContext getDropTargetContext () {
    return event.getDropTargetContext ();
}
项目:OpenJSharp    文件:SunDropTargetContextPeer.java   
/**
 *
 */

protected void processExitMessage(SunDropTargetEvent event) {
    Component         c   = (Component)event.getSource();
    DropTarget        dt  = c.getDropTarget();
    DropTargetContext dtc = null;

    if (dt == null) {
        currentDT = null;
        currentT  = null;

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDTC = null;

        return;
    }

    if (dt != currentDT) {

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDT  = dt;
        currentDTC = dt.getDropTargetContext();

        currentDTC.addNotify(this);
    }

    dtc = currentDTC;

    if (dt.isActive()) try {
        ((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc));
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        currentA  = DnDConstants.ACTION_NONE;
        currentSA = DnDConstants.ACTION_NONE;
        currentDA = DnDConstants.ACTION_NONE;
        currentDT = null;
        currentT  = null;

        currentDTC.removeNotify();
        currentDTC = null;

        local = null;

        dragRejected = false;
    }
}
项目:OpenJSharp    文件:SunDropTargetContextPeer.java   
/**
 *
 */

protected void processMotionMessage(SunDropTargetEvent event,
                                  boolean operationChanged) {
    Component         c    = (Component)event.getSource();
    Point             hots = event.getPoint();
    int               id   = event.getID();
    DropTarget        dt   = c.getDropTarget();
    DropTargetContext dtc  = null;

    if (c.isShowing() && (dt != null) && dt.isActive()) {
        if (currentDT != dt) {
            if (currentDTC != null) {
                currentDTC.removeNotify();
            }

            currentDT  = dt;
            currentDTC = null;
        }

        dtc = currentDT.getDropTargetContext();
        if (dtc != currentDTC) {
            if (currentDTC != null) {
                currentDTC.removeNotify();
            }

            currentDTC = dtc;
            currentDTC.addNotify(this);
        }

        currentA = currentDT.getDefaultActions();

        try {
            DropTargetDragEvent dtde = new DropTargetDragEvent(dtc,
                                                               hots,
                                                               currentDA,
                                                               currentSA);
            DropTargetListener dtl = (DropTargetListener)dt;
            if (operationChanged) {
                dtl.dropActionChanged(dtde);
            } else {
                dtl.dragOver(dtde);
            }

            if (dragRejected) {
                currentDA = DnDConstants.ACTION_NONE;
            }
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDA = DnDConstants.ACTION_NONE;
    }
}
项目:OpenJSharp    文件:SunDropTargetContextPeer.java   
/**
 *
 */

protected void processDropMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    Point      hots = event.getPoint();
    DropTarget dt   = c.getDropTarget();

    dropStatus   = STATUS_WAIT; // drop pending ACK
    dropComplete = false;

    if (c.isShowing() && dt != null && dt.isActive()) {
        DropTargetContext dtc = dt.getDropTargetContext();

        currentDT = dt;

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDTC = dtc;
        currentDTC.addNotify(this);
        currentA = dt.getDefaultActions();

        synchronized(_globalLock) {
            if ((local = getJVMLocalSourceTransferable()) != null)
                setCurrentJVMLocalSourceTransferable(null);
        }

        dropInProcess = true;

        try {
            ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
                                                                  hots,
                                                                  currentDA,
                                                                  currentSA,
                                                                  local != null));
        } finally {
            if (dropStatus == STATUS_WAIT) {
                rejectDrop();
            } else if (dropComplete == false) {
                dropComplete(false);
            }
            dropInProcess = false;
        }
    } else {
        rejectDrop();
    }
}
项目:jdk8u-jdk    文件:SunDropTargetContextPeer.java   
/**
 *
 */

protected void processExitMessage(SunDropTargetEvent event) {
    Component         c   = (Component)event.getSource();
    DropTarget        dt  = c.getDropTarget();
    DropTargetContext dtc = null;

    if (dt == null) {
        currentDT = null;
        currentT  = null;

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDTC = null;

        return;
    }

    if (dt != currentDT) {

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDT  = dt;
        currentDTC = dt.getDropTargetContext();

        currentDTC.addNotify(this);
    }

    dtc = currentDTC;

    if (dt.isActive()) try {
        ((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc));
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        currentA  = DnDConstants.ACTION_NONE;
        currentSA = DnDConstants.ACTION_NONE;
        currentDA = DnDConstants.ACTION_NONE;
        currentDT = null;
        currentT  = null;

        currentDTC.removeNotify();
        currentDTC = null;

        local = null;

        dragRejected = false;
    }
}
项目:jdk8u-jdk    文件:SunDropTargetContextPeer.java   
/**
 *
 */

protected void processMotionMessage(SunDropTargetEvent event,
                                  boolean operationChanged) {
    Component         c    = (Component)event.getSource();
    Point             hots = event.getPoint();
    int               id   = event.getID();
    DropTarget        dt   = c.getDropTarget();
    DropTargetContext dtc  = null;

    if (c.isShowing() && (dt != null) && dt.isActive()) {
        if (currentDT != dt) {
            if (currentDTC != null) {
                currentDTC.removeNotify();
            }

            currentDT  = dt;
            currentDTC = null;
        }

        dtc = currentDT.getDropTargetContext();
        if (dtc != currentDTC) {
            if (currentDTC != null) {
                currentDTC.removeNotify();
            }

            currentDTC = dtc;
            currentDTC.addNotify(this);
        }

        currentA = currentDT.getDefaultActions();

        try {
            DropTargetDragEvent dtde = new DropTargetDragEvent(dtc,
                                                               hots,
                                                               currentDA,
                                                               currentSA);
            DropTargetListener dtl = (DropTargetListener)dt;
            if (operationChanged) {
                dtl.dropActionChanged(dtde);
            } else {
                dtl.dragOver(dtde);
            }

            if (dragRejected) {
                currentDA = DnDConstants.ACTION_NONE;
            }
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDA = DnDConstants.ACTION_NONE;
    }
}
项目:jdk8u-jdk    文件:SunDropTargetContextPeer.java   
/**
 *
 */

protected void processDropMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    Point      hots = event.getPoint();
    DropTarget dt   = c.getDropTarget();

    dropStatus   = STATUS_WAIT; // drop pending ACK
    dropComplete = false;

    if (c.isShowing() && dt != null && dt.isActive()) {
        DropTargetContext dtc = dt.getDropTargetContext();

        currentDT = dt;

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDTC = dtc;
        currentDTC.addNotify(this);
        currentA = dt.getDefaultActions();

        synchronized(_globalLock) {
            if ((local = getJVMLocalSourceTransferable()) != null)
                setCurrentJVMLocalSourceTransferable(null);
        }

        dropInProcess = true;

        try {
            ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
                                                                  hots,
                                                                  currentDA,
                                                                  currentSA,
                                                                  local != null));
        } finally {
            if (dropStatus == STATUS_WAIT) {
                rejectDrop();
            } else if (dropComplete == false) {
                dropComplete(false);
            }
            dropInProcess = false;
        }
    } else {
        rejectDrop();
    }
}
项目:openjdk-jdk10    文件:SunDropTargetContextPeer.java   
/**
 *
 */

protected void processExitMessage(SunDropTargetEvent event) {
    Component         c   = (Component)event.getSource();
    DropTarget        dt  = c.getDropTarget();
    DropTargetContext dtc = null;
    DropTargetContextAccessor acc =
            AWTAccessor.getDropTargetContextAccessor();

    if (dt == null) {
        currentDT = null;
        currentT  = null;

        if (currentDTC != null) {
            acc.reset(currentDTC);
        }

        currentDTC = null;

        return;
    }

    if (dt != currentDT) {

        if (currentDTC != null) {
            acc.reset(currentDTC);
        }

        currentDT  = dt;
        currentDTC = dt.getDropTargetContext();

        acc.setDropTargetContextPeer(currentDTC, this);
    }

    dtc = currentDTC;

    if (dt.isActive()) try {
        ((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc));
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        currentA  = DnDConstants.ACTION_NONE;
        currentSA = DnDConstants.ACTION_NONE;
        currentDA = DnDConstants.ACTION_NONE;
        currentDT = null;
        currentT  = null;

        acc.reset(currentDTC);
        currentDTC = null;

        local = null;

        dragRejected = false;
    }
}
项目:openjdk-jdk10    文件:SunDropTargetContextPeer.java   
/**
 *
 */

protected void processMotionMessage(SunDropTargetEvent event,
                                  boolean operationChanged) {
    Component         c    = (Component)event.getSource();
    Point             hots = event.getPoint();
    int               id   = event.getID();
    DropTarget        dt   = c.getDropTarget();
    DropTargetContext dtc  = null;
    DropTargetContextAccessor acc =
            AWTAccessor.getDropTargetContextAccessor();

    if (c.isShowing() && (dt != null) && dt.isActive()) {
        if (currentDT != dt) {
            if (currentDTC != null) {
                acc.reset(currentDTC);
            }

            currentDT  = dt;
            currentDTC = null;
        }

        dtc = currentDT.getDropTargetContext();
        if (dtc != currentDTC) {
            if (currentDTC != null) {
                acc.reset(currentDTC);
            }

            currentDTC = dtc;
            acc.setDropTargetContextPeer(currentDTC, this);
        }

        currentA = currentDT.getDefaultActions();

        try {
            DropTargetDragEvent dtde = new DropTargetDragEvent(dtc,
                                                               hots,
                                                               currentDA,
                                                               currentSA);
            DropTargetListener dtl = (DropTargetListener)dt;
            if (operationChanged) {
                dtl.dropActionChanged(dtde);
            } else {
                dtl.dragOver(dtde);
            }

            if (dragRejected) {
                currentDA = DnDConstants.ACTION_NONE;
            }
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDA = DnDConstants.ACTION_NONE;
    }
}
项目:openjdk-jdk10    文件:SunDropTargetContextPeer.java   
/**
 *
 */

protected void processDropMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    Point      hots = event.getPoint();
    DropTarget dt   = c.getDropTarget();

    dropStatus   = STATUS_WAIT; // drop pending ACK
    dropComplete = false;

    if (c.isShowing() && dt != null && dt.isActive()) {
        DropTargetContext dtc = dt.getDropTargetContext();

        currentDT = dt;
        DropTargetContextAccessor acc =
                AWTAccessor.getDropTargetContextAccessor();

        if (currentDTC != null) {
            acc.reset(currentDTC);
        }

        currentDTC = dtc;
        acc.setDropTargetContextPeer(currentDTC, this);
        currentA = dt.getDefaultActions();

        synchronized(_globalLock) {
            if ((local = getJVMLocalSourceTransferable()) != null)
                setCurrentJVMLocalSourceTransferable(null);
        }

        dropInProcess = true;

        try {
            ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
                                                                  hots,
                                                                  currentDA,
                                                                  currentSA,
                                                                  local != null));
        } finally {
            if (dropStatus == STATUS_WAIT) {
                rejectDrop();
            } else if (dropComplete == false) {
                dropComplete(false);
            }
            dropInProcess = false;
        }
    } else {
        rejectDrop();
    }
}
项目:openjdk-jdk10    文件:AWTAccessor.java   
public static DropTargetContextAccessor getDropTargetContextAccessor() {
    if (dropTargetContextAccessor == null) {
        unsafe.ensureClassInitialized(DropTargetContext.class);
    }
    return dropTargetContextAccessor;
}
项目:openjdk9    文件:SunDropTargetContextPeer.java   
/**
 *
 */

protected void processExitMessage(SunDropTargetEvent event) {
    Component         c   = (Component)event.getSource();
    DropTarget        dt  = c.getDropTarget();
    DropTargetContext dtc = null;
    DropTargetContextAccessor acc =
            AWTAccessor.getDropTargetContextAccessor();

    if (dt == null) {
        currentDT = null;
        currentT  = null;

        if (currentDTC != null) {
            acc.reset(currentDTC);
        }

        currentDTC = null;

        return;
    }

    if (dt != currentDT) {

        if (currentDTC != null) {
            acc.reset(currentDTC);
        }

        currentDT  = dt;
        currentDTC = dt.getDropTargetContext();

        acc.setDropTargetContextPeer(currentDTC, this);
    }

    dtc = currentDTC;

    if (dt.isActive()) try {
        ((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc));
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        currentA  = DnDConstants.ACTION_NONE;
        currentSA = DnDConstants.ACTION_NONE;
        currentDA = DnDConstants.ACTION_NONE;
        currentDT = null;
        currentT  = null;

        acc.reset(currentDTC);
        currentDTC = null;

        local = null;

        dragRejected = false;
    }
}
项目:openjdk9    文件:SunDropTargetContextPeer.java   
/**
 *
 */

protected void processMotionMessage(SunDropTargetEvent event,
                                  boolean operationChanged) {
    Component         c    = (Component)event.getSource();
    Point             hots = event.getPoint();
    int               id   = event.getID();
    DropTarget        dt   = c.getDropTarget();
    DropTargetContext dtc  = null;
    DropTargetContextAccessor acc =
            AWTAccessor.getDropTargetContextAccessor();

    if (c.isShowing() && (dt != null) && dt.isActive()) {
        if (currentDT != dt) {
            if (currentDTC != null) {
                acc.reset(currentDTC);
            }

            currentDT  = dt;
            currentDTC = null;
        }

        dtc = currentDT.getDropTargetContext();
        if (dtc != currentDTC) {
            if (currentDTC != null) {
                acc.reset(currentDTC);
            }

            currentDTC = dtc;
            acc.setDropTargetContextPeer(currentDTC, this);
        }

        currentA = currentDT.getDefaultActions();

        try {
            DropTargetDragEvent dtde = new DropTargetDragEvent(dtc,
                                                               hots,
                                                               currentDA,
                                                               currentSA);
            DropTargetListener dtl = (DropTargetListener)dt;
            if (operationChanged) {
                dtl.dropActionChanged(dtde);
            } else {
                dtl.dragOver(dtde);
            }

            if (dragRejected) {
                currentDA = DnDConstants.ACTION_NONE;
            }
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDA = DnDConstants.ACTION_NONE;
    }
}
项目:openjdk9    文件:SunDropTargetContextPeer.java   
/**
 *
 */

protected void processDropMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    Point      hots = event.getPoint();
    DropTarget dt   = c.getDropTarget();

    dropStatus   = STATUS_WAIT; // drop pending ACK
    dropComplete = false;

    if (c.isShowing() && dt != null && dt.isActive()) {
        DropTargetContext dtc = dt.getDropTargetContext();

        currentDT = dt;
        DropTargetContextAccessor acc =
                AWTAccessor.getDropTargetContextAccessor();

        if (currentDTC != null) {
            acc.reset(currentDTC);
        }

        currentDTC = dtc;
        acc.setDropTargetContextPeer(currentDTC, this);
        currentA = dt.getDefaultActions();

        synchronized(_globalLock) {
            if ((local = getJVMLocalSourceTransferable()) != null)
                setCurrentJVMLocalSourceTransferable(null);
        }

        dropInProcess = true;

        try {
            ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
                                                                  hots,
                                                                  currentDA,
                                                                  currentSA,
                                                                  local != null));
        } finally {
            if (dropStatus == STATUS_WAIT) {
                rejectDrop();
            } else if (dropComplete == false) {
                dropComplete(false);
            }
            dropInProcess = false;
        }
    } else {
        rejectDrop();
    }
}
项目:openjdk9    文件:AWTAccessor.java   
public static DropTargetContextAccessor getDropTargetContextAccessor() {
    if (dropTargetContextAccessor == null) {
        unsafe.ensureClassInitialized(DropTargetContext.class);
    }
    return dropTargetContextAccessor;
}
项目:jdk8u_jdk    文件:SunDropTargetContextPeer.java   
/**
 *
 */

protected void processExitMessage(SunDropTargetEvent event) {
    Component         c   = (Component)event.getSource();
    DropTarget        dt  = c.getDropTarget();
    DropTargetContext dtc = null;

    if (dt == null) {
        currentDT = null;
        currentT  = null;

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDTC = null;

        return;
    }

    if (dt != currentDT) {

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDT  = dt;
        currentDTC = dt.getDropTargetContext();

        currentDTC.addNotify(this);
    }

    dtc = currentDTC;

    if (dt.isActive()) try {
        ((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc));
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        currentA  = DnDConstants.ACTION_NONE;
        currentSA = DnDConstants.ACTION_NONE;
        currentDA = DnDConstants.ACTION_NONE;
        currentDT = null;
        currentT  = null;

        currentDTC.removeNotify();
        currentDTC = null;

        local = null;

        dragRejected = false;
    }
}
项目:jdk8u_jdk    文件:SunDropTargetContextPeer.java   
/**
 *
 */

protected void processMotionMessage(SunDropTargetEvent event,
                                  boolean operationChanged) {
    Component         c    = (Component)event.getSource();
    Point             hots = event.getPoint();
    int               id   = event.getID();
    DropTarget        dt   = c.getDropTarget();
    DropTargetContext dtc  = null;

    if (c.isShowing() && (dt != null) && dt.isActive()) {
        if (currentDT != dt) {
            if (currentDTC != null) {
                currentDTC.removeNotify();
            }

            currentDT  = dt;
            currentDTC = null;
        }

        dtc = currentDT.getDropTargetContext();
        if (dtc != currentDTC) {
            if (currentDTC != null) {
                currentDTC.removeNotify();
            }

            currentDTC = dtc;
            currentDTC.addNotify(this);
        }

        currentA = currentDT.getDefaultActions();

        try {
            DropTargetDragEvent dtde = new DropTargetDragEvent(dtc,
                                                               hots,
                                                               currentDA,
                                                               currentSA);
            DropTargetListener dtl = (DropTargetListener)dt;
            if (operationChanged) {
                dtl.dropActionChanged(dtde);
            } else {
                dtl.dragOver(dtde);
            }

            if (dragRejected) {
                currentDA = DnDConstants.ACTION_NONE;
            }
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDA = DnDConstants.ACTION_NONE;
    }
}
项目:jdk8u_jdk    文件:SunDropTargetContextPeer.java   
/**
 *
 */

protected void processDropMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    Point      hots = event.getPoint();
    DropTarget dt   = c.getDropTarget();

    dropStatus   = STATUS_WAIT; // drop pending ACK
    dropComplete = false;

    if (c.isShowing() && dt != null && dt.isActive()) {
        DropTargetContext dtc = dt.getDropTargetContext();

        currentDT = dt;

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDTC = dtc;
        currentDTC.addNotify(this);
        currentA = dt.getDefaultActions();

        synchronized(_globalLock) {
            if ((local = getJVMLocalSourceTransferable()) != null)
                setCurrentJVMLocalSourceTransferable(null);
        }

        dropInProcess = true;

        try {
            ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
                                                                  hots,
                                                                  currentDA,
                                                                  currentSA,
                                                                  local != null));
        } finally {
            if (dropStatus == STATUS_WAIT) {
                rejectDrop();
            } else if (dropComplete == false) {
                dropComplete(false);
            }
            dropInProcess = false;
        }
    } else {
        rejectDrop();
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:SunDropTargetContextPeer.java   
/**
 *
 */

protected void processExitMessage(SunDropTargetEvent event) {
    Component         c   = (Component)event.getSource();
    DropTarget        dt  = c.getDropTarget();
    DropTargetContext dtc = null;

    if (dt == null) {
        currentDT = null;
        currentT  = null;

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDTC = null;

        return;
    }

    if (dt != currentDT) {

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDT  = dt;
        currentDTC = dt.getDropTargetContext();

        currentDTC.addNotify(this);
    }

    dtc = currentDTC;

    if (dt.isActive()) try {
        ((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc));
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        currentA  = DnDConstants.ACTION_NONE;
        currentSA = DnDConstants.ACTION_NONE;
        currentDA = DnDConstants.ACTION_NONE;
        currentDT = null;
        currentT  = null;

        currentDTC.removeNotify();
        currentDTC = null;

        local = null;

        dragRejected = false;
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:SunDropTargetContextPeer.java   
/**
 *
 */

protected void processMotionMessage(SunDropTargetEvent event,
                                  boolean operationChanged) {
    Component         c    = (Component)event.getSource();
    Point             hots = event.getPoint();
    int               id   = event.getID();
    DropTarget        dt   = c.getDropTarget();
    DropTargetContext dtc  = null;

    if (c.isShowing() && (dt != null) && dt.isActive()) {
        if (currentDT != dt) {
            if (currentDTC != null) {
                currentDTC.removeNotify();
            }

            currentDT  = dt;
            currentDTC = null;
        }

        dtc = currentDT.getDropTargetContext();
        if (dtc != currentDTC) {
            if (currentDTC != null) {
                currentDTC.removeNotify();
            }

            currentDTC = dtc;
            currentDTC.addNotify(this);
        }

        currentA = currentDT.getDefaultActions();

        try {
            DropTargetDragEvent dtde = new DropTargetDragEvent(dtc,
                                                               hots,
                                                               currentDA,
                                                               currentSA);
            DropTargetListener dtl = (DropTargetListener)dt;
            if (operationChanged) {
                dtl.dropActionChanged(dtde);
            } else {
                dtl.dragOver(dtde);
            }

            if (dragRejected) {
                currentDA = DnDConstants.ACTION_NONE;
            }
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDA = DnDConstants.ACTION_NONE;
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:SunDropTargetContextPeer.java   
/**
 *
 */

protected void processDropMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    Point      hots = event.getPoint();
    DropTarget dt   = c.getDropTarget();

    dropStatus   = STATUS_WAIT; // drop pending ACK
    dropComplete = false;

    if (c.isShowing() && dt != null && dt.isActive()) {
        DropTargetContext dtc = dt.getDropTargetContext();

        currentDT = dt;

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDTC = dtc;
        currentDTC.addNotify(this);
        currentA = dt.getDefaultActions();

        synchronized(_globalLock) {
            if ((local = getJVMLocalSourceTransferable()) != null)
                setCurrentJVMLocalSourceTransferable(null);
        }

        dropInProcess = true;

        try {
            ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
                                                                  hots,
                                                                  currentDA,
                                                                  currentSA,
                                                                  local != null));
        } finally {
            if (dropStatus == STATUS_WAIT) {
                rejectDrop();
            } else if (dropComplete == false) {
                dropComplete(false);
            }
            dropInProcess = false;
        }
    } else {
        rejectDrop();
    }
}
项目:infobip-open-jdk-8    文件:SunDropTargetContextPeer.java   
/**
 *
 */

protected void processExitMessage(SunDropTargetEvent event) {
    Component         c   = (Component)event.getSource();
    DropTarget        dt  = c.getDropTarget();
    DropTargetContext dtc = null;

    if (dt == null) {
        currentDT = null;
        currentT  = null;

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDTC = null;

        return;
    }

    if (dt != currentDT) {

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDT  = dt;
        currentDTC = dt.getDropTargetContext();

        currentDTC.addNotify(this);
    }

    dtc = currentDTC;

    if (dt.isActive()) try {
        ((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc));
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        currentA  = DnDConstants.ACTION_NONE;
        currentSA = DnDConstants.ACTION_NONE;
        currentDA = DnDConstants.ACTION_NONE;
        currentDT = null;
        currentT  = null;

        currentDTC.removeNotify();
        currentDTC = null;

        local = null;

        dragRejected = false;
    }
}