Java Code Examples for java.awt.dnd.DragSourceDragEvent#getDropAction()

The following examples show how to use java.awt.dnd.DragSourceDragEvent#getDropAction() . 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: DnDSupport.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void dragMouseMoved(DragSourceDragEvent e) {
    Point location = WindowDnDManager.getLocationWorkaround(e);
    DragSourceContext context = e.getDragSourceContext();
    if( isButtonDrag ) {
        int action = e.getDropAction();
        if ((action & DnDConstants.ACTION_MOVE) != 0) {
            context.setCursor( dragMoveCursor );
        } else {
            if( isInToolbarPanel( location ) ) {
                context.setCursor( dragNoDropCursor );
            } else {
                context.setCursor( dragRemoveCursor );
            }
        }
    } else if( isToolbarDrag && null != dragWindow ) {
        Point p = new Point( location );
        p.x -= startingPoint.x;
        p.y -= startingPoint.y;
        dragWindow.setLocation(p);
        context.setCursor( Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR) );

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

        ToolbarRow oldRow = currentRow;
        currentRow = row;
        if( null != oldRow && oldRow != currentRow ) {
            oldRow.hideDropFeedback();
            config.repaint();
        }
        if( null != currentRow )
            currentRow.showDropFeedback( sourceContainer, location, dragImage );
        if( !config.isLastRow(currentRow) )
            config.maybeRemoveLastRow();
    }
}
 
Example 2
Source File: JTreeUtil.java    From Logisim with GNU General Public License v3.0 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 3
Source File: JTreeUtil.java    From Logisim with GNU General Public License v3.0 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 4
Source File: JTreeUtil.java    From Logisim with GNU General Public License v3.0 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 5
Source File: AbstractTreeTransferHandler.java    From binnavi with Apache License 2.0 5 votes vote down vote up
@Override
public final void dragEnter(final DragSourceDragEvent dsde) {
  final 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 6
Source File: AbstractTreeTransferHandler.java    From binnavi with Apache License 2.0 5 votes vote down vote up
@Override
public final void dragOver(final DragSourceDragEvent dsde) {
  final 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 7
Source File: AbstractTreeTransferHandler.java    From binnavi with Apache License 2.0 5 votes vote down vote up
@Override
public final void dropActionChanged(final DragSourceDragEvent dsde) {
  final 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 8
Source File: DBTableInternalFrame.java    From nextreports-designer with Apache License 2.0 5 votes vote down vote up
public void dragEnter(DragSourceDragEvent dsde) {
    // Point point = dsde.getLocation();
    // if (columnsListBox.getBounds().contains(point)) {
    // dsde.getDragSourceContext().setCursor(DragSource.DefaultLinkNoDrop);
    // return;
    // }
    gestureStarted = true;            
    if ((dsde.getDropAction() & DnDConstants.ACTION_MOVE) == DnDConstants.ACTION_MOVE) {
        dsde.getDragSourceContext().setCursor(DragSource.DefaultLinkDrop);
    }
}
 
Example 9
Source File: DBBrowserTree.java    From nextreports-designer with Apache License 2.0 5 votes vote down vote up
public void dragEnter(DragSourceDragEvent dsde) {
	if ((dsde.getDropAction() & DnDConstants.ACTION_MOVE) == DnDConstants.ACTION_MOVE) {
		dsde.getDragSourceContext().setCursor(DragSource.DefaultLinkDrop);
	} else {
		dsde.getDragSourceContext().setCursor(DragSource.DefaultLinkNoDrop);
	}
}
 
Example 10
Source File: DBBrowserTree.java    From nextreports-designer with Apache License 2.0 5 votes vote down vote up
private void setCursor(DragSourceDragEvent dsde) {
	int action = dsde.getDropAction();
	// @todo ACTION_NONE must be removed : but somehow no action is
	// passed here for ACTION_COPY
	if ((action == DnDConstants.ACTION_COPY) || (action == DnDConstants.ACTION_NONE)) {
		// 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 11
Source File: AbstractTreeTransferHandler.java    From TrakEM2 with GNU General Public License v3.0 5 votes vote down vote up
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 12
Source File: AbstractTreeTransferHandler.java    From TrakEM2 with GNU General Public License v3.0 5 votes vote down vote up
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 13
Source File: AbstractTreeTransferHandler.java    From TrakEM2 with GNU General Public License v3.0 5 votes vote down vote up
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);
                }
        }
}