Java Code Examples for java.awt.dnd.DragSourceDragEvent

The following are top voted examples for showing how to use java.awt.dnd.DragSourceDragEvent. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: OpenJSharp   File: SunDragSourceContextPeer.java   View source code 6 votes vote down vote up
protected final void postDragSourceDragEvent(final int targetAction,
                                             final int modifiers,
                                             final int x, final int y,
                                             final int dispatchType) {

    final int dropAction =
        SunDragSourceContextPeer.convertModifiersToDropAction(modifiers,
                                                              sourceActions);

    DragSourceDragEvent event =
        new DragSourceDragEvent(getDragSourceContext(),
                                dropAction,
                                targetAction & sourceActions,
                                modifiers, x, y);
    EventDispatcher dispatcher = new EventDispatcher(dispatchType, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
}
 
Example 2
Project: OpenJSharp   File: SunDragSourceContextPeer.java   View source code 6 votes vote down vote up
EventDispatcher(int dispatchType, DragSourceEvent event) {
    switch (dispatchType) {
    case DISPATCH_ENTER:
    case DISPATCH_MOTION:
    case DISPATCH_CHANGED:
    case DISPATCH_MOUSE_MOVED:
        if (!(event instanceof DragSourceDragEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    case DISPATCH_EXIT:
        break;
    case DISPATCH_FINISH:
        if (!(event instanceof DragSourceDropEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    default:
        throw new IllegalArgumentException("Dispatch type: " +
                                           dispatchType);
    }

    this.dispatchType  = dispatchType;
    this.event         = event;
}
 
Example 3
Project: jdk8u-jdk   File: SunDragSourceContextPeer.java   View source code 6 votes vote down vote up
protected final void postDragSourceDragEvent(final int targetAction,
                                             final int modifiers,
                                             final int x, final int y,
                                             final int dispatchType) {

    final int dropAction =
        SunDragSourceContextPeer.convertModifiersToDropAction(modifiers,
                                                              sourceActions);

    DragSourceDragEvent event =
        new DragSourceDragEvent(getDragSourceContext(),
                                dropAction,
                                targetAction & sourceActions,
                                modifiers, x, y);
    EventDispatcher dispatcher = new EventDispatcher(dispatchType, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
}
 
Example 4
Project: jdk8u-jdk   File: SunDragSourceContextPeer.java   View source code 6 votes vote down vote up
EventDispatcher(int dispatchType, DragSourceEvent event) {
    switch (dispatchType) {
    case DISPATCH_ENTER:
    case DISPATCH_MOTION:
    case DISPATCH_CHANGED:
    case DISPATCH_MOUSE_MOVED:
        if (!(event instanceof DragSourceDragEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    case DISPATCH_EXIT:
        break;
    case DISPATCH_FINISH:
        if (!(event instanceof DragSourceDropEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    default:
        throw new IllegalArgumentException("Dispatch type: " +
                                           dispatchType);
    }

    this.dispatchType  = dispatchType;
    this.event         = event;
}
 
Example 5
Project: openjdk-jdk10   File: SunDragSourceContextPeer.java   View source code 6 votes vote down vote up
protected final void postDragSourceDragEvent(final int targetAction,
                                             final int modifiers,
                                             final int x, final int y,
                                             final int dispatchType) {

    final int dropAction =
        SunDragSourceContextPeer.convertModifiersToDropAction(modifiers,
                                                              sourceActions);

    DragSourceDragEvent event =
        new DragSourceDragEvent(getDragSourceContext(),
                                dropAction,
                                targetAction & sourceActions,
                                modifiers, x, y);
    EventDispatcher dispatcher = new EventDispatcher(dispatchType, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
}
 
Example 6
Project: openjdk-jdk10   File: SunDragSourceContextPeer.java   View source code 6 votes vote down vote up
EventDispatcher(int dispatchType, DragSourceEvent event) {
    switch (dispatchType) {
    case DISPATCH_ENTER:
    case DISPATCH_MOTION:
    case DISPATCH_CHANGED:
    case DISPATCH_MOUSE_MOVED:
        if (!(event instanceof DragSourceDragEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    case DISPATCH_EXIT:
        break;
    case DISPATCH_FINISH:
        if (!(event instanceof DragSourceDropEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    default:
        throw new IllegalArgumentException("Dispatch type: " +
                                           dispatchType);
    }

    this.dispatchType  = dispatchType;
    this.event         = event;
}
 
Example 7
Project: openjdk9   File: SunDragSourceContextPeer.java   View source code 6 votes vote down vote up
protected final void postDragSourceDragEvent(final int targetAction,
                                             final int modifiers,
                                             final int x, final int y,
                                             final int dispatchType) {

    final int dropAction =
        SunDragSourceContextPeer.convertModifiersToDropAction(modifiers,
                                                              sourceActions);

    DragSourceDragEvent event =
        new DragSourceDragEvent(getDragSourceContext(),
                                dropAction,
                                targetAction & sourceActions,
                                modifiers, x, y);
    EventDispatcher dispatcher = new EventDispatcher(dispatchType, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
}
 
Example 8
Project: openjdk9   File: SunDragSourceContextPeer.java   View source code 6 votes vote down vote up
EventDispatcher(int dispatchType, DragSourceEvent event) {
    switch (dispatchType) {
    case DISPATCH_ENTER:
    case DISPATCH_MOTION:
    case DISPATCH_CHANGED:
    case DISPATCH_MOUSE_MOVED:
        if (!(event instanceof DragSourceDragEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    case DISPATCH_EXIT:
        break;
    case DISPATCH_FINISH:
        if (!(event instanceof DragSourceDropEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    default:
        throw new IllegalArgumentException("Dispatch type: " +
                                           dispatchType);
    }

    this.dispatchType  = dispatchType;
    this.event         = event;
}
 
Example 9
Project: KATscans   File: DraggableTree.java   View source code 6 votes vote down vote up
@Override
public void dragOver(DragSourceDragEvent dsde) {
    DragSourceContext context = dsde.getDragSourceContext();
    
    if (!checkDropValid()) {
        context.setCursor(DragSource.DefaultMoveNoDrop);
        return;
    }
    
    switch (dsde.getDropAction()) {
        case DnDConstants.ACTION_MOVE:
            context.setCursor(DragSource.DefaultMoveDrop);
            break;
        case DnDConstants.ACTION_COPY:
            context.setCursor(DragSource.DefaultCopyDrop);
            break;
        default:
            context.setCursor(DragSource.DefaultMoveNoDrop);
            break;
    }
}
 
Example 10
Project: jdk8u_jdk   File: SunDragSourceContextPeer.java   View source code 6 votes vote down vote up
protected final void postDragSourceDragEvent(final int targetAction,
                                             final int modifiers,
                                             final int x, final int y,
                                             final int dispatchType) {

    final int dropAction =
        SunDragSourceContextPeer.convertModifiersToDropAction(modifiers,
                                                              sourceActions);

    DragSourceDragEvent event =
        new DragSourceDragEvent(getDragSourceContext(),
                                dropAction,
                                targetAction & sourceActions,
                                modifiers, x, y);
    EventDispatcher dispatcher = new EventDispatcher(dispatchType, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
}
 
Example 11
Project: jdk8u_jdk   File: SunDragSourceContextPeer.java   View source code 6 votes vote down vote up
EventDispatcher(int dispatchType, DragSourceEvent event) {
    switch (dispatchType) {
    case DISPATCH_ENTER:
    case DISPATCH_MOTION:
    case DISPATCH_CHANGED:
    case DISPATCH_MOUSE_MOVED:
        if (!(event instanceof DragSourceDragEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    case DISPATCH_EXIT:
        break;
    case DISPATCH_FINISH:
        if (!(event instanceof DragSourceDropEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    default:
        throw new IllegalArgumentException("Dispatch type: " +
                                           dispatchType);
    }

    this.dispatchType  = dispatchType;
    this.event         = event;
}
 
Example 12
Project: lookaside_java-1.8.0-openjdk   File: SunDragSourceContextPeer.java   View source code 6 votes vote down vote up
protected final void postDragSourceDragEvent(final int targetAction,
                                             final int modifiers,
                                             final int x, final int y,
                                             final int dispatchType) {

    final int dropAction =
        SunDragSourceContextPeer.convertModifiersToDropAction(modifiers,
                                                              sourceActions);

    DragSourceDragEvent event =
        new DragSourceDragEvent(getDragSourceContext(),
                                dropAction,
                                targetAction & sourceActions,
                                modifiers, x, y);
    EventDispatcher dispatcher = new EventDispatcher(dispatchType, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
}
 
Example 13
Project: lookaside_java-1.8.0-openjdk   File: SunDragSourceContextPeer.java   View source code 6 votes vote down vote up
EventDispatcher(int dispatchType, DragSourceEvent event) {
    switch (dispatchType) {
    case DISPATCH_ENTER:
    case DISPATCH_MOTION:
    case DISPATCH_CHANGED:
    case DISPATCH_MOUSE_MOVED:
        if (!(event instanceof DragSourceDragEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    case DISPATCH_EXIT:
        break;
    case DISPATCH_FINISH:
        if (!(event instanceof DragSourceDropEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    default:
        throw new IllegalArgumentException("Dispatch type: " +
                                           dispatchType);
    }

    this.dispatchType  = dispatchType;
    this.event         = event;
}
 
Example 14
Project: Desktop   File: JhromeTabbedPaneUI.java   View source code 6 votes vote down vote up
@Override
public void dragMouseMoved(DragSourceDragEvent dsde) {
    if (dragInfo != null) {
        JhromeTabbedPaneUI draggedParent = SwingUtils.getJTabbedPaneAncestorUI(dragInfo.tab);
        if (draggedParent != null) {
            Point p = dsde.getLocation();
            SwingUtilities.convertPointFromScreen(p, draggedParent.tabbedPane);
            if (!Utils.contains(draggedParent.dropZone, p)) {
                dragOut(dsde.getDragSourceContext().getComponent(), dragInfo);
            }
        }

        if (dragInfo.floatingTabHandler != null) {
            dragInfo.floatingTabHandler.onFloatingTabDragged(dsde, dragInfo.tab, dragInfo.grabX);
        }
    }
}
 
Example 15
Project: infobip-open-jdk-8   File: SunDragSourceContextPeer.java   View source code 6 votes vote down vote up
protected final void postDragSourceDragEvent(final int targetAction,
                                             final int modifiers,
                                             final int x, final int y,
                                             final int dispatchType) {

    final int dropAction =
        SunDragSourceContextPeer.convertModifiersToDropAction(modifiers,
                                                              sourceActions);

    DragSourceDragEvent event =
        new DragSourceDragEvent(getDragSourceContext(),
                                dropAction,
                                targetAction & sourceActions,
                                modifiers, x, y);
    EventDispatcher dispatcher = new EventDispatcher(dispatchType, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
}
 
Example 16
Project: infobip-open-jdk-8   File: SunDragSourceContextPeer.java   View source code 6 votes vote down vote up
EventDispatcher(int dispatchType, DragSourceEvent event) {
    switch (dispatchType) {
    case DISPATCH_ENTER:
    case DISPATCH_MOTION:
    case DISPATCH_CHANGED:
    case DISPATCH_MOUSE_MOVED:
        if (!(event instanceof DragSourceDragEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    case DISPATCH_EXIT:
        break;
    case DISPATCH_FINISH:
        if (!(event instanceof DragSourceDropEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    default:
        throw new IllegalArgumentException("Dispatch type: " +
                                           dispatchType);
    }

    this.dispatchType  = dispatchType;
    this.event         = event;
}
 
Example 17
Project: jdk8u-dev-jdk   File: SunDragSourceContextPeer.java   View source code 6 votes vote down vote up
protected final void postDragSourceDragEvent(final int targetAction,
                                             final int modifiers,
                                             final int x, final int y,
                                             final int dispatchType) {

    final int dropAction =
        SunDragSourceContextPeer.convertModifiersToDropAction(modifiers,
                                                              sourceActions);

    DragSourceDragEvent event =
        new DragSourceDragEvent(getDragSourceContext(),
                                dropAction,
                                targetAction & sourceActions,
                                modifiers, x, y);
    EventDispatcher dispatcher = new EventDispatcher(dispatchType, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
}
 
Example 18
Project: jdk8u-dev-jdk   File: SunDragSourceContextPeer.java   View source code 6 votes vote down vote up
EventDispatcher(int dispatchType, DragSourceEvent event) {
    switch (dispatchType) {
    case DISPATCH_ENTER:
    case DISPATCH_MOTION:
    case DISPATCH_CHANGED:
    case DISPATCH_MOUSE_MOVED:
        if (!(event instanceof DragSourceDragEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    case DISPATCH_EXIT:
        break;
    case DISPATCH_FINISH:
        if (!(event instanceof DragSourceDropEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    default:
        throw new IllegalArgumentException("Dispatch type: " +
                                           dispatchType);
    }

    this.dispatchType  = dispatchType;
    this.event         = event;
}
 
Example 19
Project: incubator-netbeans   File: DnDSupport.java   View source code 5 votes vote down vote up
public void dragMouseMoved(DragSourceDragEvent e) {
    DragSourceContext context = e.getDragSourceContext();
    if( isButtonDrag ) {
        int action = e.getDropAction();
        if ((action & DnDConstants.ACTION_MOVE) != 0) {
            context.setCursor( dragMoveCursor );
        } else {
            if( isInToolbarPanel( e.getLocation() ) ) {
                context.setCursor( dragNoDropCursor );
            } else {
                context.setCursor( dragRemoveCursor );
            }
        }
    } else if( isToolbarDrag && null != dragWindow ) {
        Point p = new Point( e.getLocation() );
        p.x -= startingPoint.x;
        p.y -= startingPoint.y;
        dragWindow.setLocation(p);
        context.setCursor( Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR) );

        ToolbarRow row = config.getToolbarRowAt( e.getLocation() );
        if( null == row && (sourceRow.countVisibleToolbars() > 1 || !config.isLastRow(sourceRow)) ) {
            row = config.maybeAddEmptyRow( e.getLocation() );
        }

        ToolbarRow oldRow = currentRow;
        currentRow = row;
        if( null != oldRow && oldRow != currentRow ) {
            oldRow.hideDropFeedback();
            config.repaint();
        }
        if( null != currentRow )
            currentRow.showDropFeedback( sourceContainer, e.getLocation(), dragImage );
        if( !config.isLastRow(currentRow) )
            config.maybeRemoveLastRow();
    }
}
 
Example 20
Project: VASSAL-src   File: SetupStack.java   View source code 5 votes vote down vote up
public void dragMouseMoved(DragSourceDragEvent event) {
  if (!event.getLocation().equals(lastDragLocation)) {
    lastDragLocation = event.getLocation();
    moveDragCursor(event.getX(), event.getY());
    if (dragCursor != null && !dragCursor.isVisible()) {
      dragCursor.setVisible(true);
    }
  }
}
 
Example 21
Project: VASSAL-src   File: RegionGrid.java   View source code 5 votes vote down vote up
public void dragMouseMoved(DragSourceDragEvent event) {
  if (!event.getLocation().equals(lastDragLocation)) {
    lastDragLocation = event.getLocation();
    moveDragCursor(event.getX(), event.getY());
    if (dragCursor != null && !dragCursor.isVisible()) {
      dragCursor.setVisible(true);
    }
  }
}
 
Example 22
Project: VASSAL-src   File: PieceMover.java   View source code 5 votes vote down vote up
public void dragMouseMoved(DragSourceDragEvent e) {
  if (!e.getLocation().equals(lastDragLocation)) {
    lastDragLocation = e.getLocation();
    moveDragCursor(e.getX(), e.getY());
    if (dragCursor != null && !dragCursor.isVisible()) {
      dragCursor.setVisible(true);
    }
  }
}
 
Example 23
Project: OpenJSharp   File: SunDragSourceContextPeer.java   View source code 5 votes vote down vote up
public void run() {
    DragSourceContext dragSourceContext =
        SunDragSourceContextPeer.this.getDragSourceContext();
    try {
        switch (dispatchType) {
        case DISPATCH_ENTER:
            dragSourceContext.dragEnter((DragSourceDragEvent)event);
            break;
        case DISPATCH_MOTION:
            dragSourceContext.dragOver((DragSourceDragEvent)event);
            break;
        case DISPATCH_CHANGED:
            dragSourceContext.dropActionChanged((DragSourceDragEvent)event);
            break;
        case DISPATCH_EXIT:
            dragSourceContext.dragExit(event);
            break;
        case DISPATCH_MOUSE_MOVED:
            dragSourceContext.dragMouseMoved((DragSourceDragEvent)event);
            break;
        case DISPATCH_FINISH:
            try {
                dragSourceContext.dragDropEnd((DragSourceDropEvent)event);
            } finally {
                SunDragSourceContextPeer.this.cleanup();
            }
            break;
        default:
            throw new IllegalStateException("Dispatch type: " +
                                            dispatchType);
        }
    } finally {
         SunDragSourceContextPeer.this.quitSecondaryEventLoop();
    }
}
 
Example 24
Project: jdk8u-jdk   File: SunDragSourceContextPeer.java   View source code 5 votes vote down vote up
public void run() {
    DragSourceContext dragSourceContext =
        SunDragSourceContextPeer.this.getDragSourceContext();
    try {
        switch (dispatchType) {
        case DISPATCH_ENTER:
            dragSourceContext.dragEnter((DragSourceDragEvent)event);
            break;
        case DISPATCH_MOTION:
            dragSourceContext.dragOver((DragSourceDragEvent)event);
            break;
        case DISPATCH_CHANGED:
            dragSourceContext.dropActionChanged((DragSourceDragEvent)event);
            break;
        case DISPATCH_EXIT:
            dragSourceContext.dragExit(event);
            break;
        case DISPATCH_MOUSE_MOVED:
            dragSourceContext.dragMouseMoved((DragSourceDragEvent)event);
            break;
        case DISPATCH_FINISH:
            try {
                dragSourceContext.dragDropEnd((DragSourceDropEvent)event);
            } finally {
                SunDragSourceContextPeer.this.cleanup();
            }
            break;
        default:
            throw new IllegalStateException("Dispatch type: " +
                                            dispatchType);
        }
    } finally {
         SunDragSourceContextPeer.this.quitSecondaryEventLoop();
    }
}
 
Example 25
Project: openjdk-jdk10   File: SunDragSourceContextPeer.java   View source code 5 votes vote down vote up
public void run() {
    DragSourceContext dragSourceContext =
        SunDragSourceContextPeer.this.getDragSourceContext();
    try {
        switch (dispatchType) {
        case DISPATCH_ENTER:
            dragSourceContext.dragEnter((DragSourceDragEvent)event);
            break;
        case DISPATCH_MOTION:
            dragSourceContext.dragOver((DragSourceDragEvent)event);
            break;
        case DISPATCH_CHANGED:
            dragSourceContext.dropActionChanged((DragSourceDragEvent)event);
            break;
        case DISPATCH_EXIT:
            dragSourceContext.dragExit(event);
            break;
        case DISPATCH_MOUSE_MOVED:
            dragSourceContext.dragMouseMoved((DragSourceDragEvent)event);
            break;
        case DISPATCH_FINISH:
            try {
                dragSourceContext.dragDropEnd((DragSourceDropEvent)event);
            } finally {
                SunDragSourceContextPeer.this.cleanup();
            }
            break;
        default:
            throw new IllegalStateException("Dispatch type: " +
                                            dispatchType);
        }
    } finally {
         SunDragSourceContextPeer.this.quitSecondaryEventLoop();
    }
}
 
Example 26
Project: Logisim   File: JTreeUtil.java   View source code 5 votes vote down vote up
@Override
public final void dragEnter(DragSourceDragEvent dsde) {
	int action = dsde.getDropAction();
	if (action == DnDConstants.ACTION_COPY) {
		dsde.getDragSourceContext().setCursor(DragSource.DefaultCopyDrop);
	} else {
		if (action == DnDConstants.ACTION_MOVE) {
			dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveDrop);
		} else {
			dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveNoDrop);
		}
	}
}
 
Example 27
Project: Logisim   File: JTreeUtil.java   View source code 5 votes vote down vote up
@Override
public final void dragOver(DragSourceDragEvent dsde) {
	int action = dsde.getDropAction();
	if (action == DnDConstants.ACTION_COPY) {
		dsde.getDragSourceContext().setCursor(DragSource.DefaultCopyDrop);
	} else {
		if (action == DnDConstants.ACTION_MOVE) {
			dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveDrop);
		} else {
			dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveNoDrop);
		}
	}
}
 
Example 28
Project: Logisim   File: JTreeUtil.java   View source code 5 votes vote down vote up
@Override
public final void dropActionChanged(DragSourceDragEvent dsde) {
	int action = dsde.getDropAction();
	if (action == DnDConstants.ACTION_COPY) {
		dsde.getDragSourceContext().setCursor(DragSource.DefaultCopyDrop);
	} else {
		if (action == DnDConstants.ACTION_MOVE) {
			dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveDrop);
		} else {
			dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveNoDrop);
		}
	}
}
 
Example 29
Project: openjdk9   File: SunDragSourceContextPeer.java   View source code 5 votes vote down vote up
public void run() {
    DragSourceContext dragSourceContext =
        SunDragSourceContextPeer.this.getDragSourceContext();
    try {
        switch (dispatchType) {
        case DISPATCH_ENTER:
            dragSourceContext.dragEnter((DragSourceDragEvent)event);
            break;
        case DISPATCH_MOTION:
            dragSourceContext.dragOver((DragSourceDragEvent)event);
            break;
        case DISPATCH_CHANGED:
            dragSourceContext.dropActionChanged((DragSourceDragEvent)event);
            break;
        case DISPATCH_EXIT:
            dragSourceContext.dragExit(event);
            break;
        case DISPATCH_MOUSE_MOVED:
            dragSourceContext.dragMouseMoved((DragSourceDragEvent)event);
            break;
        case DISPATCH_FINISH:
            try {
                dragSourceContext.dragDropEnd((DragSourceDropEvent)event);
            } finally {
                SunDragSourceContextPeer.this.cleanup();
            }
            break;
        default:
            throw new IllegalStateException("Dispatch type: " +
                                            dispatchType);
        }
    } finally {
         SunDragSourceContextPeer.this.quitSecondaryEventLoop();
    }
}
 
Example 30
Project: SimBionic   File: SB_LocalsTree.java   View source code 5 votes vote down vote up
public void dragOver(DragSourceDragEvent event)
{
    if (ComponentRegistry.getContent().getActiveCanvas()._allowDrop)
        event.getDragSourceContext().setCursor(DragSource.DefaultCopyDrop);
    else
        event.getDragSourceContext().setCursor(DragSource.DefaultCopyNoDrop);
}
 
Example 31
Project: SimBionic   File: SB_Catalog.java   View source code 5 votes vote down vote up
public void dragOver(DragSourceDragEvent event)
{
    Point location = event.getLocation();
    Point screenLocation = getLocationOnScreen();
    TreePath treePath = getPathForLocation(location.x - screenLocation.x, location.y
            - screenLocation.y);
    if (treePath != null
            && ((_dragNode.getUserObject() instanceof SB_Function) || (_dragNode
                    .getUserObject() instanceof SB_Folder)))
    {
        DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) treePath
                .getLastPathComponent();
        if (treePath.getPathCount() == 2 || (treeNode.getUserObject() instanceof SB_Folder))
        {
            setSelectionPath(treePath);
            if (treeNode.getSharedAncestor(_dragNode) != _root)
                event.getDragSourceContext().setCursor(DragSource.DefaultCopyDrop);
            else
                event.getDragSourceContext().setCursor(DragSource.DefaultCopyNoDrop);
        } else
        {
            setSelectionInterval(_dragRow, _dragRow);
            event.getDragSourceContext().setCursor(DragSource.DefaultCopyDrop);
        }
        return;
    }

    setSelectionInterval(_dragRow, _dragRow);

    if (ComponentRegistry.getContent().getActiveCanvas()._allowDrop)
        event.getDragSourceContext().setCursor(DragSource.DefaultCopyDrop);
    else
        event.getDragSourceContext().setCursor(DragSource.DefaultCopyNoDrop);
}
 
Example 32
Project: jdk8u_jdk   File: SunDragSourceContextPeer.java   View source code 5 votes vote down vote up
public void run() {
    DragSourceContext dragSourceContext =
        SunDragSourceContextPeer.this.getDragSourceContext();
    try {
        switch (dispatchType) {
        case DISPATCH_ENTER:
            dragSourceContext.dragEnter((DragSourceDragEvent)event);
            break;
        case DISPATCH_MOTION:
            dragSourceContext.dragOver((DragSourceDragEvent)event);
            break;
        case DISPATCH_CHANGED:
            dragSourceContext.dropActionChanged((DragSourceDragEvent)event);
            break;
        case DISPATCH_EXIT:
            dragSourceContext.dragExit(event);
            break;
        case DISPATCH_MOUSE_MOVED:
            dragSourceContext.dragMouseMoved((DragSourceDragEvent)event);
            break;
        case DISPATCH_FINISH:
            try {
                dragSourceContext.dragDropEnd((DragSourceDropEvent)event);
            } finally {
                SunDragSourceContextPeer.this.cleanup();
            }
            break;
        default:
            throw new IllegalStateException("Dispatch type: " +
                                            dispatchType);
        }
    } finally {
         SunDragSourceContextPeer.this.quitSecondaryEventLoop();
    }
}
 
Example 33
Project: lookaside_java-1.8.0-openjdk   File: SunDragSourceContextPeer.java   View source code 5 votes vote down vote up
public void run() {
    DragSourceContext dragSourceContext =
        SunDragSourceContextPeer.this.getDragSourceContext();
    try {
        switch (dispatchType) {
        case DISPATCH_ENTER:
            dragSourceContext.dragEnter((DragSourceDragEvent)event);
            break;
        case DISPATCH_MOTION:
            dragSourceContext.dragOver((DragSourceDragEvent)event);
            break;
        case DISPATCH_CHANGED:
            dragSourceContext.dropActionChanged((DragSourceDragEvent)event);
            break;
        case DISPATCH_EXIT:
            dragSourceContext.dragExit(event);
            break;
        case DISPATCH_MOUSE_MOVED:
            dragSourceContext.dragMouseMoved((DragSourceDragEvent)event);
            break;
        case DISPATCH_FINISH:
            try {
                dragSourceContext.dragDropEnd((DragSourceDropEvent)event);
            } finally {
                SunDragSourceContextPeer.this.cleanup();
            }
            break;
        default:
            throw new IllegalStateException("Dispatch type: " +
                                            dispatchType);
        }
    } finally {
         SunDragSourceContextPeer.this.quitSecondaryEventLoop();
    }
}
 
Example 34
Project: javify   File: Demo.java   View source code 5 votes vote down vote up
public void dragEnter(DragSourceDragEvent e)
{
  DragSourceContext ctx = e.getDragSourceContext();

  int action = e.getDropAction();
  if ((action & DnDConstants.ACTION_COPY) != 0)
    ctx.setCursor(DragSource.DefaultCopyDrop);
  else
    ctx.setCursor(DragSource.DefaultCopyNoDrop);
}
 
Example 35
Project: javify   File: GtkDragSourceContextPeer.java   View source code 5 votes vote down vote up
/**
 * Called from native code.
 */

public void dragEnter(int action, int modifiers)
{
  context.dragEnter(new DragSourceDragEvent(context, action,
                                            action
                                                & context.getSourceActions(),
                                            modifiers));
}
 
Example 36
Project: javify   File: GtkDragSourceContextPeer.java   View source code 5 votes vote down vote up
public void dragMouseMoved(int action, int modifiers)
{
  context.dragMouseMoved(new DragSourceDragEvent(context,
                                                 action,
                                                 action
                                                     & context.getSourceActions(),
                                                 modifiers));
}
 
Example 37
Project: javify   File: GtkDragSourceContextPeer.java   View source code 5 votes vote down vote up
public void dragOver(int action, int modifiers)
{
  context.dragOver(new DragSourceDragEvent(context, action,
                                           action
                                               & context.getSourceActions(),
                                           modifiers));
}
 
Example 38
Project: javify   File: GtkDragSourceContextPeer.java   View source code 5 votes vote down vote up
public void dragActionChanged(int newAction, int modifiers)
{
  context.dropActionChanged(new DragSourceDragEvent(context,
                                                    newAction,
                                                    newAction
                                                        & context.getSourceActions(),
                                                    modifiers));
}
 
Example 39
Project: keystore-explorer   File: KeyStoreEntryDragGestureListener.java   View source code 5 votes vote down vote up
/**
 * Drag target entered.
 *
 * @param evt
 *            Drag event
 */
@Override
public void dragEnter(DragSourceDragEvent evt) {
	// Show drag cursor
	DragSourceContext ctx = evt.getDragSourceContext();
	ctx.setCursor(cursor);
}
 
Example 40
Project: PivotSlice   File: PivotSlice.java   View source code 5 votes vote down vote up
public void dragMouseMoved(DragSourceDragEvent dsde) {
	glassPane.setPoint(new Point(dsde.getLocation().x - PivotSlice.this.getX() + 5, 
			dsde.getLocation().y - PivotSlice.this.getY() + 5));
	if (firstCall) {
		glassPane.setVisible(true);
		firstCall = false;
	}
	glassPane.repaint();
}