Java Code Examples for java.awt.dnd.DropTarget#isActive()

The following examples show how to use java.awt.dnd.DropTarget#isActive() . 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: SunDropTargetContextPeer.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

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

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

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

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example 2
Source File: CDropTargetContextPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Could be called when DnD enters a heavyweight or synthesized in processMotionMessage
 */
@Override
protected void processEnterMessage(SunDropTargetEvent event) {
    Component c = event.getComponent();
    DropTarget dt = event.getComponent().getDropTarget();
    if (isEventInsideTarget(event)
            && dt != insideTarget
            && c.isShowing()
            && dt != null
            && dt.isActive()) {
        insideTarget = dt;
        super.processEnterMessage(event);
    }
}
 
Example 3
Source File: CDropTargetContextPeer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Could be called when DnD enters a heavyweight or synthesized in processMotionMessage
 */
@Override
protected void processEnterMessage(SunDropTargetEvent event) {
    Component c = event.getComponent();
    DropTarget dt = event.getComponent().getDropTarget();
    if (isEventInsideTarget(event)
            && dt != insideTarget
            && c.isShowing()
            && dt != null
            && dt.isActive()) {
        insideTarget = dt;
        super.processEnterMessage(event);
    }
}
 
Example 4
Source File: SunDropTargetContextPeer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

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

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

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

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example 5
Source File: CDropTargetContextPeer.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Could be called when DnD enters a heavyweight or synthesized in processMotionMessage
 */
@Override
protected void processEnterMessage(SunDropTargetEvent event) {
    Component c = event.getComponent();
    DropTarget dt = event.getComponent().getDropTarget();
    if (isEventInsideTarget(event)
            && dt != insideTarget
            && c.isShowing()
            && dt != null
            && dt.isActive()) {
        insideTarget = dt;
        super.processEnterMessage(event);
    }
}
 
Example 6
Source File: SunDropTargetContextPeer.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 */

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;
    }
}
 
Example 7
Source File: Container.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public boolean accept(final Component comp) {
    DropTarget dt = comp.getDropTarget();
    return dt != null && dt.isActive();
}
 
Example 8
Source File: Container.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public boolean accept(final Component comp) {
    DropTarget dt = comp.getDropTarget();
    return dt != null && dt.isActive();
}
 
Example 9
Source File: SunDropTargetContextPeer.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

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

    local = getJVMLocalSourceTransferable();
    DropTargetContextAccessor acc =
            AWTAccessor.getDropTargetContextAccessor();
    if (currentDTC != null) { // some wreckage from last time
        acc.reset(currentDTC);
        currentDTC = null;
    }

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

        acc.setDropTargetContextPeer(currentDTC, this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example 10
Source File: SunDropTargetContextPeer.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 */

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;
    }
}
 
Example 11
Source File: Container.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public boolean accept(final Component comp) {
    DropTarget dt = comp.getDropTarget();
    return dt != null && dt.isActive();
}
 
Example 12
Source File: Container.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public boolean accept(final Component comp) {
    DropTarget dt = comp.getDropTarget();
    return dt != null && dt.isActive();
}
 
Example 13
Source File: SunDropTargetContextPeer.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 */

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;
    }
}
 
Example 14
Source File: SunDropTargetContextPeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 */

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;
    }
}
 
Example 15
Source File: Container.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public boolean accept(final Component comp) {
    DropTarget dt = comp.getDropTarget();
    return dt != null && dt.isActive();
}
 
Example 16
Source File: SunDropTargetContextPeer.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 */

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;
    }
}
 
Example 17
Source File: Container.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
public boolean accept(final Component comp) {
    DropTarget dt = comp.getDropTarget();
    return dt != null && dt.isActive();
}
 
Example 18
Source File: SunDropTargetContextPeer.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 *
 */

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;
    }
}
 
Example 19
Source File: SunDropTargetContextPeer.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 */

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();
    }
}
 
Example 20
Source File: SunDropTargetContextPeer.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 */

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();
    }
}