java.awt.dnd.DropTargetEvent Java Examples

The following examples show how to use java.awt.dnd.DropTargetEvent. 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: Outline.java    From gcs with Mozilla Public License 2.0 6 votes vote down vote up
/**
 * Called when a column drag leaves the outline.
 *
 * @param dte The drop target event.
 */
protected void dragExitColumn(DropTargetEvent dte) {
    List<Column> columns = mModel.getColumns();

    if (columns.equals(mSavedColumns)) {
        repaintColumn(mModel.getDragColumn());
    } else {
        columns.clear();
        columns.addAll(mSavedColumns);
        repaint();
        if (mHeaderPanel != null) {
            mHeaderPanel.repaint();
        }
    }
    mSavedColumns = null;
    mModel.setDragColumn(null);
}
 
Example #2
Source File: Outline.java    From gcs with Mozilla Public License 2.0 6 votes vote down vote up
@Override
public void dragExit(DropTargetEvent dte) {
    if (mDragWasAcceptable) {
        if (mModel.getDragColumn() != null) {
            dragExitColumn(dte);
        } else {
            Row[] rows = mModel.getDragRows();

            if (rows != null && rows.length > 0) {
                dragExitRow(dte);
            }
        }
    } else if (mAlternateDragDestination != null) {
        mAlternateDragDestination.dragExit(dte);
    }
}
 
Example #3
Source File: CustomizedToolbar.java    From pumpernickel with MIT License 6 votes vote down vote up
public void dragExit(DropTargetEvent dte) {
	if (draggingDefaults) {
		return;
	}
	updateContents(getContents(new Point(-1000, -1000)));
	if (draggingComponent != null) {
		JComponent theComponent = getComponent(draggingComponent);
		Rectangle r = getLayout().getDestinationMap(
				CustomizedToolbar.this).get(theComponent);
		if (r != null) {
			theComponent.setBounds(r);
		}
		if (hideActiveComponents)
			theComponent.setVisible(true);
	}
}
 
Example #4
Source File: TreePanel.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void dragExit(DropTargetEvent event) {
    if (mDragState != null) {
        mDragState.dragExit(event);
    } else if (mAlternateDragDestination != null) {
        mAlternateDragDestination.dragExit(event);
    }
    clearDragState();
}
 
Example #5
Source File: MissingDragExitEventTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void dragExit(final DropTargetEvent dte) {
    if (!inside) {
        FAILED = true;
        Thread.dumpStack();
    }
    inside = false;
    MOUSE_EXIT_TD = true;
}
 
Example #6
Source File: mxGraphHandler.java    From blog-codes with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * @param e
 */
public void dragExit(DropTargetEvent e)
{
	mxGraphTransferHandler handler = getGraphTransferHandler(e);

	if (handler != null)
	{
		handler.setLocation(null);
	}

	dragCells = null;
	setVisible(false);
	marker.reset();
	reset();
}
 
Example #7
Source File: MissingDragExitEventTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void dragExit(final DropTargetEvent dte) {
    if (!inside) {
        FAILED = true;
        Thread.dumpStack();
    }
    inside = false;
    MOUSE_EXIT_TD = true;
}
 
Example #8
Source File: mxGraphHandler.java    From blog-codes with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to return the component for a drop target event.
 */
protected static final mxGraphTransferHandler getGraphTransferHandler(
		DropTargetEvent e)
{
	JComponent component = getDropTarget(e);
	TransferHandler transferHandler = component.getTransferHandler();

	if (transferHandler instanceof mxGraphTransferHandler)
	{
		return (mxGraphTransferHandler) transferHandler;
	}

	return null;
}
 
Example #9
Source File: MissingDragExitEventTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void dragExit(final DropTargetEvent dte) {
    if (!inside) {
        FAILED = true;
        Thread.dumpStack();
    }
    inside = false;
    MOUSE_EXIT_TD = true;
}
 
Example #10
Source File: MissingDragExitEventTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void dragExit(final DropTargetEvent dte) {
    if (!inside) {
        FAILED = true;
        Thread.dumpStack();
    }
    inside = false;
    MOUSE_EXIT_TD = true;
}
 
Example #11
Source File: MissingDragExitEventTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void dragExit(final DropTargetEvent dte) {
    if (!inside) {
        FAILED = true;
        Thread.dumpStack();
    }
    inside = false;
    MOUSE_EXIT_TD = true;
}
 
Example #12
Source File: mxGraphHandler.java    From blog-codes with Apache License 2.0 5 votes vote down vote up
/**
 * 
 */
protected MouseEvent createEvent(DropTargetEvent e)
{
	JComponent component = getDropTarget(e);
	Point location = null;
	int action = 0;

	if (e instanceof DropTargetDropEvent)
	{
		location = ((DropTargetDropEvent) e).getLocation();
		action = ((DropTargetDropEvent) e).getDropAction();
	}
	else if (e instanceof DropTargetDragEvent)
	{
		location = ((DropTargetDragEvent) e).getLocation();
		action = ((DropTargetDragEvent) e).getDropAction();
	}

	if (location != null)
	{
		location = convertPoint(location);
		Rectangle r = graphComponent.getViewport().getViewRect();
		location.translate(r.x, r.y);
	}

	// LATER: Fetch state of modifier keys from event or via global
	// key listener using Toolkit.getDefaultToolkit().addAWTEventListener(
	// new AWTEventListener() {...}, AWTEvent.KEY_EVENT_MASK). Problem
	// is the event does not contain the modifier keys and the global
	// handler is not called during drag and drop.
	int mod = (action == TransferHandler.COPY) ? InputEvent.CTRL_MASK : 0;

	return new MouseEvent(component, 0, System.currentTimeMillis(), mod,
			location.x, location.y, 1, false, MouseEvent.BUTTON1);
}
 
Example #13
Source File: MenuEditLayer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void dragExit(DropTargetEvent dte) {
    //if(shouldRedispatchDnDToHandle()) {
    if(dragProxying) {
        formDesigner.getHandleLayer().getNewComponentDropListener().dragExit(dte);
    }
    dragProxying = false;
}
 
Example #14
Source File: QuietEditorPane.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void dragExit(DropTargetEvent dte) {
    if (isDragging) {
        orig.dragExit(dte);
    }
    isDragging = false;
}
 
Example #15
Source File: IndexedCustomizer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** User exits the dragging */
public void dragExit(DropTargetEvent dte) {
    if (lastIndex >= 0) {
        cellRenderer.draggingExit();
        comp.repaint(comp.getCellBounds(lastIndex, lastIndex));
    }
}
 
Example #16
Source File: DnDSupport.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void dragExit( DropTargetEvent dte ) {
    removeDropLine();
    if (DropGlassPane.isOriginalPaneStored()) {
        DropGlassPane.putBackOriginal();
    }
    removeTimer();
}
 
Example #17
Source File: MissingDragExitEventTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void dragExit(final DropTargetEvent dte) {
    if (!inside) {
        FAILED = true;
        Thread.dumpStack();
    }
    inside = false;
    MOUSE_EXIT_TD = true;
}
 
Example #18
Source File: MissingDragExitEventTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void dragExit(final DropTargetEvent dte) {
    if (!inside) {
        FAILED = true;
        Thread.dumpStack();
    }
    inside = false;
    MOUSE_EXIT_TD = true;
}
 
Example #19
Source File: MissingDragExitEventTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void dragExit(final DropTargetEvent dte) {
    if (!inside) {
        FAILED = true;
        Thread.dumpStack();
    }
    inside = false;
    MOUSE_EXIT_TD = true;
}
 
Example #20
Source File: MissingDragExitEventTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void dragExit(final DropTargetEvent dte) {
    if (!inside) {
        FAILED = true;
        Thread.dumpStack();
    }
    inside = false;
    MOUSE_EXIT_TD = true;
}
 
Example #21
Source File: MissingDragExitEventTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void dragExit(final DropTargetEvent dte) {
    if (!inside) {
        FAILED = true;
        Thread.dumpStack();
    }
    inside = false;
    MOUSE_EXIT_TD = true;
}
 
Example #22
Source File: MissingDragExitEventTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void dragExit(final DropTargetEvent dte) {
    if (!inside) {
        FAILED = true;
        Thread.dumpStack();
    }
    inside = false;
    MOUSE_EXIT_TD = true;
}
 
Example #23
Source File: MissingDragExitEventTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void dragExit(final DropTargetEvent dte) {
    if (!inside) {
        FAILED = true;
        Thread.dumpStack();
    }
    inside = false;
    MOUSE_EXIT_TD = true;
}
 
Example #24
Source File: Outline.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Called when a row drag leaves the outline.
 *
 * @param dte The drop target event.
 */
protected void dragExitRow(DropTargetEvent dte) {
    setDragTargetRow(null);
    repaint(getDragRowInsertionMarkerBounds(mDragParentRow, mDragChildInsertIndex));
    removeDragHighlight(this);
    mDragParentRow = null;
    mDragChildInsertIndex = -1;
    mModel.setDragRows(null);
}
 
Example #25
Source File: TreeColumnDragState.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void dragExit(DropTargetEvent event) {
    TreePanel panel = getPanel();
    if (panel.getColumns().equals(mOriginal)) {
        panel.repaintColumn(mColumn);
    } else {
        panel.restoreColumns(mOriginal);
    }
}
 
Example #26
Source File: ProcessRendererDropTarget.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void dragExit(final DropTargetEvent e) {
	super.dragExit(e);
	view.getModel().setImportDragged(false);
	view.getModel().fireMiscChanged();
	if (dropTragetListenerList != null) {
		Object[] listeners = dropTragetListenerList.getListenerList();
		for (int i = listeners.length - 2; i >= 0; i -= 2) {
			if (listeners[i] == DropTargetListener.class) {
				((DropTargetListener) listeners[i + 1]).dragExit(e);
			}
		}
	}
}
 
Example #27
Source File: MissingEventsOnModalDialogTest.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void dragExit(DropTargetEvent dte) {
}
 
Example #28
Source File: SunDropTargetContextPeer.java    From hottub 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 #29
Source File: SunDropTargetContextPeer.java    From openjdk-8-source 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 #30
Source File: SunDropTargetContextPeer.java    From jdk8u-dev-jdk 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;
    }
}