public class mxGraphHandler extends mxMouseAdapter implements java.awt.dnd.DropTargetListener
Modifier and Type | Field and Description |
---|---|
protected mxRectangle |
bbox
Scaled, translated bounding box of the selection cells.
|
protected boolean |
canImport |
protected java.lang.Object |
cell |
protected mxRectangle |
cellBounds
Scaled, translated bounds of the selection cells.
|
protected java.lang.Object[] |
cells
Holds the cells that are being moved by this handler.
|
protected boolean |
centerPreview
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 |
cloneEnabled
Specifies if cloning by control-drag is enabled.
|
protected boolean |
constrainedEvent
Workaround for shift-key-state not correct in mouseReleased.
|
protected java.awt.dnd.DropTarget |
currentDropTarget
Reference to the current drop target.
|
static java.awt.Cursor |
DEFAULT_CURSOR
Default is Cursor.DEFAULT_CURSOR.
|
protected java.lang.Object[] |
dragCells |
protected javax.swing.ImageIcon |
dragImage
Holds the image that is being used for the preview.
|
protected boolean |
enabled
Specifies if the handler is enabled.
|
protected java.awt.Point |
first
Holds the start location of the mouse gesture.
|
static java.awt.Cursor |
FOLD_CURSOR
Default is Cursor.HAND_CURSOR.
|
protected mxGraphComponent |
graphComponent
Reference to the enclosing graph component.
|
protected boolean |
gridEnabledEvent
Workaround for alt-key-state not correct in mouseReleased.
|
protected boolean |
imagePreview
Specifies if an image should be used for preview.
|
protected java.lang.Object |
initialCell |
protected boolean |
keepOnTop
Specifies if this handler should be painted on top of all other components.
|
protected boolean |
livePreview
Specifies if live preview should be used if possible.
|
protected mxCellMarker |
marker |
protected boolean |
markerEnabled
Specifies if the cell marker should be called (for splitting edges and
dropping cells into groups).
|
static java.awt.Cursor |
MOVE_CURSOR
Default is Cursor.MOVE_CURSOR.
|
protected boolean |
moveEnabled
Specifies if moving is enabled.
|
protected mxMovePreview |
movePreview |
protected java.awt.Rectangle |
previewBounds |
protected boolean |
removeCellsFromParent
Specifies if cells may be moved out of their parents.
|
protected boolean |
selectEnabled
Specifies if moving is enabled.
|
protected mxRectangle |
transferBounds
Unscaled, untranslated bounding box of the selection cells.
|
protected boolean |
visible |
Constructor and Description |
---|
mxGraphHandler(mxGraphComponent graphComponent) |
Modifier and Type | Method and Description |
---|---|
java.awt.Point |
convertPoint(java.awt.Point pt) |
protected java.awt.event.MouseEvent |
createEvent(java.awt.dnd.DropTargetEvent e) |
protected mxCellMarker |
createMarker() |
protected mxMovePreview |
createMovePreview() |
void |
dragEnter(java.awt.dnd.DropTargetDragEvent e) |
void |
dragExit(java.awt.dnd.DropTargetEvent e) |
void |
dragOver(java.awt.dnd.DropTargetDragEvent e) |
void |
drop(java.awt.dnd.DropTargetDropEvent e) |
void |
dropActionChanged(java.awt.dnd.DropTargetDragEvent e) |
protected void |
fold(java.lang.Object cell) |
java.lang.Object[] |
getCells(java.lang.Object initialCell) |
protected java.awt.Cursor |
getCursor(java.awt.event.MouseEvent e) |
protected static javax.swing.JComponent |
getDropTarget(java.awt.dnd.DropTargetEvent e)
Helper method to return the component for a drop target event.
|
mxGraphComponent |
getGraphComponent() |
protected static mxGraphTransferHandler |
getGraphTransferHandler(java.awt.dnd.DropTargetEvent e)
Helper method to return the component for a drop target event.
|
mxCellMarker |
getMarker() |
mxMovePreview |
getMovePreview() |
protected java.awt.Point |
getPreviewLocation(java.awt.event.MouseEvent e,
boolean gridEnabled) |
protected void |
installDragGestureHandler() |
protected void |
installDropTargetHandler() |
boolean |
isCenterPreview() |
boolean |
isCloneEnabled() |
boolean |
isEnabled() |
boolean |
isImagePreview() |
boolean |
isLivePreview() |
boolean |
isMarkerEnabled() |
boolean |
isMoveEnabled() |
boolean |
isRemoveCellsFromParent() |
boolean |
isSelectEnabled() |
boolean |
isVisible() |
void |
mouseDragged(java.awt.event.MouseEvent e) |
void |
mouseMoved(java.awt.event.MouseEvent e) |
void |
mousePressed(java.awt.event.MouseEvent e) |
void |
mouseReleased(java.awt.event.MouseEvent e) |
protected void |
moveCells(java.lang.Object[] cells,
double dx,
double dy,
java.lang.Object target,
java.awt.event.MouseEvent e) |
void |
paint(java.awt.Graphics g) |
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(java.awt.Rectangle bounds) |
void |
setRemoveCellsFromParent(boolean value) |
void |
setSelectEnabled(boolean value) |
void |
setVisible(boolean value) |
protected boolean |
shouldRemoveCellFromParent(java.lang.Object parent,
java.lang.Object[] cells,
java.awt.event.MouseEvent e)
Returns true if the given cells should be removed from the parent for the specified
mousereleased event.
|
void |
start(java.awt.event.MouseEvent e) |
void |
updateDragImage(java.lang.Object[] cells) |
mouseClicked, mouseEntered, mouseExited
public static java.awt.Cursor DEFAULT_CURSOR
public static java.awt.Cursor MOVE_CURSOR
public static java.awt.Cursor FOLD_CURSOR
protected mxGraphComponent graphComponent
protected boolean enabled
protected boolean cloneEnabled
protected boolean moveEnabled
protected boolean selectEnabled
protected boolean markerEnabled
protected boolean removeCellsFromParent
protected mxMovePreview movePreview
protected boolean livePreview
protected boolean imagePreview
protected boolean centerPreview
protected boolean keepOnTop
protected transient java.lang.Object[] cells
protected transient javax.swing.ImageIcon dragImage
protected transient java.awt.Point first
protected transient java.lang.Object cell
protected transient java.lang.Object initialCell
protected transient java.lang.Object[] dragCells
protected transient mxCellMarker marker
protected transient boolean canImport
protected transient mxRectangle cellBounds
protected transient mxRectangle bbox
protected transient mxRectangle transferBounds
protected transient boolean visible
protected transient java.awt.Rectangle previewBounds
protected transient boolean gridEnabledEvent
protected transient boolean constrainedEvent
protected transient java.awt.dnd.DropTarget currentDropTarget
public mxGraphHandler(mxGraphComponent graphComponent)
graphComponent
- protected void installDragGestureHandler()
protected void installDropTargetHandler()
public boolean isVisible()
public void setVisible(boolean value)
public void setPreviewBounds(java.awt.Rectangle bounds)
protected mxMovePreview createMovePreview()
public mxMovePreview getMovePreview()
protected mxCellMarker createMarker()
public mxGraphComponent getGraphComponent()
public boolean isEnabled()
public void setEnabled(boolean value)
public boolean isCloneEnabled()
public void setCloneEnabled(boolean value)
public boolean isMoveEnabled()
public void setMoveEnabled(boolean value)
public boolean isMarkerEnabled()
public void setMarkerEnabled(boolean value)
public mxCellMarker getMarker()
public void setMarker(mxCellMarker value)
public boolean isSelectEnabled()
public void setSelectEnabled(boolean value)
public boolean isRemoveCellsFromParent()
public void setRemoveCellsFromParent(boolean value)
public boolean isLivePreview()
public void setLivePreview(boolean value)
public boolean isImagePreview()
public void setImagePreview(boolean value)
public boolean isCenterPreview()
public void setCenterPreview(boolean value)
public void updateDragImage(java.lang.Object[] cells)
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
mouseMoved
in class mxMouseAdapter
protected java.awt.Cursor getCursor(java.awt.event.MouseEvent e)
public void dragEnter(java.awt.dnd.DropTargetDragEvent e)
dragEnter
in interface java.awt.dnd.DropTargetListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
mousePressed
in class mxMouseAdapter
public java.lang.Object[] getCells(java.lang.Object initialCell)
public void start(java.awt.event.MouseEvent e)
public void dropActionChanged(java.awt.dnd.DropTargetDragEvent e)
dropActionChanged
in interface java.awt.dnd.DropTargetListener
public void dragOver(java.awt.dnd.DropTargetDragEvent e)
dragOver
in interface java.awt.dnd.DropTargetListener
e
- public java.awt.Point convertPoint(java.awt.Point pt)
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseDragged
in class mxMouseAdapter
protected java.awt.Point getPreviewLocation(java.awt.event.MouseEvent e, boolean gridEnabled)
public void dragExit(java.awt.dnd.DropTargetEvent e)
dragExit
in interface java.awt.dnd.DropTargetListener
e
- public void drop(java.awt.dnd.DropTargetDropEvent e)
drop
in interface java.awt.dnd.DropTargetListener
e
- public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
mouseReleased
in class mxMouseAdapter
protected void fold(java.lang.Object cell)
public void reset()
protected boolean shouldRemoveCellFromParent(java.lang.Object parent, java.lang.Object[] cells, java.awt.event.MouseEvent e)
protected void moveCells(java.lang.Object[] cells, double dx, double dy, java.lang.Object target, java.awt.event.MouseEvent e)
dx
- dy
- e
- public void paint(java.awt.Graphics g)
protected java.awt.event.MouseEvent createEvent(java.awt.dnd.DropTargetEvent e)
protected static final mxGraphTransferHandler getGraphTransferHandler(java.awt.dnd.DropTargetEvent e)
protected static final javax.swing.JComponent getDropTarget(java.awt.dnd.DropTargetEvent e)
Copyright (c) 2010-2017 Gaudenz Alder, JGraph Ltd. All rights reserved.