public class mxEdgeHandler extends mxCellHandler
Modifier and Type | Field and Description |
---|---|
protected boolean |
cloneEnabled |
protected boolean |
constrainedEvent
Workaround for shift-key-state not correct in mouseReleased.
|
protected java.lang.String |
error |
protected boolean |
gridEnabledEvent
Workaround for alt-key-state not correct in mouseReleased.
|
protected mxCellMarker |
marker |
protected java.awt.Point[] |
p |
bounds, first, graphComponent, handles, handlesVisible, index, preview, state
Constructor and Description |
---|
mxEdgeHandler(mxGraphComponent graphComponent,
mxCellState state) |
Modifier and Type | Method and Description |
---|---|
protected void |
connect(java.lang.Object edge,
java.lang.Object terminal,
boolean isSource,
boolean isClone)
Connects the given edge to the given source or target terminal.
|
protected mxPoint |
convertPoint(mxPoint point,
boolean gridEnabled) |
protected java.awt.Rectangle |
createHandle(java.awt.Point center) |
protected java.awt.Rectangle |
createHandle(java.awt.Point center,
int size) |
protected java.awt.Rectangle[] |
createHandles()
Creates the rectangles that define the handles.
|
protected java.awt.Point[] |
createPoints(mxCellState s) |
protected javax.swing.JComponent |
createPreview()
Creates the preview for this handler.
|
protected java.awt.Cursor |
getCursor(java.awt.event.MouseEvent e,
int index)
Returns the cursor for the given event and handle.
|
protected java.awt.Color |
getHandleFillColor(int index)
Returns the color to be used to fill the handle at the specified index.
|
int |
getIndexAt(int x,
int y)
Returns the index of the handle at the given location.
|
protected java.awt.Rectangle |
getPreviewBounds() |
java.awt.Color |
getSelectionColor()
Returns the color used to draw the selection border.
|
java.awt.Stroke |
getSelectionStroke()
Returns the stroke used to draw the selection border.
|
protected boolean |
isCellBendable() |
boolean |
isCloneEnabled() |
protected boolean |
isFlipEvent(java.awt.event.MouseEvent e) |
protected boolean |
isHandleVisible(int index)
Hides the middle handle if the edge is not bendable.
|
protected boolean |
isIgnoredEvent(java.awt.event.MouseEvent e)
No flip event is ignored.
|
boolean |
isSource(int index)
Returns true if the current index is 0.
|
boolean |
isTarget(int index)
Returns true if the current index is the last index.
|
void |
mouseDragged(java.awt.event.MouseEvent e)
Processes the given event.
|
void |
mousePressed(java.awt.event.MouseEvent e)
Processes the given event.
|
void |
mouseReleased(java.awt.event.MouseEvent e)
Processes the given event.
|
protected void |
moveLabelTo(mxCellState edgeState,
double x,
double y)
Moves the label to the given position.
|
protected void |
movePoint(java.lang.Object edge,
int pointIndex,
mxPoint point)
Moves the edges control point with the given index to the given point.
|
void |
paint(java.awt.Graphics g)
Paints the visible handles of this handler.
|
void |
reset()
Extends the implementation to reset the current error and marker.
|
void |
setCloneEnabled(boolean cloneEnabled) |
java.lang.String |
validateConnection(java.lang.Object source,
java.lang.Object target)
Returns the error message or an empty string if the connection for the
given source target pair is not valid.
|
destroy, getBounds, getGraphComponent, getHandleBorderColor, getHandleCount, getIndex, getState, getToolTipText, isActive, isHandleEnabled, isHandlesVisible, isLabel, isLabelMovable, mouseMoved, refresh, setHandlesVisible, start
protected boolean cloneEnabled
protected java.awt.Point[] p
protected transient java.lang.String error
protected transient boolean gridEnabledEvent
protected transient boolean constrainedEvent
protected mxCellMarker marker
public mxEdgeHandler(mxGraphComponent graphComponent, mxCellState state)
graphComponent
- state
- public void setCloneEnabled(boolean cloneEnabled)
public boolean isCloneEnabled()
protected boolean isIgnoredEvent(java.awt.event.MouseEvent e)
isIgnoredEvent
in class mxCellHandler
protected boolean isFlipEvent(java.awt.event.MouseEvent e)
public java.lang.String validateConnection(java.lang.Object source, java.lang.Object target)
public boolean isSource(int index)
public boolean isTarget(int index)
protected boolean isHandleVisible(int index)
isHandleVisible
in class mxCellHandler
protected boolean isCellBendable()
protected java.awt.Rectangle[] createHandles()
mxCellHandler
createHandles
in class mxCellHandler
protected java.awt.Color getHandleFillColor(int index)
mxCellHandler
getHandleFillColor
in class mxCellHandler
public int getIndexAt(int x, int y)
mxCellHandler
getIndexAt
in class mxCellHandler
x
- y
- protected java.awt.Rectangle createHandle(java.awt.Point center)
protected java.awt.Rectangle createHandle(java.awt.Point center, int size)
protected java.awt.Point[] createPoints(mxCellState s)
protected javax.swing.JComponent createPreview()
mxCellHandler
createPreview
in class mxCellHandler
protected mxPoint convertPoint(mxPoint point, boolean gridEnabled)
point
- gridEnabled
- protected java.awt.Rectangle getPreviewBounds()
public void mousePressed(java.awt.event.MouseEvent e)
mxCellHandler
mousePressed
in class mxCellHandler
public void mouseDragged(java.awt.event.MouseEvent e)
mxCellHandler
mouseDragged
in class mxCellHandler
public void mouseReleased(java.awt.event.MouseEvent e)
mxCellHandler
mouseReleased
in class mxCellHandler
public void reset()
reset
in class mxCellHandler
protected void movePoint(java.lang.Object edge, int pointIndex, mxPoint point)
protected void connect(java.lang.Object edge, java.lang.Object terminal, boolean isSource, boolean isClone)
edge
- terminal
- isSource
- protected void moveLabelTo(mxCellState edgeState, double x, double y)
protected java.awt.Cursor getCursor(java.awt.event.MouseEvent e, int index)
mxCellHandler
getCursor
in class mxCellHandler
public java.awt.Color getSelectionColor()
mxCellHandler
getSelectionColor
in class mxCellHandler
public java.awt.Stroke getSelectionStroke()
mxCellHandler
getSelectionStroke
in class mxCellHandler
public void paint(java.awt.Graphics g)
mxCellHandler
paint
in class mxCellHandler
Copyright (c) 2010 Gaudenz Alder, David Benson. All rights reserved.