Package com.mxgraph.swing.handler
Class mxEdgeHandler
java.lang.Object
com.mxgraph.swing.handler.mxCellHandler
com.mxgraph.swing.handler.mxEdgeHandler
- Direct Known Subclasses:
mxElbowEdgeHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected boolean
Workaround for shift-key-state not correct in mouseReleased.protected String
protected boolean
Workaround for alt-key-state not correct in mouseReleased.protected mxCellMarker
protected Point[]
Fields inherited from class com.mxgraph.swing.handler.mxCellHandler
bounds, first, graphComponent, handles, handlesVisible, index, preview, state
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Connects the given edge to the given source or target terminal.protected mxPoint
convertPoint
(mxPoint point, boolean gridEnabled) protected Rectangle
createHandle
(Point center) protected Rectangle
createHandle
(Point center, int size) protected Rectangle[]
Creates the rectangles that define the handles.protected Point[]
protected JComponent
Creates the preview for this handler.protected Cursor
getCursor
(MouseEvent e, int index) Returns the cursor for the given event and handle.protected 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 Rectangle
Returns the color used to draw the selection border.Returns the stroke used to draw the selection border.protected boolean
boolean
protected boolean
protected boolean
isHandleVisible
(int index) Hides the middle handle if the edge is not bendable.protected boolean
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
Processes the given event.void
Processes the given event.void
Processes the given event.protected void
moveLabelTo
(mxCellState edgeState, double x, double y) Moves the label to the given position.protected void
Moves the edges control point with the given index to the given point.void
Paints the visible handles of this handler.void
reset()
Extends the implementation to reset the current error and marker.void
setCloneEnabled
(boolean cloneEnabled) validateConnection
(Object source, Object target) Returns the error message or an empty string if the connection for the given source target pair is not valid.Methods inherited from class com.mxgraph.swing.handler.mxCellHandler
destroy, getBounds, getGraphComponent, getHandleBorderColor, getHandleCount, getIndex, getState, getToolTipText, isActive, isHandleEnabled, isHandlesVisible, isLabel, isLabelMovable, mouseMoved, refresh, setHandlesVisible, start
-
Field Details
-
cloneEnabled
protected boolean cloneEnabled -
p
-
error
-
gridEnabledEvent
protected transient boolean gridEnabledEventWorkaround for alt-key-state not correct in mouseReleased. -
constrainedEvent
protected transient boolean constrainedEventWorkaround for shift-key-state not correct in mouseReleased. -
marker
-
-
Constructor Details
-
mxEdgeHandler
- Parameters:
graphComponent
-state
-
-
-
Method Details
-
setCloneEnabled
public void setCloneEnabled(boolean cloneEnabled) -
isCloneEnabled
public boolean isCloneEnabled() -
isIgnoredEvent
No flip event is ignored.- Overrides:
isIgnoredEvent
in classmxCellHandler
-
isFlipEvent
-
validateConnection
Returns the error message or an empty string if the connection for the given source target pair is not valid. Otherwise it returns null. -
isSource
public boolean isSource(int index) Returns true if the current index is 0. -
isTarget
public boolean isTarget(int index) Returns true if the current index is the last index. -
isHandleVisible
protected boolean isHandleVisible(int index) Hides the middle handle if the edge is not bendable.- Overrides:
isHandleVisible
in classmxCellHandler
-
isCellBendable
protected boolean isCellBendable() -
createHandles
Description copied from class:mxCellHandler
Creates the rectangles that define the handles.- Overrides:
createHandles
in classmxCellHandler
-
getHandleFillColor
Description copied from class:mxCellHandler
Returns the color to be used to fill the handle at the specified index.- Overrides:
getHandleFillColor
in classmxCellHandler
-
getIndexAt
public int getIndexAt(int x, int y) Description copied from class:mxCellHandler
Returns the index of the handle at the given location.- Overrides:
getIndexAt
in classmxCellHandler
- Parameters:
x
-y
-- Returns:
- Returns the inde of the handle at the given location.
-
createHandle
-
createHandle
-
createPoints
-
createPreview
Description copied from class:mxCellHandler
Creates the preview for this handler.- Overrides:
createPreview
in classmxCellHandler
-
convertPoint
- Parameters:
point
-gridEnabled
-- Returns:
- Returns the scaled, translated and grid-aligned point.
-
getPreviewBounds
- Returns:
- Returns the bounds of the preview.
-
mousePressed
Description copied from class:mxCellHandler
Processes the given event.- Overrides:
mousePressed
in classmxCellHandler
-
mouseDragged
Description copied from class:mxCellHandler
Processes the given event.- Overrides:
mouseDragged
in classmxCellHandler
-
mouseReleased
Description copied from class:mxCellHandler
Processes the given event.- Overrides:
mouseReleased
in classmxCellHandler
-
reset
public void reset()Extends the implementation to reset the current error and marker.- Overrides:
reset
in classmxCellHandler
-
movePoint
Moves the edges control point with the given index to the given point. -
connect
Connects the given edge to the given source or target terminal.- Parameters:
edge
-terminal
-isSource
-
-
moveLabelTo
Moves the label to the given position. -
getCursor
Description copied from class:mxCellHandler
Returns the cursor for the given event and handle.- Overrides:
getCursor
in classmxCellHandler
-
getSelectionColor
Description copied from class:mxCellHandler
Returns the color used to draw the selection border. This implementation returns null.- Overrides:
getSelectionColor
in classmxCellHandler
-
getSelectionStroke
Description copied from class:mxCellHandler
Returns the stroke used to draw the selection border. This implementation returns null.- Overrides:
getSelectionStroke
in classmxCellHandler
-
paint
Description copied from class:mxCellHandler
Paints the visible handles of this handler.- Overrides:
paint
in classmxCellHandler
-