Package com.mxgraph.swing.handler
Class mxGraphHandler
java.lang.Object
com.mxgraph.swing.util.mxMouseAdapter
com.mxgraph.swing.handler.mxGraphHandler
- All Implemented Interfaces:
DropTargetListener,MouseListener,MouseMotionListener,EventListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected mxRectangleScaled, translated bounding box of the selection cells.protected booleanprotected Objectprotected mxRectangleScaled, translated bounds of the selection cells.protected Object[]Holds the cells that are being moved by this handler.protected booleanSpecifies if the preview should be centered around the mouse cursor if there was no mouse click to define the offset within the shape (eg.protected booleanSpecifies if cloning by control-drag is enabled.protected booleanWorkaround for shift-key-state not correct in mouseReleased.protected DropTargetReference to the current drop target.static CursorDefault is Cursor.DEFAULT_CURSOR.protected Object[]protected ImageIconHolds the image that is being used for the preview.protected booleanSpecifies if the handler is enabled.protected PointHolds the start location of the mouse gesture.static CursorDefault is Cursor.HAND_CURSOR.protected mxGraphComponentReference to the enclosing graph component.protected booleanWorkaround for alt-key-state not correct in mouseReleased.protected booleanSpecifies if an image should be used for preview.protected Objectprotected booleanSpecifies if this handler should be painted on top of all other components.protected booleanSpecifies if live preview should be used if possible.protected mxCellMarkerprotected booleanSpecifies if the cell marker should be called (for splitting edges and dropping cells into groups).static CursorDefault is Cursor.MOVE_CURSOR.protected booleanSpecifies if moving is enabled.protected mxMovePreviewprotected Rectangleprotected booleanSpecifies if cells may be moved out of their parents.protected booleanSpecifies if moving is enabled.protected mxRectangleUnscaled, untranslated bounding box of the selection cells.protected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertPoint(Point pt) protected MouseEventprotected mxCellMarkerprotected mxMovePreviewvoidvoidvoidvoidvoidprotected voidObject[]protected Cursorprotected static final JComponentHelper method to return the component for a drop target event.protected static final mxGraphTransferHandlerHelper method to return the component for a drop target event.protected PointgetPreviewLocation(MouseEvent e, boolean gridEnabled) protected voidprotected voidbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanvoidvoidvoidvoidprotected voidmoveCells(Object[] cells, double dx, double dy, Object target, MouseEvent e) voidvoidreset()voidsetCenterPreview(boolean value) voidsetCloneEnabled(boolean value) voidsetEnabled(boolean value) voidsetImagePreview(boolean value) voidsetLivePreview(boolean value) voidsetMarker(mxCellMarker value) voidsetMarkerEnabled(boolean value) voidsetMoveEnabled(boolean value) voidsetPreviewBounds(Rectangle bounds) voidsetRemoveCellsFromParent(boolean value) voidsetSelectEnabled(boolean value) voidsetVisible(boolean value) protected booleanshouldRemoveCellFromParent(Object parent, Object[] cells, MouseEvent e) Returns true if the given cells should be removed from the parent for the specified mousereleased event.voidstart(MouseEvent e) voidupdateDragImage(Object[] cells) Methods inherited from class com.mxgraph.swing.util.mxMouseAdapter
mouseClicked, mouseEntered, mouseExited
-
Field Details
-
DEFAULT_CURSOR
Default is Cursor.DEFAULT_CURSOR. -
MOVE_CURSOR
Default is Cursor.MOVE_CURSOR. -
FOLD_CURSOR
Default is Cursor.HAND_CURSOR. -
graphComponent
Reference to the enclosing graph component. -
enabled
protected boolean enabledSpecifies if the handler is enabled. Default is true. -
cloneEnabled
protected boolean cloneEnabledSpecifies if cloning by control-drag is enabled. Default is true. -
moveEnabled
protected boolean moveEnabledSpecifies if moving is enabled. Default is true. -
selectEnabled
protected boolean selectEnabledSpecifies if moving is enabled. Default is true. -
markerEnabled
protected boolean markerEnabledSpecifies if the cell marker should be called (for splitting edges and dropping cells into groups). Default is true. -
removeCellsFromParent
protected boolean removeCellsFromParentSpecifies if cells may be moved out of their parents. Default is true. -
movePreview
-
livePreview
protected boolean livePreviewSpecifies if live preview should be used if possible. Default is false. -
imagePreview
protected boolean imagePreviewSpecifies if an image should be used for preview. Default is true. -
centerPreview
protected boolean centerPreviewSpecifies if the preview should be centered around the mouse cursor if there was no mouse click to define the offset within the shape (eg. drag from external source). Default is true. -
keepOnTop
protected boolean keepOnTopSpecifies if this handler should be painted on top of all other components. Default is true. -
cells
Holds the cells that are being moved by this handler. -
dragImage
Holds the image that is being used for the preview. -
first
Holds the start location of the mouse gesture. -
cell
-
initialCell
-
dragCells
-
marker
-
canImport
protected transient boolean canImport -
cellBounds
Scaled, translated bounds of the selection cells. -
bbox
Scaled, translated bounding box of the selection cells. -
transferBounds
Unscaled, untranslated bounding box of the selection cells. -
visible
protected transient boolean visible -
previewBounds
-
gridEnabledEvent
protected transient boolean gridEnabledEventWorkaround for alt-key-state not correct in mouseReleased. Note: State of the alt-key is not available during drag-and-drop. -
constrainedEvent
protected transient boolean constrainedEventWorkaround for shift-key-state not correct in mouseReleased. -
currentDropTarget
Reference to the current drop target.
-
-
Constructor Details
-
mxGraphHandler
- Parameters:
graphComponent-
-
-
Method Details
-
installDragGestureHandler
protected void installDragGestureHandler() -
installDropTargetHandler
protected void installDropTargetHandler() -
isVisible
public boolean isVisible() -
setVisible
public void setVisible(boolean value) -
setPreviewBounds
-
createMovePreview
-
getMovePreview
-
createMarker
-
getGraphComponent
-
isEnabled
public boolean isEnabled() -
setEnabled
public void setEnabled(boolean value) -
isCloneEnabled
public boolean isCloneEnabled() -
setCloneEnabled
public void setCloneEnabled(boolean value) -
isMoveEnabled
public boolean isMoveEnabled() -
setMoveEnabled
public void setMoveEnabled(boolean value) -
isMarkerEnabled
public boolean isMarkerEnabled() -
setMarkerEnabled
public void setMarkerEnabled(boolean value) -
getMarker
-
setMarker
-
isSelectEnabled
public boolean isSelectEnabled() -
setSelectEnabled
public void setSelectEnabled(boolean value) -
isRemoveCellsFromParent
public boolean isRemoveCellsFromParent() -
setRemoveCellsFromParent
public void setRemoveCellsFromParent(boolean value) -
isLivePreview
public boolean isLivePreview() -
setLivePreview
public void setLivePreview(boolean value) -
isImagePreview
public boolean isImagePreview() -
setImagePreview
public void setImagePreview(boolean value) -
isCenterPreview
public boolean isCenterPreview() -
setCenterPreview
public void setCenterPreview(boolean value) -
updateDragImage
-
mouseMoved
- Specified by:
mouseMovedin interfaceMouseMotionListener- Overrides:
mouseMovedin classmxMouseAdapter
-
getCursor
-
dragEnter
- Specified by:
dragEnterin interfaceDropTargetListener
-
mousePressed
- Specified by:
mousePressedin interfaceMouseListener- Overrides:
mousePressedin classmxMouseAdapter
-
getCells
-
start
-
dropActionChanged
- Specified by:
dropActionChangedin interfaceDropTargetListener
-
dragOver
- Specified by:
dragOverin interfaceDropTargetListener- Parameters:
e-
-
convertPoint
-
mouseDragged
- Specified by:
mouseDraggedin interfaceMouseMotionListener- Overrides:
mouseDraggedin classmxMouseAdapter
-
getPreviewLocation
-
dragExit
- Specified by:
dragExitin interfaceDropTargetListener- Parameters:
e-
-
drop
- Specified by:
dropin interfaceDropTargetListener- Parameters:
e-
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener- Overrides:
mouseReleasedin classmxMouseAdapter
-
fold
-
reset
public void reset() -
shouldRemoveCellFromParent
Returns true if the given cells should be removed from the parent for the specified mousereleased event. -
moveCells
- Parameters:
dx-dy-e-
-
paint
-
createEvent
-
getGraphTransferHandler
Helper method to return the component for a drop target event. -
getDropTarget
Helper method to return the component for a drop target event.
-