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 mxRectangle
Scaled, translated bounding box of the selection cells.protected boolean
protected Object
protected mxRectangle
Scaled, translated bounds of the selection cells.protected Object[]
Holds the cells that are being moved by this handler.protected boolean
Specifies 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 boolean
Specifies if cloning by control-drag is enabled.protected boolean
Workaround for shift-key-state not correct in mouseReleased.protected DropTarget
Reference to the current drop target.static Cursor
Default is Cursor.DEFAULT_CURSOR.protected Object[]
protected ImageIcon
Holds the image that is being used for the preview.protected boolean
Specifies if the handler is enabled.protected Point
Holds the start location of the mouse gesture.static Cursor
Default is Cursor.HAND_CURSOR.protected mxGraphComponent
Reference to the enclosing graph component.protected boolean
Workaround for alt-key-state not correct in mouseReleased.protected boolean
Specifies if an image should be used for preview.protected Object
protected boolean
Specifies if this handler should be painted on top of all other components.protected boolean
Specifies if live preview should be used if possible.protected mxCellMarker
protected boolean
Specifies if the cell marker should be called (for splitting edges and dropping cells into groups).static Cursor
Default is Cursor.MOVE_CURSOR.protected boolean
Specifies if moving is enabled.protected mxMovePreview
protected Rectangle
protected boolean
Specifies if cells may be moved out of their parents.protected boolean
Specifies if moving is enabled.protected mxRectangle
Unscaled, untranslated bounding box of the selection cells.protected boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertPoint
(Point pt) protected MouseEvent
protected mxCellMarker
protected mxMovePreview
void
void
void
void
void
protected void
Object[]
protected Cursor
protected static final JComponent
Helper method to return the component for a drop target event.protected static final mxGraphTransferHandler
Helper method to return the component for a drop target event.protected Point
getPreviewLocation
(MouseEvent e, boolean gridEnabled) protected void
protected void
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
void
void
void
void
protected void
moveCells
(Object[] cells, double dx, double dy, Object target, MouseEvent e) void
void
reset()
void
setCenterPreview
(boolean value) void
setCloneEnabled
(boolean value) void
setEnabled
(boolean value) void
setImagePreview
(boolean value) void
setLivePreview
(boolean value) void
setMarker
(mxCellMarker value) void
setMarkerEnabled
(boolean value) void
setMoveEnabled
(boolean value) void
setPreviewBounds
(Rectangle bounds) void
setRemoveCellsFromParent
(boolean value) void
setSelectEnabled
(boolean value) void
setVisible
(boolean value) protected boolean
shouldRemoveCellFromParent
(Object parent, Object[] cells, MouseEvent e) Returns true if the given cells should be removed from the parent for the specified mousereleased event.void
start
(MouseEvent e) void
updateDragImage
(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:
mouseMoved
in interfaceMouseMotionListener
- Overrides:
mouseMoved
in classmxMouseAdapter
-
getCursor
-
dragEnter
- Specified by:
dragEnter
in interfaceDropTargetListener
-
mousePressed
- Specified by:
mousePressed
in interfaceMouseListener
- Overrides:
mousePressed
in classmxMouseAdapter
-
getCells
-
start
-
dropActionChanged
- Specified by:
dropActionChanged
in interfaceDropTargetListener
-
dragOver
- Specified by:
dragOver
in interfaceDropTargetListener
- Parameters:
e
-
-
convertPoint
-
mouseDragged
- Specified by:
mouseDragged
in interfaceMouseMotionListener
- Overrides:
mouseDragged
in classmxMouseAdapter
-
getPreviewLocation
-
dragExit
- Specified by:
dragExit
in interfaceDropTargetListener
- Parameters:
e
-
-
drop
- Specified by:
drop
in interfaceDropTargetListener
- Parameters:
e
-
-
mouseReleased
- Specified by:
mouseReleased
in interfaceMouseListener
- Overrides:
mouseReleased
in 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.
-