Java Code Examples for sun.awt.dnd.SunDropTargetEvent#isConsumed()

The following examples show how to use sun.awt.dnd.SunDropTargetEvent#isConsumed() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XDropTargetContextPeer.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
protected void eventProcessed(SunDropTargetEvent e, int returnValue,
                              boolean dispatcherDone) {
    /* The native context is the pointer to the XClientMessageEvent
       structure. */
    long ctxt = getNativeDragContext();
    /* If the event was not consumed, send a response to the source. */
    try {
        if (ctxt != 0 && !e.isConsumed()) {
            Iterator dropTargetProtocols =
                XDragAndDropProtocols.getDropTargetProtocols();

            while (dropTargetProtocols.hasNext()) {
                XDropTargetProtocol dropTargetProtocol =
                    (XDropTargetProtocol)dropTargetProtocols.next();
                if (dropTargetProtocol.sendResponse(ctxt, e.getID(),
                                                    returnValue)) {
                    break;
                }
            }
        }
    } finally {
        if (dispatcherDone && ctxt != 0) {
            unsafe.freeMemory(ctxt);
        }
    }
}
 
Example 2
Source File: XDropTargetContextPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected void eventProcessed(SunDropTargetEvent e, int returnValue,
                              boolean dispatcherDone) {
    /* The native context is the pointer to the XClientMessageEvent
       structure. */
    long ctxt = getNativeDragContext();
    /* If the event was not consumed, send a response to the source. */
    try {
        if (ctxt != 0 && !e.isConsumed()) {
            Iterator<XDropTargetProtocol> dropTargetProtocols =
                XDragAndDropProtocols.getDropTargetProtocols();

            while (dropTargetProtocols.hasNext()) {
                XDropTargetProtocol dropTargetProtocol =
                    dropTargetProtocols.next();
                if (dropTargetProtocol.sendResponse(ctxt, e.getID(),
                                                    returnValue)) {
                    break;
                }
            }
        }
    } finally {
        if (dispatcherDone && ctxt != 0) {
            unsafe.freeMemory(ctxt);
        }
    }
}
 
Example 3
Source File: XDropTargetContextPeer.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
protected void eventProcessed(SunDropTargetEvent e, int returnValue,
                              boolean dispatcherDone) {
    /* The native context is the pointer to the XClientMessageEvent
       structure. */
    long ctxt = getNativeDragContext();
    /* If the event was not consumed, send a response to the source. */
    try {
        if (ctxt != 0 && !e.isConsumed()) {
            Iterator dropTargetProtocols =
                XDragAndDropProtocols.getDropTargetProtocols();

            while (dropTargetProtocols.hasNext()) {
                XDropTargetProtocol dropTargetProtocol =
                    (XDropTargetProtocol)dropTargetProtocols.next();
                if (dropTargetProtocol.sendResponse(ctxt, e.getID(),
                                                    returnValue)) {
                    break;
                }
            }
        }
    } finally {
        if (dispatcherDone && ctxt != 0) {
            unsafe.freeMemory(ctxt);
        }
    }
}
 
Example 4
Source File: XDropTargetContextPeer.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected void eventProcessed(SunDropTargetEvent e, int returnValue,
                              boolean dispatcherDone) {
    /* The native context is the pointer to the XClientMessageEvent
       structure. */
    long ctxt = getNativeDragContext();
    /* If the event was not consumed, send a response to the source. */
    try {
        if (ctxt != 0 && !e.isConsumed()) {
            Iterator dropTargetProtocols =
                XDragAndDropProtocols.getDropTargetProtocols();

            while (dropTargetProtocols.hasNext()) {
                XDropTargetProtocol dropTargetProtocol =
                    (XDropTargetProtocol)dropTargetProtocols.next();
                if (dropTargetProtocol.sendResponse(ctxt, e.getID(),
                                                    returnValue)) {
                    break;
                }
            }
        }
    } finally {
        if (dispatcherDone && ctxt != 0) {
            unsafe.freeMemory(ctxt);
        }
    }
}
 
Example 5
Source File: XDropTargetContextPeer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
protected void eventProcessed(SunDropTargetEvent e, int returnValue,
                              boolean dispatcherDone) {
    /* The native context is the pointer to the XClientMessageEvent
       structure. */
    long ctxt = getNativeDragContext();
    /* If the event was not consumed, send a response to the source. */
    try {
        if (ctxt != 0 && !e.isConsumed()) {
            Iterator dropTargetProtocols =
                XDragAndDropProtocols.getDropTargetProtocols();

            while (dropTargetProtocols.hasNext()) {
                XDropTargetProtocol dropTargetProtocol =
                    (XDropTargetProtocol)dropTargetProtocols.next();
                if (dropTargetProtocol.sendResponse(ctxt, e.getID(),
                                                    returnValue)) {
                    break;
                }
            }
        }
    } finally {
        if (dispatcherDone && ctxt != 0) {
            unsafe.freeMemory(ctxt);
        }
    }
}
 
Example 6
Source File: XDropTargetContextPeer.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
protected void eventProcessed(SunDropTargetEvent e, int returnValue,
                              boolean dispatcherDone) {
    /* The native context is the pointer to the XClientMessageEvent
       structure. */
    long ctxt = getNativeDragContext();
    /* If the event was not consumed, send a response to the source. */
    try {
        if (ctxt != 0 && !e.isConsumed()) {
            Iterator dropTargetProtocols =
                XDragAndDropProtocols.getDropTargetProtocols();

            while (dropTargetProtocols.hasNext()) {
                XDropTargetProtocol dropTargetProtocol =
                    (XDropTargetProtocol)dropTargetProtocols.next();
                if (dropTargetProtocol.sendResponse(ctxt, e.getID(),
                                                    returnValue)) {
                    break;
                }
            }
        }
    } finally {
        if (dispatcherDone && ctxt != 0) {
            unsafe.freeMemory(ctxt);
        }
    }
}
 
Example 7
Source File: XDropTargetContextPeer.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected void eventProcessed(SunDropTargetEvent e, int returnValue,
                              boolean dispatcherDone) {
    /* The native context is the pointer to the XClientMessageEvent
       structure. */
    long ctxt = getNativeDragContext();
    /* If the event was not consumed, send a response to the source. */
    try {
        if (ctxt != 0 && !e.isConsumed()) {
            Iterator dropTargetProtocols =
                XDragAndDropProtocols.getDropTargetProtocols();

            while (dropTargetProtocols.hasNext()) {
                XDropTargetProtocol dropTargetProtocol =
                    (XDropTargetProtocol)dropTargetProtocols.next();
                if (dropTargetProtocol.sendResponse(ctxt, e.getID(),
                                                    returnValue)) {
                    break;
                }
            }
        }
    } finally {
        if (dispatcherDone && ctxt != 0) {
            unsafe.freeMemory(ctxt);
        }
    }
}
 
Example 8
Source File: XDropTargetContextPeer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private boolean processSunDropTargetEvent(SunDropTargetEvent event) {
    Object source = event.getSource();

    if (source instanceof Component) {
        ComponentPeer peer = ((Component)source).getPeer();
        if (peer instanceof XEmbedCanvasPeer) {
            XEmbedCanvasPeer xEmbedCanvasPeer = (XEmbedCanvasPeer)peer;
            /* The native context is the pointer to the XClientMessageEvent
               structure. */
            long ctxt = getNativeDragContext();

            if (logger.isLoggable(PlatformLogger.Level.FINER)) {
                logger.finer("        processing " + event + " ctxt=" + ctxt +
                             " consumed=" + event.isConsumed());
            }
            /* If the event is not consumed, pass it to the
               XEmbedCanvasPeer for processing. */
            if (!event.isConsumed()) {
                // NOTE: ctxt can be zero at this point.
                if (xEmbedCanvasPeer.processXEmbedDnDEvent(ctxt,
                                                           event.getID())) {
                    event.consume();
                    return true;
                }
            }
        }
    }

    return false;
}
 
Example 9
Source File: XDropTargetContextPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private boolean processSunDropTargetEvent(SunDropTargetEvent event) {
    Object source = event.getSource();

    if (source instanceof Component) {
        Object peer = AWTAccessor.getComponentAccessor()
                                 .getPeer((Component) source);
        if (peer instanceof XEmbedCanvasPeer) {
            XEmbedCanvasPeer xEmbedCanvasPeer = (XEmbedCanvasPeer)peer;
            /* The native context is the pointer to the XClientMessageEvent
               structure. */
            long ctxt = getNativeDragContext();

            if (logger.isLoggable(PlatformLogger.Level.FINER)) {
                logger.finer("        processing " + event + " ctxt=" + ctxt +
                             " consumed=" + event.isConsumed());
            }
            /* If the event is not consumed, pass it to the
               XEmbedCanvasPeer for processing. */
            if (!event.isConsumed()) {
                // NOTE: ctxt can be zero at this point.
                if (xEmbedCanvasPeer.processXEmbedDnDEvent(ctxt,
                                                           event.getID())) {
                    event.consume();
                    return true;
                }
            }
        }
    }

    return false;
}
 
Example 10
Source File: XDropTargetContextPeer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private boolean processSunDropTargetEvent(SunDropTargetEvent event) {
    Object source = event.getSource();

    if (source instanceof Component) {
        ComponentPeer peer = ((Component)source).getPeer();
        if (peer instanceof XEmbedCanvasPeer) {
            XEmbedCanvasPeer xEmbedCanvasPeer = (XEmbedCanvasPeer)peer;
            /* The native context is the pointer to the XClientMessageEvent
               structure. */
            long ctxt = getNativeDragContext();

            if (logger.isLoggable(PlatformLogger.Level.FINER)) {
                logger.finer("        processing " + event + " ctxt=" + ctxt +
                             " consumed=" + event.isConsumed());
            }
            /* If the event is not consumed, pass it to the
               XEmbedCanvasPeer for processing. */
            if (!event.isConsumed()) {
                // NOTE: ctxt can be zero at this point.
                if (xEmbedCanvasPeer.processXEmbedDnDEvent(ctxt,
                                                           event.getID())) {
                    event.consume();
                    return true;
                }
            }
        }
    }

    return false;
}
 
Example 11
Source File: XDropTargetContextPeer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private boolean processSunDropTargetEvent(SunDropTargetEvent event) {
    Object source = event.getSource();

    if (source instanceof Component) {
        ComponentPeer peer = ((Component)source).getPeer();
        if (peer instanceof XEmbedCanvasPeer) {
            XEmbedCanvasPeer xEmbedCanvasPeer = (XEmbedCanvasPeer)peer;
            /* The native context is the pointer to the XClientMessageEvent
               structure. */
            long ctxt = getNativeDragContext();

            if (logger.isLoggable(PlatformLogger.Level.FINER)) {
                logger.finer("        processing " + event + " ctxt=" + ctxt +
                             " consumed=" + event.isConsumed());
            }
            /* If the event is not consumed, pass it to the
               XEmbedCanvasPeer for processing. */
            if (!event.isConsumed()) {
                // NOTE: ctxt can be zero at this point.
                if (xEmbedCanvasPeer.processXEmbedDnDEvent(ctxt,
                                                           event.getID())) {
                    event.consume();
                    return true;
                }
            }
        }
    }

    return false;
}
 
Example 12
Source File: XDropTargetContextPeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private boolean processSunDropTargetEvent(SunDropTargetEvent event) {
    Object source = event.getSource();

    if (source instanceof Component) {
        ComponentPeer peer = ((Component)source).getPeer();
        if (peer instanceof XEmbedCanvasPeer) {
            XEmbedCanvasPeer xEmbedCanvasPeer = (XEmbedCanvasPeer)peer;
            /* The native context is the pointer to the XClientMessageEvent
               structure. */
            long ctxt = getNativeDragContext();

            if (logger.isLoggable(PlatformLogger.Level.FINER)) {
                logger.finer("        processing " + event + " ctxt=" + ctxt +
                             " consumed=" + event.isConsumed());
            }
            /* If the event is not consumed, pass it to the
               XEmbedCanvasPeer for processing. */
            if (!event.isConsumed()) {
                // NOTE: ctxt can be zero at this point.
                if (xEmbedCanvasPeer.processXEmbedDnDEvent(ctxt,
                                                           event.getID())) {
                    event.consume();
                    return true;
                }
            }
        }
    }

    return false;
}
 
Example 13
Source File: Container.java    From Java8CN with Apache License 2.0 4 votes vote down vote up
private boolean processDropTargetEvent(SunDropTargetEvent e) {
    int id = e.getID();
    int x = e.getX();
    int y = e.getY();

    /*
     * Fix for BugTraq ID 4395290.
     * It is possible that SunDropTargetEvent's Point is outside of the
     * native container bounds. In this case we truncate coordinates.
     */
    if (!nativeContainer.contains(x, y)) {
        final Dimension d = nativeContainer.getSize();
        if (d.width <= x) {
            x = d.width - 1;
        } else if (x < 0) {
            x = 0;
        }
        if (d.height <= y) {
            y = d.height - 1;
        } else if (y < 0) {
            y = 0;
        }
    }
    Component mouseOver =   // not necessarily sensitive to mouse events
        nativeContainer.getDropTargetEventTarget(x, y,
                                                 Container.INCLUDE_SELF);
    trackMouseEnterExit(mouseOver, e);

    if (mouseOver != nativeContainer && mouseOver != null) {
        switch (id) {
        case SunDropTargetEvent.MOUSE_ENTERED:
        case SunDropTargetEvent.MOUSE_EXITED:
            break;
        default:
            retargetMouseEvent(mouseOver, id, e);
            e.consume();
            break;
        }
    }
    return e.isConsumed();
}
 
Example 14
Source File: Container.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
private boolean processDropTargetEvent(SunDropTargetEvent e) {
    int id = e.getID();
    int x = e.getX();
    int y = e.getY();

    /*
     * Fix for BugTraq ID 4395290.
     * It is possible that SunDropTargetEvent's Point is outside of the
     * native container bounds. In this case we truncate coordinates.
     */
    if (!nativeContainer.contains(x, y)) {
        final Dimension d = nativeContainer.getSize();
        if (d.width <= x) {
            x = d.width - 1;
        } else if (x < 0) {
            x = 0;
        }
        if (d.height <= y) {
            y = d.height - 1;
        } else if (y < 0) {
            y = 0;
        }
    }
    Component mouseOver =   // not necessarily sensitive to mouse events
        nativeContainer.getDropTargetEventTarget(x, y,
                                                 Container.INCLUDE_SELF);
    trackMouseEnterExit(mouseOver, e);

    if (mouseOver != nativeContainer && mouseOver != null) {
        switch (id) {
        case SunDropTargetEvent.MOUSE_ENTERED:
        case SunDropTargetEvent.MOUSE_EXITED:
            break;
        default:
            retargetMouseEvent(mouseOver, id, e);
            e.consume();
            break;
        }
    }
    return e.isConsumed();
}
 
Example 15
Source File: Container.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private boolean processDropTargetEvent(SunDropTargetEvent e) {
    int id = e.getID();
    int x = e.getX();
    int y = e.getY();

    /*
     * Fix for BugTraq ID 4395290.
     * It is possible that SunDropTargetEvent's Point is outside of the
     * native container bounds. In this case we truncate coordinates.
     */
    if (!nativeContainer.contains(x, y)) {
        final Dimension d = nativeContainer.getSize();
        if (d.width <= x) {
            x = d.width - 1;
        } else if (x < 0) {
            x = 0;
        }
        if (d.height <= y) {
            y = d.height - 1;
        } else if (y < 0) {
            y = 0;
        }
    }
    Component mouseOver =   // not necessarily sensitive to mouse events
        nativeContainer.getDropTargetEventTarget(x, y,
                                                 Container.INCLUDE_SELF);
    trackMouseEnterExit(mouseOver, e);

    if (mouseOver != nativeContainer && mouseOver != null) {
        switch (id) {
        case SunDropTargetEvent.MOUSE_ENTERED:
        case SunDropTargetEvent.MOUSE_EXITED:
            break;
        default:
            retargetMouseEvent(mouseOver, id, e);
            e.consume();
            break;
        }
    }
    return e.isConsumed();
}
 
Example 16
Source File: Container.java    From jdk-1.7-annotated with Apache License 2.0 4 votes vote down vote up
private boolean processDropTargetEvent(SunDropTargetEvent e) {
    int id = e.getID();
    int x = e.getX();
    int y = e.getY();

    /*
     * Fix for BugTraq ID 4395290.
     * It is possible that SunDropTargetEvent's Point is outside of the
     * native container bounds. In this case we truncate coordinates.
     */
    if (!nativeContainer.contains(x, y)) {
        final Dimension d = nativeContainer.getSize();
        if (d.width <= x) {
            x = d.width - 1;
        } else if (x < 0) {
            x = 0;
        }
        if (d.height <= y) {
            y = d.height - 1;
        } else if (y < 0) {
            y = 0;
        }
    }
    Component mouseOver =   // not necessarily sensitive to mouse events
        nativeContainer.getDropTargetEventTarget(x, y,
                                                 Container.INCLUDE_SELF);
    trackMouseEnterExit(mouseOver, e);

    if (mouseOver != nativeContainer && mouseOver != null) {
        switch (id) {
        case SunDropTargetEvent.MOUSE_ENTERED:
        case SunDropTargetEvent.MOUSE_EXITED:
            break;
        default:
            retargetMouseEvent(mouseOver, id, e);
            e.consume();
            break;
        }
    }
    return e.isConsumed();
}
 
Example 17
Source File: Container.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private boolean processDropTargetEvent(SunDropTargetEvent e) {
    int id = e.getID();
    int x = e.getX();
    int y = e.getY();

    /*
     * Fix for BugTraq ID 4395290.
     * It is possible that SunDropTargetEvent's Point is outside of the
     * native container bounds. In this case we truncate coordinates.
     */
    if (!nativeContainer.contains(x, y)) {
        final Dimension d = nativeContainer.getSize();
        if (d.width <= x) {
            x = d.width - 1;
        } else if (x < 0) {
            x = 0;
        }
        if (d.height <= y) {
            y = d.height - 1;
        } else if (y < 0) {
            y = 0;
        }
    }
    Component mouseOver =   // not necessarily sensitive to mouse events
        nativeContainer.getDropTargetEventTarget(x, y,
                                                 Container.INCLUDE_SELF);
    trackMouseEnterExit(mouseOver, e);

    if (mouseOver != nativeContainer && mouseOver != null) {
        switch (id) {
        case SunDropTargetEvent.MOUSE_ENTERED:
        case SunDropTargetEvent.MOUSE_EXITED:
            break;
        default:
            retargetMouseEvent(mouseOver, id, e);
            e.consume();
            break;
        }
    }
    return e.isConsumed();
}
 
Example 18
Source File: Container.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
private boolean processDropTargetEvent(SunDropTargetEvent e) {
    int id = e.getID();
    int x = e.getX();
    int y = e.getY();

    /*
     * Fix for BugTraq ID 4395290.
     * It is possible that SunDropTargetEvent's Point is outside of the
     * native container bounds. In this case we truncate coordinates.
     */
    if (!nativeContainer.contains(x, y)) {
        final Dimension d = nativeContainer.getSize();
        if (d.width <= x) {
            x = d.width - 1;
        } else if (x < 0) {
            x = 0;
        }
        if (d.height <= y) {
            y = d.height - 1;
        } else if (y < 0) {
            y = 0;
        }
    }
    Component mouseOver =   // not necessarily sensitive to mouse events
        nativeContainer.getDropTargetEventTarget(x, y,
                                                 Container.INCLUDE_SELF);
    trackMouseEnterExit(mouseOver, e);

    if (mouseOver != nativeContainer && mouseOver != null) {
        switch (id) {
        case SunDropTargetEvent.MOUSE_ENTERED:
        case SunDropTargetEvent.MOUSE_EXITED:
            break;
        default:
            retargetMouseEvent(mouseOver, id, e);
            e.consume();
            break;
        }
    }
    return e.isConsumed();
}
 
Example 19
Source File: Container.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private boolean processDropTargetEvent(SunDropTargetEvent e) {
    int id = e.getID();
    int x = e.getX();
    int y = e.getY();

    /*
     * Fix for BugTraq ID 4395290.
     * It is possible that SunDropTargetEvent's Point is outside of the
     * native container bounds. In this case we truncate coordinates.
     */
    if (!nativeContainer.contains(x, y)) {
        final Dimension d = nativeContainer.getSize();
        if (d.width <= x) {
            x = d.width - 1;
        } else if (x < 0) {
            x = 0;
        }
        if (d.height <= y) {
            y = d.height - 1;
        } else if (y < 0) {
            y = 0;
        }
    }
    Component mouseOver =   // not necessarily sensitive to mouse events
        nativeContainer.getDropTargetEventTarget(x, y,
                                                 Container.INCLUDE_SELF);
    trackMouseEnterExit(mouseOver, e);

    if (mouseOver != nativeContainer && mouseOver != null) {
        switch (id) {
        case SunDropTargetEvent.MOUSE_ENTERED:
        case SunDropTargetEvent.MOUSE_EXITED:
            break;
        default:
            retargetMouseEvent(mouseOver, id, e);
            e.consume();
            break;
        }
    }
    return e.isConsumed();
}
 
Example 20
Source File: Container.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
private boolean processDropTargetEvent(SunDropTargetEvent e) {
    int id = e.getID();
    int x = e.getX();
    int y = e.getY();

    /*
     * Fix for BugTraq ID 4395290.
     * It is possible that SunDropTargetEvent's Point is outside of the
     * native container bounds. In this case we truncate coordinates.
     */
    if (!nativeContainer.contains(x, y)) {
        final Dimension d = nativeContainer.getSize();
        if (d.width <= x) {
            x = d.width - 1;
        } else if (x < 0) {
            x = 0;
        }
        if (d.height <= y) {
            y = d.height - 1;
        } else if (y < 0) {
            y = 0;
        }
    }
    Component mouseOver =   // not necessarily sensitive to mouse events
        nativeContainer.getDropTargetEventTarget(x, y,
                                                 Container.INCLUDE_SELF);
    trackMouseEnterExit(mouseOver, e);

    if (mouseOver != nativeContainer && mouseOver != null) {
        switch (id) {
        case SunDropTargetEvent.MOUSE_ENTERED:
        case SunDropTargetEvent.MOUSE_EXITED:
            break;
        default:
            retargetMouseEvent(mouseOver, id, e);
            e.consume();
            break;
        }
    }
    return e.isConsumed();
}