mxGraph
Public Member Functions | Protected Attributes | Properties
com.mxgraph.mxGraphView Class Reference

Implements a view for the graph. This class is in charge of computing the absolute coordinates for the relative child geometries, the points for perimeters and edge styles and keeping them cached in mxCellStates for faster retrieval. The states are updated whenever the model or the view state (translate, scale) changes. The scale and translate are honoured in the bounds. More...

List of all members.

Public Member Functions

 mxGraphView (mxGraph graph)
 Constructs a new view for the given graph.
mxRectangle GetBounds (Object[] cells)
 Returns the bounding box for an array of cells or null, if no cells are specified.
mxRectangle GetBoundingBox (Object[] cells)
 Returns the bounding box for an array of cells or null, if no cells are specified.
mxRectangle GetBounds (Object[] cells, bool boundingBox)
 Returns the bounding box for an array of cells or null, if no cells are specified.
void Revalidate ()
 First invalidates, then validates all cell states.
void Invalidate ()
 Invalidates all cell states.
void Validate ()
 First validates all bounds and then validates all points recursively on all visible cells.
mxRectangle GetBoundingBox (mxCellState state)
 Shortcut to validateCell with visible set to true.
mxRectangle GetBoundingBox (mxCellState state, Boolean recurse)
 Returns the bounding box of the shape and the label for the given cell state and its children if recurse is true.
Object ValidateCell (Object cell)
 Shortcut to validateCell with visible set to true.
Object ValidateCell (Object cell, Boolean visible)
 Recursively creates the cell state for the given cell if visible is true and the given cell is visible. If the cell is not visible but the state exists then it is removed using removeState.
mxCellState ValidateCellState (Object cell)
 Shortcut to validateCellState with recurse set to true.
mxCellState ValidateCellState (Object cell, Boolean recurse)
 Validates the cell state for the given cell.
void UpdateCellState (mxCellState state, mxCellState source, mxCellState target)
 Updates the given cell state.
void UpdateVertexState (mxCellState state, mxGeometry geo)
 Validates the given cell state.
void UpdateEdgeState (mxCellState state, mxGeometry geo, mxCellState source, mxCellState target)
 Validates the given cell state.
void UpdateVertexLabelOffset (mxCellState state)
 Updates the absoluteOffset of the given vertex cell state. This takes into account the label position styles.
void UpdateLabelBounds (mxCellState state)
 Updates the label bounds in the given state.
mxRectangle UpdateBoundingBox (mxCellState state)
 Updates the bounding box in the given cell state.
void UpdateFixedTerminalPoints (mxCellState edge, mxCellState source, mxCellState target)
 Sets the initial absolute terminal points in the given state before the edge style is computed.
void UpdateFixedTerminalPoint (mxCellState edge, mxCellState terminal, bool source, mxConnectionConstraint constraint)
 Sets the fixed source or target terminal point on the given edge.
void UpdatePoints (mxCellState edge, List< mxPoint > points, mxCellState source, mxCellState target)
 Updates the absolute points in the given state using the specified array of points as the relative points.
mxPoint TransformControlPoint (mxCellState state, mxPoint pt)
 Transforms the given control point to an absolute point.
mxEdgeStyleFunction GetEdgeStyle (mxCellState edge, List< mxPoint > points, Object source, Object target)
 Returns the edge style function to be used to render the given edge state.
void UpdateFloatingTerminalPoints (mxCellState state, mxCellState source, mxCellState target)
 Updates the terminal points in the given state after the edge style was computed for the edge.
void UpdateFloatingTerminalPoint (mxCellState edge, mxCellState start, mxCellState end, bool source)
 Updates the absolute terminal point in the given state for the given start and end state, where start is the source if source is true.
mxCellState GetTerminalPort (mxCellState state, mxCellState terminal, bool source)
 Returns the given terminal or the port defined in the given edge state if a cell state exists for that port.
mxPoint GetPerimeterPoint (mxCellState terminal, mxPoint next, bool orthogonal)
 Returns a point that defines the location of the intersection point between the perimeter and the line between the center of the shape and the given point.
mxPoint GetPerimeterPoint (mxCellState terminal, mxPoint next, bool orthogonal, double border)
 Returns a point that defines the location of the intersection point between the perimeter and the line between the center of the shape and the given point.
double GetRoutingCenterX (mxCellState state)
 Returns the x-coordinate of the center point for automatic routing.
double GetRoutingCenterY (mxCellState state)
 Returns the y-coordinate of the center point for automatic routing.
mxRectangle GetPerimeterBounds (mxCellState terminal, double border)
 Returns the perimeter bounds for the given terminal, edge pair.
mxPerimeterFunction GetPerimeterFunction (mxCellState state)
 Returns the perimeter function for the given state.
mxPoint GetNextPoint (mxCellState edge, mxCellState opposite, bool source)
 Returns the nearest point in the list of absolute points or the center of the opposite terminal.
Object GetVisibleTerminal (Object edge, bool source)
 Returns the nearest ancestor terminal that is visible. The edge appears to be connected to this terminal on the display.
void UpdateEdgeBounds (mxCellState state)
 Updates the given state using the bounding box of the absolute points. Also updates terminal distance, length and segments.
mxPoint GetPoint (mxCellState state)
 Returns the absolute center point along the given edge.
mxPoint GetPoint (mxCellState state, mxGeometry geometry)
 Returns the absolute point on the edge for the given relative geometry as a point. The edge is represented by the given cell state.
mxCellState GetState (Object cell)
 Returns the state for the given cell or null if no state is defined for the cell.
Dictionary< Object, mxCellStateGetStates (Object[] cells)
 Returns the object that maps from cells to states.
mxCellState[] GetCellStates (Object[] cells)
 Returns the states for the given array of cells. The array contains all states that are not null, that is, the returned array may have less elements than the given array.
mxCellState GetState (Object cell, bool create)
 Returns the cell state for the given cell. If create is true, then the state is created if it does not yet exist.
mxCellState RemoveState (Object cell)
 Shortcut to removeState with recurse set to false.
mxCellState RemoveState (Object cell, Boolean recurse)
 Removes and returns the mxCellState for the given cell.
mxCellState CreateState (Object cell)
 Creates and returns a cell state for the given cell.

Protected Attributes

mxGraph graph
 Reference to the enclosing graph.
mxRectangle graphBounds = new mxRectangle()
 Caches the current bounds of the graph.
double scale = 1
 Specifies the scale. Default is 1 (100%).
mxPoint translate = new mxPoint(0, 0)
 Point that specifies the current translation. Default is a new empty point.
Dictionary< Object, mxCellStatestates = new Dictionary<Object, mxCellState>()
 Maps from cells to cell states.
bool eventsEnabled = true
 Specifies if the view should be revalidated if the scale or translation changes.

Properties

mxGraph Graph [get]
 Returns the enclosing graph.
mxRectangle GraphBounds [get, set]
 Returns the cached diagram bounds.
double Scale [get, set]
 Sets or returns the current scale.
mxPoint Translate [get, set]
 Sets or returns the current translation.
Dictionary< Object, mxCellStateStates [get, set]
 Sets or returns the current translation.
bool IsEventsEnabled [get, set]
 Sets or returns the current scale.

Detailed Description

Implements a view for the graph. This class is in charge of computing the absolute coordinates for the relative child geometries, the points for perimeters and edge styles and keeping them cached in mxCellStates for faster retrieval. The states are updated whenever the model or the view state (translate, scale) changes. The scale and translate are honoured in the bounds.


Constructor & Destructor Documentation

Constructs a new view for the given graph.

Parameters:
graphReference to the enclosing graph.

Member Function Documentation

Creates and returns a cell state for the given cell.

Parameters:
cellCell for which a new state should be created.
Returns:
Returns a new state for the given cell.

Returns the bounding box for an array of cells or null, if no cells are specified.

Parameters:
cells
Returns:

Shortcut to validateCell with visible set to true.

mxRectangle com.mxgraph.mxGraphView.GetBoundingBox ( mxCellState  state,
Boolean  recurse 
) [inline]

Returns the bounding box of the shape and the label for the given cell state and its children if recurse is true.

Parameters:
stateCell state whose bounding box should be returned.
recurseBoolean indicating if the children should be included.
mxRectangle com.mxgraph.mxGraphView.GetBounds ( Object[]  cells) [inline]

Returns the bounding box for an array of cells or null, if no cells are specified.

Parameters:
cells
Returns:
mxRectangle com.mxgraph.mxGraphView.GetBounds ( Object[]  cells,
bool  boundingBox 
) [inline]

Returns the bounding box for an array of cells or null, if no cells are specified.

mxCellState [] com.mxgraph.mxGraphView.GetCellStates ( Object[]  cells) [inline]

Returns the states for the given array of cells. The array contains all states that are not null, that is, the returned array may have less elements than the given array.

mxEdgeStyleFunction com.mxgraph.mxGraphView.GetEdgeStyle ( mxCellState  edge,
List< mxPoint points,
Object  source,
Object  target 
) [inline]

Returns the edge style function to be used to render the given edge state.

mxPoint com.mxgraph.mxGraphView.GetNextPoint ( mxCellState  edge,
mxCellState  opposite,
bool  source 
) [inline]

Returns the nearest point in the list of absolute points or the center of the opposite terminal.

Parameters:
edgeState that represents the edge.
oppositeState that represents the opposite terminal.
sourceBoolean indicating if the next point for the source or target should be returned.
mxRectangle com.mxgraph.mxGraphView.GetPerimeterBounds ( mxCellState  terminal,
double  border 
) [inline]

Returns the perimeter bounds for the given terminal, edge pair.

Returns the perimeter function for the given state.

mxPoint com.mxgraph.mxGraphView.GetPerimeterPoint ( mxCellState  terminal,
mxPoint  next,
bool  orthogonal 
) [inline]

Returns a point that defines the location of the intersection point between the perimeter and the line between the center of the shape and the given point.

mxPoint com.mxgraph.mxGraphView.GetPerimeterPoint ( mxCellState  terminal,
mxPoint  next,
bool  orthogonal,
double  border 
) [inline]

Returns a point that defines the location of the intersection point between the perimeter and the line between the center of the shape and the given point.

Parameters:
terminalState for the source or target terminal.
nextPoint that lies outside of the given terminal.
orthogonalSpecifies if the orthogonal projection onto the perimeter should be returned. If this is false then the intersection of the perimeter and the line between the next and the center point is returned.
borderOptional border between the perimeter and the shape.

Returns the absolute center point along the given edge.

mxPoint com.mxgraph.mxGraphView.GetPoint ( mxCellState  state,
mxGeometry  geometry 
) [inline]

Returns the absolute point on the edge for the given relative geometry as a point. The edge is represented by the given cell state.

Parameters:
stateRepresents the state of the parent edge.
geometryRepresents the relative location.

Returns the x-coordinate of the center point for automatic routing.

Returns:
Returns the x-coordinate of the routing center point.

Returns the y-coordinate of the center point for automatic routing.

Returns:
Returns the y-coordinate of the routing center point.
mxCellState com.mxgraph.mxGraphView.GetState ( Object  cell) [inline]

Returns the state for the given cell or null if no state is defined for the cell.

Parameters:
cellCell whose state should be returned.
Returns:
Returns the state for the given cell.
mxCellState com.mxgraph.mxGraphView.GetState ( Object  cell,
bool  create 
) [inline]

Returns the cell state for the given cell. If create is true, then the state is created if it does not yet exist.

Parameters:
cellCell for which a new state should be returned.
createBoolean indicating if a new state should be created if it does not yet exist.
Returns:
Returns the state for the given cell.
Dictionary<Object, mxCellState> com.mxgraph.mxGraphView.GetStates ( Object[]  cells) [inline]

Returns the object that maps from cells to states.

mxCellState com.mxgraph.mxGraphView.GetTerminalPort ( mxCellState  state,
mxCellState  terminal,
bool  source 
) [inline]

Returns the given terminal or the port defined in the given edge state if a cell state exists for that port.

Object com.mxgraph.mxGraphView.GetVisibleTerminal ( Object  edge,
bool  source 
) [inline]

Returns the nearest ancestor terminal that is visible. The edge appears to be connected to this terminal on the display.

Parameters:
edgeCell whose visible terminal should be returned.
sourceBoolean that specifies if the source or target terminal should be returned.
Returns:
Returns the visible source or target terminal.

Invalidates all cell states.

Shortcut to removeState with recurse set to false.

mxCellState com.mxgraph.mxGraphView.RemoveState ( Object  cell,
Boolean  recurse 
) [inline]

Removes and returns the mxCellState for the given cell.

Parameters:
cellmxCell for which the mxCellState should be removed.
Returns:
Returns the mxCellState that has been removed.

First invalidates, then validates all cell states.

Transforms the given control point to an absolute point.

Updates the bounding box in the given cell state.

Parameters:
stateCell state whose bounding box should be updated.
Returns:
void com.mxgraph.mxGraphView.UpdateCellState ( mxCellState  state,
mxCellState  source,
mxCellState  target 
) [inline]

Updates the given cell state.

Parameters:
state

Updates the given state using the bounding box of the absolute points. Also updates terminal distance, length and segments.

Parameters:
stateCell state whose bounds should be updated.
void com.mxgraph.mxGraphView.UpdateEdgeState ( mxCellState  state,
mxGeometry  geo,
mxCellState  source,
mxCellState  target 
) [inline]

Validates the given cell state.

void com.mxgraph.mxGraphView.UpdateFixedTerminalPoint ( mxCellState  edge,
mxCellState  terminal,
bool  source,
mxConnectionConstraint  constraint 
) [inline]

Sets the fixed source or target terminal point on the given edge.

Parameters:
edgeState whose terminal point should be updated.
terminalState which represents the actual terminal.
sourceBoolean that specifies if the terminal is the source.
constraintConstraint that specifies the connection.

Sets the initial absolute terminal points in the given state before the edge style is computed.

Parameters:
edgeCell state whose initial terminal points should be updated.
sourceCell state which represents the source terminal.
targetCell state which represents the target terminal.
void com.mxgraph.mxGraphView.UpdateFloatingTerminalPoint ( mxCellState  edge,
mxCellState  start,
mxCellState  end,
bool  source 
) [inline]

Updates the absolute terminal point in the given state for the given start and end state, where start is the source if source is true.

Parameters:
edgeState whose terminal point should be updated.
startfor the terminal on "this" side of the edge.
endfor the terminal on the other side of the edge.
sourceBoolean indicating if start is the source terminal state.

Updates the terminal points in the given state after the edge style was computed for the edge.

Parameters:
stateState whose terminal points should be updated.
sourceState that represents the source terminal.
targetState that represents the target terminal.

Updates the label bounds in the given state.

Parameters:
state
void com.mxgraph.mxGraphView.UpdatePoints ( mxCellState  edge,
List< mxPoint points,
mxCellState  source,
mxCellState  target 
) [inline]

Updates the absolute points in the given state using the specified array of points as the relative points.

Parameters:
edgeCell state whose absolute points should be updated.
pointsArray of points that constitute the relative points.
sourceCell that represents the source terminal.
targetCell that represents the target terminal.

Updates the absoluteOffset of the given vertex cell state. This takes into account the label position styles.

Parameters:
stateCell state whose absolute offset should be updated.

Validates the given cell state.

First validates all bounds and then validates all points recursively on all visible cells.

Object com.mxgraph.mxGraphView.ValidateCell ( Object  cell) [inline]

Shortcut to validateCell with visible set to true.

Object com.mxgraph.mxGraphView.ValidateCell ( Object  cell,
Boolean  visible 
) [inline]

Recursively creates the cell state for the given cell if visible is true and the given cell is visible. If the cell is not visible but the state exists then it is removed using removeState.

Parameters:
cellCell whose cell state should be created.
visibleBoolean indicating if the cell should be visible.

Shortcut to validateCellState with recurse set to true.

mxCellState com.mxgraph.mxGraphView.ValidateCellState ( Object  cell,
Boolean  recurse 
) [inline]

Validates the cell state for the given cell.

Parameters:
cellCell whose cell state should be validated.
recurseBoolean indicating if the children of the cell should be validated.
Returns:

Member Data Documentation

bool com.mxgraph.mxGraphView.eventsEnabled = true [protected]

Specifies if the view should be revalidated if the scale or translation changes.

Reference to the enclosing graph.

Caches the current bounds of the graph.

double com.mxgraph.mxGraphView.scale = 1 [protected]

Specifies the scale. Default is 1 (100%).

Dictionary<Object, mxCellState> com.mxgraph.mxGraphView.states = new Dictionary<Object, mxCellState>() [protected]

Maps from cells to cell states.

Point that specifies the current translation. Default is a new empty point.


Property Documentation

Returns the enclosing graph.

Returns the cached diagram bounds.

Sets or returns the current scale.

double com.mxgraph.mxGraphView.Scale [get, set]

Sets or returns the current scale.

Dictionary<Object, mxCellState> com.mxgraph.mxGraphView.States [get, set]

Sets or returns the current translation.

Sets or returns the current translation.


The documentation for this class was generated from the following file: