public class mxGraphHandler extends mxMouseAdapter implements DropTargetListener
Modifier and Type | Field and Description |
---|---|
protected mxRectangle |
bbox
Scaled, translated bounding box of the selection cells.
|
protected boolean |
canImport |
protected Object |
cell |
protected mxRectangle |
cellBounds
Scaled, translated bounds of the selection cells.
|
protected 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 DropTarget |
currentDropTarget
Reference to the current drop target.
|
static Cursor |
DEFAULT_CURSOR
Default is Cursor.DEFAULT_CURSOR.
|
protected Object[] |
dragCells |
protected ImageIcon |
dragImage
Holds the image that is being used for the preview.
|
protected boolean |
enabled
Specifies if the handler is enabled.
|
protected Point |
first
Holds the start location of the mouse gesture.
|
static 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 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 Cursor |
MOVE_CURSOR
Default is Cursor.MOVE_CURSOR.
|
protected boolean |
moveEnabled
Specifies if moving is enabled.
|
protected mxMovePreview |
movePreview |
protected 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) |
mouseClicked, mouseEntered, mouseExited
public static Cursor DEFAULT_CURSOR
public static Cursor MOVE_CURSOR
public static 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 Object[] cells
protected transient ImageIcon dragImage
protected transient Point first
protected transient Object cell
protected transient Object initialCell
protected transient 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 Rectangle previewBounds
protected transient boolean gridEnabledEvent
protected transient boolean constrainedEvent
protected transient DropTarget currentDropTarget
public mxGraphHandler(mxGraphComponent graphComponent)
graphComponent
- protected void installDragGestureHandler()
protected void installDropTargetHandler()
public boolean isVisible()
public void setVisible(boolean value)
public void setPreviewBounds(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(Object[] cells)
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
mouseMoved
in class mxMouseAdapter
protected Cursor getCursor(MouseEvent e)
public void dragEnter(DropTargetDragEvent e)
dragEnter
in interface DropTargetListener
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
mousePressed
in class mxMouseAdapter
public void start(MouseEvent e)
public void dropActionChanged(DropTargetDragEvent e)
dropActionChanged
in interface DropTargetListener
public void dragOver(DropTargetDragEvent e)
dragOver
in interface DropTargetListener
e
- public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
mouseDragged
in class mxMouseAdapter
protected Point getPreviewLocation(MouseEvent e, boolean gridEnabled)
public void dragExit(DropTargetEvent e)
dragExit
in interface DropTargetListener
e
- public void drop(DropTargetDropEvent e)
drop
in interface DropTargetListener
e
- public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
mouseReleased
in class mxMouseAdapter
protected void fold(Object cell)
public void reset()
protected boolean shouldRemoveCellFromParent(Object parent, Object[] cells, MouseEvent e)
protected void moveCells(Object[] cells, double dx, double dy, Object target, MouseEvent e)
dx
- dy
- e
- public void paint(Graphics g)
protected MouseEvent createEvent(DropTargetEvent e)
protected static final mxGraphTransferHandler getGraphTransferHandler(DropTargetEvent e)
protected static final JComponent getDropTarget(DropTargetEvent e)
Copyright (c) 2010 Gaudenz Alder, David Benson. All rights reserved.