Implements a graph component.
mxGraph | Implements a graph component. |
Variables | |
model | Holds the mxGraphModel. |
stylesheet | Holds the mxStylesheet. |
view | Holds the mxGraphView. |
gridSize | Specifies the grid size. |
labelsVisible | Specifies if labels should be visible. |
defaultLoopStyle | mxEdgeStyle to be used for loops. |
imageBundles | Holds the list of image bundles. |
Functions | |
mxGraphModel | Constructs a new graph model using the specified root cell. |
createStylesheet | Creates a new mxStylesheet to be used in this graph. |
createGraphView | Creates a new mxGraphView to be used in this graph. |
getModel | Returns the mxGraphModel that contains the cells. |
getStylesheet | Returns the mxStylesheet that defines the style. |
getView | Returns the mxGraphView that contains the mxCellStates. |
getDefaultParent | Returns the first child child of mxGraphModel.root. |
convertValueToString | Returns the textual representation for the given cell. |
getLabel | Returns a string or DOM node that represents the label for the given cell. |
getChildOffsetForCell | Returns the offset to be used for the cells inside the given cell. |
isOrthogonal | Returns true if perimeter points should be computed such that the resulting edge has only horizontal or vertical segments. |
isCellVisible | Returns true if the given cell is visible. |
isCellCollapsed | Returns true if the given cell is collapsed. |
isCellCollapsed | Returns true if the given cell is connectable. |
getCellGeometry | Returns the mxGeometry for the given mxCell. |
getCellStyle | |
postProcessCellStyle | Tries to resolve the value for the image style in the image bundles and turns short data URIs as defined in mxImageBundle to data URIs as defined in RFC 2397 of the IETF. |
setCellStyles | Sets the key to value in the styles of the given cells. |
addBundle | Adds the specified mxImageBundle. |
removeImageBundle | Removes the specified mxImageBundle. |
getImageFromBundles | Searches all imageBundles for the specified key and returns the value for the first match or null if the key is not found. |
getImageBundles | Returns the imageBundles. |
setImageBundles | Sets the imageBundles. |
insertVertex | Adds a new vertex into the given parent mxCell using value as the user object and the given coordinates as the mxGeometry of the new vertex. |
createVertex | Creates the vertex to be used in insertVertex. |
insertEdge | Adds a new edge into the given parent mxCell using value as the user object and the given source and target as the terminals of the new edge. |
createEdge | Creates the edge to be used in insertEdge. |
getGraphBounds | Returns the bounds of the visible graph. |
getBoundingBox | Returns the bounding box of the given cell including all connected edges if includeEdge is true. |
getPaintBounds | Returns the bounding box of the given cells and their descendants. |
getBoundsForCells | Returns the bounds for the given cells. |
getCellBounds | Returns the bounds of the given cell including all connected edges if includeEdge is true. |
getConnectionConstraint | Returns an mxConnectionConstraint that describes the given connection point. |
getConnectionPoint | Returns the nearest point in the list of absolute points or the center of the opposite terminal. |
findTreeRoots | Returns all children in the given parent which do not have incoming edges. |
createImage | |
drawGraph | Draws the given cell onto the specified canvas. |
paintCell | Draws the given cell onto the specified canvas. |
paintState | Draws the given cell and label onto the specified canvas. |
graphModelChanged | Called when the graph model has changed. |
var $model
Holds the mxGraphModel.
var $stylesheet
Holds the mxStylesheet.
var $view
Holds the mxGraphView.
var $labelsVisible
Specifies if labels should be visible. This is used in getLabel. Default is true.
var $defaultLoopStyle
mxEdgeStyle to be used for loops. This is a fallback for loops if the mxConstants.STYLE_LOOP is undefined. Default is mxEdgeStyle.Loop.
function createStylesheet()
Creates a new mxStylesheet to be used in this graph.
function createGraphView()
Creates a new mxGraphView to be used in this graph.
function getModel()
Returns the mxGraphModel that contains the cells.
function getStylesheet()
Returns the mxStylesheet that defines the style.
function getView()
Returns the mxGraphView that contains the mxCellStates.
function getDefaultParent()
Returns the first child child of mxGraphModel.root. The value returned by this function should be used as the parent for new cells (aka default layer).
function getLabel( $cell )
Returns a string or DOM node that represents the label for the given cell. This implementation uses convertValueToString if labelsVisible is true. Otherwise it returns an empty string.
function getChildOffsetForCell( $cell )
Returns the offset to be used for the cells inside the given cell. The root and layer cells may be identified using <mxGraphModel.isRoot> and <mxGraphModel.isLayer>. For all other current roots, the <mxGraphView.currentRoot> field points to the respective cell, so that the following holds: cell == this.view.currentRoot. This implementation returns null.
cell | mxCell whose offset should be returned. |
function isOrthogonal( $edge )
Returns true if perimeter points should be computed such that the resulting edge has only horizontal or vertical segments.
edge | mxCellState that represents the edge. |
function getCellGeometry( $cell )
Returns the mxGeometry for the given mxCell.
function setCellStyles( $key, $value, $cells )
Sets the key to value in the styles of the given cells. This will modify the existing cell styles in-place and override any existing assignment for the given key. If no cells are specified, then the selection cells are changed. If no value is specified, then the respective key is removed from the styles.
key | String representing the key to be assigned. |
value | String representing the new value for the key. |
cells | Array of mxCells to change the style for. |
Adds the specified mxImageBundle.
function removeImageBundle( $bundle )
Removes the specified mxImageBundle.
function getImageFromBundles( $key )
Searches all imageBundles for the specified key and returns the value for the first match or null if the key is not found.
function getImageBundles()
Returns the imageBundles.
function setImageBundles( $value )
Sets the imageBundles.
function insertVertex( $parent, $id = null, $value = null, $x = 0, $y = 0, $width = 1, $height = 1, $style = null, $relative = false )
Adds a new vertex into the given parent mxCell using value as the user object and the given coordinates as the mxGeometry of the new vertex. The id and style are used for the respective properties of the new mxCell, which is returned.
parent | mxCell that specifies the parent of the new vertex. |
id | Optional string that defines the Id of the new vertex. |
value | Object to be used as the user object. |
x | Integer that defines the x coordinate of the vertex. |
y | Integer that defines the y coordinate of the vertex. |
width | Integer that defines the width of the vertex. |
height | Integer that defines the height of the vertex. |
style | Optional string that defines the cell style. |
relative | Optional boolean that specifies if the geometry is relative. Default is false. |
function insertEdge( $parent, $id = null, $value = null, $source = null, $target = null, $style = null )
Adds a new edge into the given parent mxCell using value as the user object and the given source and target as the terminals of the new edge. The id and style are used for the respective properties of the new mxCell, which is returned.
parent | mxCell that specifies the parent of the new edge. |
id | Optional string that defines the Id of the new edge. |
value | JavaScript object to be used as the user object. |
source | mxCell that defines the source of the edge. |
target | mxCell that defines the target of the edge. |
style | Optional string that defines the cell style. |
function createEdge( $parent, $id = null, $value = null, $source = null, $target = null, $style = null )
Creates the edge to be used in insertEdge. This implementation does not set the source and target of the edge, these are set when the edge is added to the model.
function getGraphBounds()
Returns the bounds of the visible graph. Shortcut to mxGraphView.getGraphBounds.
function getConnectionConstraint( $edge, $terminal, $source )
Returns an mxConnectionConstraint that describes the given connection point. This result can then be passed to getConnectionPoint.
edge | mxCellState that represents the edge. |
terminal | mxCellState that represents the terminal. |
source | Boolean indicating if the terminal is the source or target. |
function getConnectionPoint( $vertex, $constraint )
Returns the nearest point in the list of absolute points or the center of the opposite terminal.
vertex | mxCellState that represents the vertex. |
constraint | mxConnectionConstraint that represents the connection point constraint as returned by getConnectionConstraint. |
function findTreeRoots( $parent, $isolate = false, $invert = false )
Returns all children in the given parent which do not have incoming edges. If the result is empty then the with the greatest difference between incoming and outgoing edges is returned.
parent | mxCell whose children should be checked. |
isolate | Optional boolean that specifies if edges should be ignored if the opposite end is not a child of the given parent cell. Default is false. |
invert | Optional boolean that specifies if outgoing or incoming edges should be counted for a tree root. If false then outgoing edges will be counted. Default is false. |
Holds the mxGraphModel.
var $model
Holds the mxStylesheet.
var $stylesheet
Holds the mxGraphView.
var $view
Specifies the grid size.
var $gridSize
Specifies if labels should be visible.
var $labelsVisible
mxEdgeStyle to be used for loops.
var $defaultLoopStyle
Holds the list of image bundles.
protected $imageBundles
Creates a new mxStylesheet to be used in this graph.
function createStylesheet()
Creates a new mxGraphView to be used in this graph.
function createGraphView()
Returns the mxGraphModel that contains the cells.
function getModel()
Returns the mxStylesheet that defines the style.
function getStylesheet()
Returns the mxGraphView that contains the mxCellStates.
function getView()
Returns the first child child of mxGraphModel.root.
function getDefaultParent()
Holds the root cell, which in turn contains the cells that represent the layers of the diagram as child cells.
var $root
Returns the textual representation for the given cell.
function convertValueToString( $cell )
Returns a string or DOM node that represents the label for the given cell.
function getLabel( $cell )
Returns the offset to be used for the cells inside the given cell.
function getChildOffsetForCell( $cell )
Returns true if perimeter points should be computed such that the resulting edge has only horizontal or vertical segments.
function isOrthogonal( $edge )
Returns true if the given cell is visible.
function isCellVisible( $cell )
Returns true if the given cell is collapsed.
function isCellCollapsed( $cell )
Returns the mxGeometry for the given mxCell.
function getCellGeometry( $cell )
function getCellStyle( $cell )
Tries to resolve the value for the image style in the image bundles and turns short data URIs as defined in mxImageBundle to data URIs as defined in RFC 2397 of the IETF.
function postProcessCellStyle( $style )
Sets the key to value in the styles of the given cells.
function setCellStyles( $key, $value, $cells )
Removes the specified mxImageBundle.
function removeImageBundle( $bundle )
Searches all imageBundles for the specified key and returns the value for the first match or null if the key is not found.
function getImageFromBundles( $key )
Returns the imageBundles.
function getImageBundles()
Sets the imageBundles.
function setImageBundles( $value )
Adds a new vertex into the given parent mxCell using value as the user object and the given coordinates as the mxGeometry of the new vertex.
function insertVertex( $parent, $id = null, $value = null, $x = 0, $y = 0, $width = 1, $height = 1, $style = null, $relative = false )
Creates the vertex to be used in insertVertex.
function createVertex( $parent, $id = null, $value = null, $x = 0, $y = 0, $width = 1, $height = 1, $style = null, $relative = false )
Adds a new edge into the given parent mxCell using value as the user object and the given source and target as the terminals of the new edge.
function insertEdge( $parent, $id = null, $value = null, $source = null, $target = null, $style = null )
Creates the edge to be used in insertEdge.
function createEdge( $parent, $id = null, $value = null, $source = null, $target = null, $style = null )
Returns the bounds of the visible graph.
function getGraphBounds()
Returns the bounding box of the given cell including all connected edges if includeEdge is true.
function getBoundingBox( $cell, $includeEdges = false, $includeDescendants = false )
Returns the bounding box of the given cells and their descendants.
function getPaintBounds( $cells )
Returns the bounds for the given cells.
function getBoundsForCells( $cells, $includeEdges = false, $includeDescendants = false, $boundingBox = false )
Returns the bounds of the given cell including all connected edges if includeEdge is true.
function getCellBounds( $cell, $includeEdges = false, $includeDescendants = false, $boundingBox = false )
Returns an mxConnectionConstraint that describes the given connection point.
function getConnectionConstraint( $edge, $terminal, $source )
Returns the nearest point in the list of absolute points or the center of the opposite terminal.
function getConnectionPoint( $vertex, $constraint )
Returns all children in the given parent which do not have incoming edges.
function findTreeRoots( $parent, $isolate = false, $invert = false )
function createImage( $clip = null, $background = null )
Draws the given cell onto the specified canvas.
function drawGraph( $canvas )
Called when the graph model has changed.
function graphModelChanged( $event )
Defines the key for the loop style.
public static $STYLE_LOOP
Provides a self-reference, aka.
public static $Loop
Returns graphBounds.
function getGraphBounds()