Package com.mxgraph.view
Class mxCellState
- java.lang.Object
-
- com.mxgraph.util.mxPoint
-
- com.mxgraph.util.mxRectangle
-
- com.mxgraph.view.mxCellState
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class mxCellState extends mxRectangle
Represents the current state of a cell in a given graph view.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected mxPointabsoluteOffsetHolds the absolute offset.protected java.util.List<mxPoint>absolutePointsList of mxPoints that represent the absolute points of an edge.protected mxRectangleboundingBoxHolds the largest rectangle which contains all rendering for this cell.protected java.lang.ObjectcellReference to the cell that is represented by this state.protected booleaninvalidSpecifies if the state is invalid.protected java.lang.StringlabelHolds the current label value, including newlines which result from word wrapping.protected mxRectanglelabelBoundsHolds the rectangle which contains the label.protected doublelengthCaches the distance between the end points and the length of an edge.protected mxPointoriginHolds the origin for all child cells.protected double[]segmentsArray of numbers that represent the cached length of each segment of the edge.protected java.util.Map<java.lang.String,java.lang.Object>styleContains an array of key, value pairs that represent the style of the cell.protected doubleterminalDistanceCaches the distance between the end points and the length of an edge.protected mxGraphViewviewReference to the enclosing graph view.protected mxCellStatevisibleSourceStateCaches the visible source and target terminal states.protected mxCellStatevisibleTargetStateCaches the visible source and target terminal states.-
Fields inherited from class com.mxgraph.util.mxRectangle
height, width
-
-
Constructor Summary
Constructors Constructor Description mxCellState()Constructs an empty cell state.mxCellState(mxGraphView view, java.lang.Object cell, java.util.Map<java.lang.String,java.lang.Object> style)Constructs a new object that represents the current state of the given cell in the specified view.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()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.mxPointgetAbsoluteOffset()Returns the absolute offset.mxPointgetAbsolutePoint(int index)Returns the absolute point at the given index.intgetAbsolutePointCount()Returns the number of absolute points.java.util.List<mxPoint>getAbsolutePoints()Returns the absolute points.mxRectanglegetBoundingBox()Returns the bounding box.java.lang.ObjectgetCell()Returns the cell that is represented by this state.java.lang.StringgetLabel()Returns the current label.mxRectanglegetLabelBounds()Returns the label bounds.doublegetLength()Returns the length.mxPointgetOrigin()Returns the origin for the children.mxRectanglegetPerimeterBounds()Returns the rectangle that should be used as the perimeter of the cell.mxRectanglegetPerimeterBounds(double border)Returns the rectangle that should be used as the perimeter of the cell.double[]getSegments()Returns the length of the segments.java.util.Map<java.lang.String,java.lang.Object>getStyle()Returns the cell style as a map of key, value pairs.doublegetTerminalDistance()Returns the terminal distance.mxGraphViewgetView()Returns the enclosing graph view.java.lang.ObjectgetVisibleTerminal(boolean source)Returns the visible source or target terminal cell.mxCellStategetVisibleTerminalState(boolean source)Returns the visible source or target terminal state.booleanisInvalid()Returns true if the state is invalid.voidsetAbsoluteOffset(mxPoint absoluteOffset)Returns the absolute offset.mxPointsetAbsolutePoint(int index, mxPoint point)Returns the absolute point at the given index.voidsetAbsolutePoints(java.util.List<mxPoint> absolutePoints)Returns the absolute points.voidsetAbsoluteTerminalPoint(mxPoint point, boolean isSource)Sets the first or last point in the list of points depending on isSource.voidsetBoundingBox(mxRectangle boundingBox)Sets the bounding box.voidsetCell(java.lang.Object cell)Sets the cell that this state represents.voidsetInvalid(boolean invalid)Sets the invalid state.voidsetLabel(java.lang.String value)Returns the current label.voidsetLabelBounds(mxRectangle labelBounds)Sets the label bounds.voidsetLength(double length)Sets the length.voidsetOrigin(mxPoint origin)Sets the origin for the children.voidsetSegments(double[] segments)Sets the length of the segments.voidsetStyle(java.util.Map<java.lang.String,java.lang.Object> style)Sets the cell style as a map of key, value pairs.voidsetTerminalDistance(double terminalDistance)Sets the terminal distance.voidsetView(mxGraphView view)Sets the enclosing graph view.voidsetVisibleTerminalState(mxCellState terminalState, boolean source)Sets the visible source or target terminal state.java.lang.StringtoString()Returns theStringrepresentation 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 Detail
-
view
protected mxGraphView view
Reference to the enclosing graph view.
-
cell
protected java.lang.Object cell
Reference to the cell that is represented by this state.
-
label
protected java.lang.String label
Holds the current label value, including newlines which result from word wrapping.
-
style
protected java.util.Map<java.lang.String,java.lang.Object> style
Contains an array of key, value pairs that represent the style of the cell.
-
origin
protected mxPoint origin
Holds the origin for all child cells.
-
absolutePoints
protected java.util.List<mxPoint> absolutePoints
List of mxPoints that represent the absolute points of an edge.
-
absoluteOffset
protected mxPoint 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 terminalDistance
Caches the distance between the end points and the length of an edge.
-
length
protected double length
Caches the distance between the end points and the length of an edge.
-
segments
protected double[] segments
Array of numbers that represent the cached length of each segment of the edge.
-
labelBounds
protected mxRectangle labelBounds
Holds the rectangle which contains the label.
-
boundingBox
protected mxRectangle boundingBox
Holds the largest rectangle which contains all rendering for this cell.
-
invalid
protected boolean invalid
Specifies if the state is invalid. Default is true.
-
visibleSourceState
protected mxCellState visibleSourceState
Caches the visible source and target terminal states.
-
visibleTargetState
protected mxCellState visibleTargetState
Caches the visible source and target terminal states.
-
-
Constructor Detail
-
mxCellState
public mxCellState()
Constructs an empty cell state.
-
mxCellState
public mxCellState(mxGraphView view, java.lang.Object cell, java.util.Map<java.lang.String,java.lang.Object> style)
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 Detail
-
isInvalid
public boolean isInvalid()
Returns true if the state is invalid.
-
setInvalid
public void setInvalid(boolean invalid)
Sets the invalid state.
-
getView
public mxGraphView getView()
Returns the enclosing graph view.- Returns:
- the view
-
setView
public void setView(mxGraphView view)
Sets the enclosing graph view.- Parameters:
view- the view to set
-
getLabel
public java.lang.String getLabel()
Returns the current label.
-
setLabel
public void setLabel(java.lang.String value)
Returns the current label.
-
getCell
public java.lang.Object getCell()
Returns the cell that is represented by this state.- Returns:
- the cell
-
setCell
public void setCell(java.lang.Object cell)
Sets the cell that this state represents.- Parameters:
cell- the cell to set
-
getStyle
public java.util.Map<java.lang.String,java.lang.Object> getStyle()
Returns the cell style as a map of key, value pairs.- Returns:
- the style
-
setStyle
public void setStyle(java.util.Map<java.lang.String,java.lang.Object> style)
Sets the cell style as a map of key, value pairs.- Parameters:
style- the style to set
-
getOrigin
public mxPoint getOrigin()
Returns the origin for the children.- Returns:
- the origin
-
setOrigin
public void setOrigin(mxPoint origin)
Sets the origin for the children.- Parameters:
origin- the origin to set
-
getAbsolutePoint
public mxPoint getAbsolutePoint(int index)
Returns the absolute point at the given index.- Returns:
- the mxPoint at the given index
-
setAbsolutePoint
public mxPoint setAbsolutePoint(int index, mxPoint point)
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
public java.util.List<mxPoint> getAbsolutePoints()
Returns the absolute points.- Returns:
- the absolutePoints
-
setAbsolutePoints
public void setAbsolutePoints(java.util.List<mxPoint> absolutePoints)
Returns the absolute points.- Parameters:
absolutePoints- the absolutePoints to set
-
getAbsoluteOffset
public mxPoint getAbsoluteOffset()
Returns the absolute offset.- Returns:
- the absoluteOffset
-
setAbsoluteOffset
public void setAbsoluteOffset(mxPoint absoluteOffset)
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
public mxRectangle getLabelBounds()
Returns the label bounds.- Returns:
- Returns the label bounds for this state.
-
setLabelBounds
public void setLabelBounds(mxRectangle labelBounds)
Sets the label bounds.- Parameters:
labelBounds-
-
getBoundingBox
public mxRectangle getBoundingBox()
Returns the bounding box.- Returns:
- Returns the bounding box for this state.
-
setBoundingBox
public void setBoundingBox(mxRectangle boundingBox)
Sets the bounding box.- Parameters:
boundingBox-
-
getPerimeterBounds
public mxRectangle 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
public mxRectangle getPerimeterBounds(double border)
Returns the rectangle that should be used as the perimeter of the cell.- Returns:
- Returns the rectangle that defines the perimeter.
-
setAbsoluteTerminalPoint
public void setAbsoluteTerminalPoint(mxPoint point, boolean isSource)
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
public java.lang.Object getVisibleTerminal(boolean source)
Returns the visible source or target terminal cell.- Parameters:
source- Boolean that specifies if the source or target cell should be returned.
-
getVisibleTerminalState
public mxCellState getVisibleTerminalState(boolean source)
Returns the visible source or target terminal state.- Parameters:
Boolean- that specifies if the source or target state should be returned.
-
setVisibleTerminalState
public void setVisibleTerminalState(mxCellState terminalState, boolean source)
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
public java.lang.Object 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:
clonein classmxRectangle
-
toString
public java.lang.String toString()
Description copied from class:mxRectangleReturns theStringrepresentation of thismxRectangle.- Overrides:
toStringin classmxRectangle- Returns:
- a
Stringrepresenting thismxRectangle.
-
-