Class PieceMover.DragHandler
java.lang.Object
VASSAL.build.module.map.PieceMover.AbstractDragHandler
VASSAL.build.module.map.PieceMover.DragHandler
- All Implemented Interfaces:
DragGestureListener, DragSourceListener, DragSourceMotionListener, DropTargetListener, EventListener
- Direct Known Subclasses:
PieceMover.DragHandlerMacOSX
- Enclosing class:
PieceMover
VASSAL's front-line drag handler for drag-and-drop of pieces.
Implementation of AbstractDragHandler when DragImage is supported by JRE.
PieceMover.DragHandlerMacOSX extends this for special Mac platform- Author:
- Pieter Geerkens
-
Nested Class Summary
Nested classes/interfaces inherited from class PieceMover.AbstractDragHandler
PieceMover.AbstractDragHandler.AbstractDragHandlerFactoryModifier and TypeClassDescriptionstatic classPicks the correct drag handler based on our OS, DragSource, and preferences. -
Field Summary
Fields inherited from class PieceMover.AbstractDragHandler
boundingBox, boundingBoxComp, currentPieceOffsetX, currentPieceOffsetY, CURSOR_ALPHA, dragCursor, dragCursorZoom, dragPieceOffCenterZoom, dropTargetListeners, EXTRA_BORDER, lastDragLocation, pieceMoversModifier and TypeFieldDescriptionprotected Rectangleprotected Rectangleprotected intprotected intprotected static final intprotected JLabelprotected doubleprotected doubleprotected Map<Component, DropTargetListener> protected static final intprotected Pointprotected static List<PieceMover> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDRAG GESTURE LISTENER INTERFACE EVENT uses SCALED, DRAG-SOURCE coordinate system.protected doubleprotected doubleprotected intMethods inherited from class PieceMover.AbstractDragHandler
addPieceMover, beginDragging, calcDrawOffset, dragDropEnd, dragEnter, dragEnter, dragExit, dragExit, dragGestureRecognizedPrep, dragMouseMoved, dragOver, dragOver, drop, dropActionChanged, dropActionChanged, getListener, getTheDragHandler, makeDragCursor, makeDragImageCursorCommon, makeDragImageCursorCommon, makeDropTarget, moveDragCursor, removeDragCursor, removeDropTarget, resetDragHandler, resetRecursivePieceSlots, setDrawWinToOwnerOf, setTheDragHandlerModifier and TypeMethodDescriptionstatic voidRegisters a PieceMoverprotected voidThe the Drag Gesture Recognizer that we're officially beginning a drag.protected voidcalculates the offset between cursor dragCursor positionsvoidDRAG SOURCE LISTENER INTERFACEvoidvoidDROP TARGET INTERFACE EVENT uses UNSCALED, DROP-TARGET coordinate system dragEnter - switches current drawWin when mouse enters a new DropTargetvoidvoidPasses event along listener chainprotected PointSets things up at the beginning of a drag-and-drop operation:
- Screen out any immovable pieces
- Account for any offsets on in the window
- Sets dragWin to our source windowvoidDRAG SOURCE MOTION LISTENER INTERFACE EVENT uses UNSCALED, SCREEN coordinate system Moves cursor after mouse.voidvoidPasses event along listener chainvoidDROP TARGET INTERFACE EVENT uses UNSCALED, DROP-TARGET coordinate system drop() - Last event of the drop operation.voidvoidPasses event along listener chainprotected DropTargetListenerreturns the singleton DragHandler instanceprotected voidmakeDragCursor(double zoom) Deprecated, for removal: This API element is subject to removal in a future version.protected BufferedImagemakeDragImageCursorCommon(double zoom, boolean doOffset, Component target, boolean setSize) Deprecated, for removal: This API element is subject to removal in a future version.protected BufferedImagemakeDragImageCursorCommon(double mapzoom, double os_scale, boolean doOffset, Component target) static DropTargetmakeDropTarget(Component theComponent, int dndContants, DropTargetListener dropTargetListener) Creates a new DropTarget and hooks us into the beginning of a DropTargetListener chain.protected voidmoveDragCursor(int dragX, int dragY) Deprecated, for removal: This API element is subject to removal in a future version.protected voidDeprecated, for removal: This API element is subject to removal in a future version.static voidremoveDropTarget(Component theComponent) Removes a dropTarget componentstatic voidReset our drag handler, e.g. if our preferences change.static voidFinds all the piece slots in a module and resets their drop targets to use a new DragHandlervoidsetDrawWinToOwnerOf(Component newDropWin) Deprecated, for removal: This API element is subject to removal in a future version.static voidsetTheDragHandler(PieceMover.AbstractDragHandler myHandler)
-
Constructor Details
-
DragHandler
public DragHandler()
-
-
Method Details
-
dragGestureRecognized
Description copied from class:PieceMover.AbstractDragHandlerDRAG GESTURE LISTENER INTERFACE EVENT uses SCALED, DRAG-SOURCE coordinate system. ("component coordinates") PIECE uses SCALED, OWNER (arbitrary) coordinate system ("map coordinates") Fires after user begins moving the mouse several pixels over a map. This method will be overridden, but called as a super(), by the Drag Gesture extension that is used, which will either bePieceMover.DragHandlerif DragImage is supported by the JRE, orPieceMover.DragHandlerNoImageif not. Either one will have calledPieceMover.AbstractDragHandler.dragGestureRecognizedPrep(java.awt.dnd.DragGestureEvent), immediately below, before it calls this method.- Specified by:
dragGestureRecognizedin interfaceDragGestureListener- Overrides:
dragGestureRecognizedin classPieceMover.AbstractDragHandler
-
getOffsetMult
protected int getOffsetMult()- Specified by:
getOffsetMultin classPieceMover.AbstractDragHandler- Returns:
- platform-dependent offset multiplier
-
getDeviceScale
- Specified by:
getDeviceScalein classPieceMover.AbstractDragHandler- Parameters:
dge- DG event- Returns:
- platform-dependent device scale
-
getDeviceScale
- Specified by:
getDeviceScalein classPieceMover.AbstractDragHandler
-