Package com.mxgraph.view
Class mxCellState
java.lang.Object
com.mxgraph.util.mxPoint
com.mxgraph.util.mxRectangle
com.mxgraph.view.mxCellState
- All Implemented Interfaces:
Serializable
,Cloneable
Represents the current state of a cell in a given graph view.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected mxPoint
Holds the absolute offset.List of mxPoints that represent the absolute points of an edge.protected mxRectangle
Holds the largest rectangle which contains all rendering for this cell.protected Object
Reference to the cell that is represented by this state.protected boolean
Specifies if the state is invalid.protected String
Holds the current label value, including newlines which result from word wrapping.protected mxRectangle
Holds the rectangle which contains the label.protected double
Caches the distance between the end points and the length of an edge.protected mxPoint
Holds the origin for all child cells.protected double[]
Array of numbers that represent the cached length of each segment of the edge.Contains an array of key, value pairs that represent the style of the cell.protected double
Caches the distance between the end points and the length of an edge.protected mxGraphView
Reference to the enclosing graph view.protected mxCellState
Caches the visible source and target terminal states.protected mxCellState
Caches the visible source and target terminal states.Fields inherited from class com.mxgraph.util.mxRectangle
height, width
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an empty cell state.mxCellState
(mxGraphView view, Object cell, Map<String, Object> style) Constructs a new object that represents the current state of the given cell in the specified view. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a clone of this state where all members are deeply cloned except the view and cell references, which are copied with no cloning to the new instance.Returns the absolute offset.getAbsolutePoint
(int index) Returns the absolute point at the given index.int
Returns the number of absolute points.Returns the absolute points.Returns the bounding box.getCell()
Returns the cell that is represented by this state.getLabel()
Returns the current label.Returns the label bounds.double
Returns the length.Returns the origin for the children.Returns the rectangle that should be used as the perimeter of the cell.getPerimeterBounds
(double border) Returns the rectangle that should be used as the perimeter of the cell.double[]
Returns the length of the segments.getStyle()
Returns the cell style as a map of key, value pairs.double
Returns the terminal distance.getView()
Returns the enclosing graph view.getVisibleTerminal
(boolean source) Returns the visible source or target terminal cell.getVisibleTerminalState
(boolean source) Returns the visible source or target terminal state.boolean
Returns true if the state is invalid.void
setAbsoluteOffset
(mxPoint absoluteOffset) Returns the absolute offset.setAbsolutePoint
(int index, mxPoint point) Returns the absolute point at the given index.void
setAbsolutePoints
(List<mxPoint> absolutePoints) Returns the absolute points.void
setAbsoluteTerminalPoint
(mxPoint point, boolean isSource) Sets the first or last point in the list of points depending on isSource.void
setBoundingBox
(mxRectangle boundingBox) Sets the bounding box.void
Sets the cell that this state represents.void
setInvalid
(boolean invalid) Sets the invalid state.void
Returns the current label.void
setLabelBounds
(mxRectangle labelBounds) Sets the label bounds.void
setLength
(double length) Sets the length.void
Sets the origin for the children.void
setSegments
(double[] segments) Sets the length of the segments.void
Sets the cell style as a map of key, value pairs.void
setTerminalDistance
(double terminalDistance) Sets the terminal distance.void
setView
(mxGraphView view) Sets the enclosing graph view.void
setVisibleTerminalState
(mxCellState terminalState, boolean source) Sets the visible source or target terminal state.toString()
Returns theString
representation of thismxRectangle
.Methods inherited from class com.mxgraph.util.mxRectangle
add, contains, equals, getCenterX, getCenterY, getHeight, getRectangle, getWidth, grow, intersectLine, rotate90, setHeight, setRect, setWidth
-
Field Details
-
view
Reference to the enclosing graph view. -
cell
Reference to the cell that is represented by this state. -
label
Holds the current label value, including newlines which result from word wrapping. -
style
Contains an array of key, value pairs that represent the style of the cell. -
origin
Holds the origin for all child cells. -
absolutePoints
List of mxPoints that represent the absolute points of an edge. -
absoluteOffset
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. -
terminalDistance
protected double terminalDistanceCaches the distance between the end points and the length of an edge. -
length
protected double lengthCaches the distance between the end points and the length of an edge. -
segments
protected double[] segmentsArray of numbers that represent the cached length of each segment of the edge. -
labelBounds
Holds the rectangle which contains the label. -
boundingBox
Holds the largest rectangle which contains all rendering for this cell. -
invalid
protected boolean invalidSpecifies if the state is invalid. Default is true. -
visibleSourceState
Caches the visible source and target terminal states. -
visibleTargetState
Caches the visible source and target terminal states.
-
-
Constructor Details
-
mxCellState
public mxCellState()Constructs an empty cell state. -
mxCellState
Constructs a new object that represents the current state of the given cell in the specified view.- Parameters:
view
- Graph view that contains the state.cell
- Cell that this state represents.style
- Array of key, value pairs that constitute the style.
-
-
Method Details
-
isInvalid
public boolean isInvalid()Returns true if the state is invalid. -
setInvalid
public void setInvalid(boolean invalid) Sets the invalid state. -
getView
Returns the enclosing graph view.- Returns:
- the view
-
setView
Sets the enclosing graph view.- Parameters:
view
- the view to set
-
getLabel
Returns the current label. -
setLabel
Returns the current label. -
getCell
Returns the cell that is represented by this state.- Returns:
- the cell
-
setCell
Sets the cell that this state represents.- Parameters:
cell
- the cell to set
-
getStyle
Returns the cell style as a map of key, value pairs.- Returns:
- the style
-
setStyle
Sets the cell style as a map of key, value pairs.- Parameters:
style
- the style to set
-
getOrigin
Returns the origin for the children.- Returns:
- the origin
-
setOrigin
Sets the origin for the children.- Parameters:
origin
- the origin to set
-
getAbsolutePoint
Returns the absolute point at the given index.- Returns:
- the mxPoint at the given index
-
setAbsolutePoint
Returns the absolute point at the given index.- Returns:
- the mxPoint at the given index
-
getAbsolutePointCount
public int getAbsolutePointCount()Returns the number of absolute points.- Returns:
- the absolutePoints
-
getAbsolutePoints
Returns the absolute points.- Returns:
- the absolutePoints
-
setAbsolutePoints
Returns the absolute points.- Parameters:
absolutePoints
- the absolutePoints to set
-
getAbsoluteOffset
Returns the absolute offset.- Returns:
- the absoluteOffset
-
setAbsoluteOffset
Returns the absolute offset.- Parameters:
absoluteOffset
- the absoluteOffset to set
-
getTerminalDistance
public double getTerminalDistance()Returns the terminal distance.- Returns:
- the terminalDistance
-
setTerminalDistance
public void setTerminalDistance(double terminalDistance) Sets the terminal distance.- Parameters:
terminalDistance
- the terminalDistance to set
-
getLength
public double getLength()Returns the length.- Returns:
- the length
-
setLength
public void setLength(double length) Sets the length.- Parameters:
length
- the length to set
-
getSegments
public double[] getSegments()Returns the length of the segments.- Returns:
- the segments
-
setSegments
public void setSegments(double[] segments) Sets the length of the segments.- Parameters:
segments
- the segments to set
-
getLabelBounds
Returns the label bounds.- Returns:
- Returns the label bounds for this state.
-
setLabelBounds
Sets the label bounds.- Parameters:
labelBounds
-
-
getBoundingBox
Returns the bounding box.- Returns:
- Returns the bounding box for this state.
-
setBoundingBox
Sets the bounding box.- Parameters:
boundingBox
-
-
getPerimeterBounds
Returns the rectangle that should be used as the perimeter of the cell. This implementation adds the perimeter spacing to the rectangle defined by this cell state.- Returns:
- Returns the rectangle that defines the perimeter.
-
getPerimeterBounds
Returns the rectangle that should be used as the perimeter of the cell.- Returns:
- Returns the rectangle that defines the perimeter.
-
setAbsoluteTerminalPoint
Sets the first or last point in the list of points depending on isSource.- Parameters:
point
- Point that represents the terminal point.isSource
- Boolean that specifies if the first or last point should be assigned.
-
getVisibleTerminal
Returns the visible source or target terminal cell.- Parameters:
source
- Boolean that specifies if the source or target cell should be returned.
-
getVisibleTerminalState
Returns the visible source or target terminal state.- Parameters:
Boolean
- that specifies if the source or target state should be returned.
-
setVisibleTerminalState
Sets the visible source or target terminal state.- Parameters:
terminalState
- Cell state that represents the terminal.source
- Boolean that specifies if the source or target state should be set.
-
clone
Returns a clone of this state where all members are deeply cloned except the view and cell references, which are copied with no cloning to the new instance.- Overrides:
clone
in classmxRectangle
-
toString
Description copied from class:mxRectangle
Returns theString
representation of thismxRectangle
.- Overrides:
toString
in classmxRectangle
- Returns:
- a
String
representing thismxRectangle
.
-