Package com.mxgraph.swing.handler
Class mxCellHandler
java.lang.Object
com.mxgraph.swing.handler.mxCellHandler
- Direct Known Subclasses:
mxEdgeHandler,mxVertexHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected RectangleHolds the bounding box of the handler.protected PointHolds the start location of the mouse gesture.protected mxGraphComponentReference to the enclosing graph component.protected Rectangle[]Holds the rectangles that define the handles.protected booleanSpecifies if the handles should be painted.protected intHolds the index of the handle that was clicked.protected JComponentHolds the component that is used for preview.protected mxCellStateHolds the cell state associated with this handler. -
Constructor Summary
ConstructorsConstructorDescriptionmxCellHandler(mxGraphComponent graphComponent, mxCellState state) Constructs a new cell handler for the given cell state. -
Method Summary
Modifier and TypeMethodDescriptionprotected Rectangle[]Creates the rectangles that define the handles.protected JComponentCreates the preview for this handler.protected voiddestroy()Invoked when the handler is no longer used.Returns the bounding box of this handler.protected CursorgetCursor(MouseEvent e, int index) Returns the cursor for the given event and handle.protected ColorgetHandleBorderColor(int index) Returns the border color of the handle at the specified index.protected intReturns the number of handles in this handler.protected ColorgetHandleFillColor(int index) Returns the color to be used to fill the handle at the specified index.intgetIndex()Returns the index of the current handle.intgetIndexAt(int x, int y) Returns the index of the handle at the given location.Returns the color used to draw the selection border.Returns the stroke used to draw the selection border.getState()Returns the cell state that is associated with this handler.Hook for subclassers to return tooltip texts for certain points on the handle.booleanisActive()protected booleanisHandleEnabled(int index) Returns true if the handle at the specified index is enabled.booleanReturns true if the handles should be painted.protected booleanisHandleVisible(int index) Returns true if the handle at the specified index is visible.protected booleanReturns true if the given event should be ignored.booleanisLabel(int index) Returns true if the given index is the index of the last handle.booleanReturns true if the label is movable.voidProcesses the given event.voidProcesses the given event.voidProcesses the given event.voidProcesses the given event.voidPaints the visible handles of this handler.voidrefresh(mxCellState state) Refreshes the cell handler.voidreset()Resets the state of the handler and removes the preview.voidsetHandlesVisible(boolean handlesVisible) Specifies if the handles should be painted.voidstart(MouseEvent e, int index) Starts handling a gesture at the given handle index.
-
Field Details
-
graphComponent
Reference to the enclosing graph component. -
state
Holds the cell state associated with this handler. -
handles
Holds the rectangles that define the handles. -
handlesVisible
protected boolean handlesVisibleSpecifies if the handles should be painted. Default is true. -
bounds
Holds the bounding box of the handler. -
preview
Holds the component that is used for preview. -
first
Holds the start location of the mouse gesture. -
index
protected transient int indexHolds the index of the handle that was clicked.
-
-
Constructor Details
-
mxCellHandler
Constructs a new cell handler for the given cell state.- Parameters:
graphComponent- Enclosing graph component.state- Cell state for which the handler is created.
-
-
Method Details
-
isActive
public boolean isActive() -
refresh
Refreshes the cell handler. -
getGraphComponent
-
getState
Returns the cell state that is associated with this handler. -
getIndex
public int getIndex()Returns the index of the current handle. -
getBounds
Returns the bounding box of this handler. -
isLabelMovable
public boolean isLabelMovable()Returns true if the label is movable. -
isHandlesVisible
public boolean isHandlesVisible()Returns true if the handles should be painted. -
setHandlesVisible
public void setHandlesVisible(boolean handlesVisible) Specifies if the handles should be painted. -
isLabel
public boolean isLabel(int index) Returns true if the given index is the index of the last handle. -
createHandles
Creates the rectangles that define the handles. -
getHandleCount
protected int getHandleCount()Returns the number of handles in this handler. -
getToolTipText
Hook for subclassers to return tooltip texts for certain points on the handle. -
getIndexAt
public int getIndexAt(int x, int y) Returns the index of the handle at the given location.- Parameters:
x- X-coordinate of the location.y- Y-coordinate of the location.- Returns:
- Returns the handle index for the given location.
-
mousePressed
Processes the given event. -
mouseMoved
Processes the given event. -
mouseDragged
Processes the given event. -
mouseReleased
Processes the given event. -
start
Starts handling a gesture at the given handle index. -
isIgnoredEvent
Returns true if the given event should be ignored. -
createPreview
Creates the preview for this handler. -
reset
public void reset()Resets the state of the handler and removes the preview. -
getCursor
Returns the cursor for the given event and handle. -
paint
Paints the visible handles of this handler. -
getSelectionColor
Returns the color used to draw the selection border. This implementation returns null. -
getSelectionStroke
Returns the stroke used to draw the selection border. This implementation returns null. -
isHandleEnabled
protected boolean isHandleEnabled(int index) Returns true if the handle at the specified index is enabled. -
isHandleVisible
protected boolean isHandleVisible(int index) Returns true if the handle at the specified index is visible. -
getHandleFillColor
Returns the color to be used to fill the handle at the specified index. -
getHandleBorderColor
Returns the border color of the handle at the specified index. -
destroy
protected void destroy()Invoked when the handler is no longer used. This is an empty hook for subclassers.
-