mxCellState

Represents the current state of a cell in a given mxGraphView.

For edges, the edge label position is stored in absoluteOffset.

The size for oversize labels can be retrieved using the boundingBox property of the text field as shown below.

var bbox = (state.text != null) ? state.text.boundingBox : null;
Summary
mxCellStateRepresents the current state of a cell in a given mxGraphView.
Functions
mxCellStateConstructs a new object that represents the current state of the given cell in the specified view.
Variables
viewReference to the enclosing mxGraphView.
cellReference to the mxCell that is represented by this state.
styleContains an array of key, value pairs that represent the style of the cell.
invalidStyleSpecifies if the style is invalid.
invalidSpecifies if the state is invalid.
originmxPoint that holds the origin for all child cells.
absolutePointsHolds an array of mxPoints that represent the absolute points of an edge.
absoluteOffsetmxPoint that holds the absolute offset.
visibleSourceStateCaches the visible source terminal state.
visibleTargetStateCaches the visible target terminal state.
terminalDistanceCaches the distance between the end points for an edge.
lengthCaches the length of an edge.
segmentsArray of numbers that represent the cached length of each segment of the edge.
shapeHolds the mxShape that represents the cell graphically.
textHolds the mxText that represents the label of the cell.
unscaledWidthHolds the unscaled width of the state.
unscaledHeightHolds the unscaled height of the state.
Functions
getPerimeterBoundsReturns the mxRectangle that should be used as the perimeter of the cell.
setAbsoluteTerminalPointSets the first or last point in absolutePoints depending on isSource.
setCursorSets the given cursor on the shape and text shape.
getVisibleTerminalReturns the visible source or target terminal cell.
getVisibleTerminalStateReturns the visible source or target terminal state.
setVisibleTerminalStateSets the visible source or target terminal state.
getCellBoundsReturns the unscaled, untranslated bounds.
getPaintBoundsReturns the unscaled, untranslated paint bounds.
updateCachedBoundsUpdates the cellBounds and paintBounds.
setStateCopies all fields from the given state to this state.
cloneReturns a clone of this mxPoint.
destroyDestroys the state and all associated resources.

Functions

mxCellState

function mxCellState(view,
cell,
style)

Constructs a new object that represents the current state of the given cell in the specified view.

Parameters

viewmxGraphView that contains the state.
cellmxCell that this state represents.
styleArray of key, value pairs that constitute the style.

Variables

view

mxCellState.prototype.view

Reference to the enclosing mxGraphView.

cell

mxCellState.prototype.cell

Reference to the mxCell that is represented by this state.

style

mxCellState.prototype.style

Contains an array of key, value pairs that represent the style of the cell.

invalidStyle

mxCellState.prototype.invalidStyle

Specifies if the style is invalid.  Default is false.

invalid

mxCellState.prototype.invalid

Specifies if the state is invalid.  Default is true.

origin

mxCellState.prototype.origin

mxPoint that holds the origin for all child cells.  Default is a new empty mxPoint.

absolutePoints

mxCellState.prototype.absolutePoints

Holds an array of mxPoints that represent the absolute points of an edge.

absoluteOffset

mxCellState.prototype.absoluteOffset

mxPoint that holds the absolute offset.  For edges, this is the absolute coordinates of the label position.  For vertices, this is the offset of the label relative to the top, left corner of the vertex.

visibleSourceState

mxCellState.prototype.visibleSourceState

Caches the visible source terminal state.

visibleTargetState

mxCellState.prototype.visibleTargetState

Caches the visible target terminal state.

terminalDistance

mxCellState.prototype.terminalDistance

Caches the distance between the end points for an edge.

length

mxCellState.prototype.length

Caches the length of an edge.

segments

mxCellState.prototype.segments

Array of numbers that represent the cached length of each segment of the edge.

shape

mxCellState.prototype.shape

Holds the mxShape that represents the cell graphically.

text

mxCellState.prototype.text

Holds the mxText that represents the label of the cell.  Thi smay be null if the cell has no label.

unscaledWidth

mxCellState.prototype.unscaledWidth

Holds the unscaled width of the state.

unscaledHeight

mxCellState.prototype.unscaledHeight

Holds the unscaled height of the state.

Functions

getPerimeterBounds

mxCellState.prototype.getPerimeterBounds = function(border,
bounds)

Returns the mxRectangle that should be used as the perimeter of the cell.

Parameters

borderOptional border to be added around the perimeter bounds.
boundsOptional mxRectangle to be used as the initial bounds.

setAbsoluteTerminalPoint

mxCellState.prototype.setAbsoluteTerminalPoint = function(point,
isSource)

Sets the first or last point in absolutePoints depending on isSource.

Parameters

pointmxPoint that represents the terminal point.
isSourceBoolean that specifies if the first or last point should be assigned.

setCursor

mxCellState.prototype.setCursor = function(cursor)

Sets the given cursor on the shape and text shape.

getVisibleTerminal

mxCellState.prototype.getVisibleTerminal = function(source)

Returns the visible source or target terminal cell.

Parameters

sourceBoolean that specifies if the source or target cell should be returned.

getVisibleTerminalState

mxCellState.prototype.getVisibleTerminalState = function(source)

Returns the visible source or target terminal state.

Parameters

sourceBoolean that specifies if the source or target state should be returned.

setVisibleTerminalState

mxCellState.prototype.setVisibleTerminalState = function(terminalState,
source)

Sets the visible source or target terminal state.

Parameters

terminalStatemxCellState that represents the terminal.
sourceBoolean that specifies if the source or target state should be set.

getCellBounds

mxCellState.prototype.getCellBounds = function()

Returns the unscaled, untranslated bounds.

getPaintBounds

mxCellState.prototype.getPaintBounds = function()

Returns the unscaled, untranslated paint bounds.  This is the same as getCellBounds but with a 90 degree rotation if the shape’s isPaintBoundsInverted returns true.

updateCachedBounds

mxCellState.prototype.updateCachedBounds = function()

Updates the cellBounds and paintBounds.

setState

mxCellState.prototype.setState = function(state)

Copies all fields from the given state to this state.

clone

mxCellState.prototype.clone = function()

Returns a clone of this mxPoint.

destroy

mxCellState.prototype.destroy = function()

Destroys the state and all associated resources.

Extends mxEventSource to implement a view for a graph.
function mxCellState(view,
cell,
style)
Constructs a new object that represents the current state of the given cell in the specified view.
mxCellState.prototype.view
Reference to the enclosing mxGraphView.
mxCellState.prototype.cell
Reference to the mxCell that is represented by this state.
Cells are the elements of the graph model.
mxCellState.prototype.style
Contains an array of key, value pairs that represent the style of the cell.
mxCellState.prototype.invalidStyle
Specifies if the style is invalid.
mxCellState.prototype.invalid
Specifies if the state is invalid.
mxCellState.prototype.origin
mxPoint that holds the origin for all child cells.
Implements a 2-dimensional vector with double precision coordinates.
mxCellState.prototype.absolutePoints
Holds an array of mxPoints that represent the absolute points of an edge.
mxCellState.prototype.absoluteOffset
mxPoint that holds the absolute offset.
mxCellState.prototype.visibleSourceState
Caches the visible source terminal state.
mxCellState.prototype.visibleTargetState
Caches the visible target terminal state.
mxCellState.prototype.terminalDistance
Caches the distance between the end points for an edge.
mxCellState.prototype.length
Caches the length of an edge.
mxCellState.prototype.segments
Array of numbers that represent the cached length of each segment of the edge.
mxCellState.prototype.shape
Holds the mxShape that represents the cell graphically.
Base class for all shapes.
mxCellState.prototype.text
Holds the mxText that represents the label of the cell.
Extends mxShape to implement a text shape.
mxCellState.prototype.unscaledWidth
Holds the unscaled width of the state.
mxCellState.prototype.unscaledHeight
Holds the unscaled height of the state.
mxCellState.prototype.getPerimeterBounds = function(border,
bounds)
Returns the mxRectangle that should be used as the perimeter of the cell.
Extends mxPoint to implement a 2-dimensional rectangle with double precision coordinates.
mxCellState.prototype.setAbsoluteTerminalPoint = function(point,
isSource)
Sets the first or last point in absolutePoints depending on isSource.
mxCellState.prototype.setCursor = function(cursor)
Sets the given cursor on the shape and text shape.
mxCellState.prototype.getVisibleTerminal = function(source)
Returns the visible source or target terminal cell.
mxCellState.prototype.getVisibleTerminalState = function(source)
Returns the visible source or target terminal state.
mxCellState.prototype.setVisibleTerminalState = function(terminalState,
source)
Sets the visible source or target terminal state.
mxCellState.prototype.getCellBounds = function()
Returns the unscaled, untranslated bounds.
mxCellState.prototype.getPaintBounds = function()
Returns the unscaled, untranslated paint bounds.
mxCellState.prototype.updateCachedBounds = function()
Updates the cellBounds and paintBounds.
mxCellState.prototype.setState = function(state)
Copies all fields from the given state to this state.
mxCellState.prototype.clone = function()
Returns a clone of this mxPoint.
mxCellState.prototype.destroy = function()
Destroys the state and all associated resources.
Close