Class: VisualNode

VisualNode

A VisualNode represents the visualization of an ModelNode that is, this class describes how the Node should be drawn (such as its size, color, etc). Note that the actual drawing logic is not part of this class.

Constructor

new VisualNode(node)

Constructs a VisualNode given a ModelNode. The newly constructed VisualNode will represent the visualization of the ModelNode.
Parameters:
Name Type Description
node ModelNode The node to associate with this VisualNode. This object will then be a visualization of the argument
Source:

Methods

drawEventAsRhombus()

Update the shape of the unique non-start node to a diamond shape (unique meaning it only shows up in one of the two active views)
Source:

drawHostAsRhombus()

Update the shape of the unique head node to a diamond shape (unique meaning it only shows up in one of the two active views)
Source:

getFillColor() → {String}

Gets the fill color of the VisualNode.
Source:
Returns:
The fill color
Type
String

getHost() → {String}

Gets the VisualNode's host. This will be the same as the host of the underlying node.
Source:
Returns:
The host
Type
String

getId() → {Number}

Gets this VisualNode's globally unique ID
Source:
Returns:
The unique ID
Type
Number

getLabel() → {String}

Gets the VisualNode's label text. The label text is displayed inside the VisualNode itself
Source:
Returns:
The label text
Type
String

getLineNumber() → {Number}

Gets the line number in the original log text associated with this VisualNode
Source:
Returns:
The line number
Type
Number

getNode() → {ModelNode}

Gets the underlying ModelNode that this VisualNode is a visualization of
Source:
Returns:
The underlying node
Type
ModelNode

getOpacity() → {Number}

Gets the opacity of the node
Source:
Returns:
The opacity
Type
Number

getPoints() → {Array.<Number>}

Gets the polygon points of a unique VisualNode
Source:
Returns:
The polygon points
Type
Array.<Number>

getRadius() → {Number}

Gets the radius of the VisualNode
Source:
Returns:
The radius
Type
Number

getStrokeColor() → {String}

Gets the stroke color of the VisualNode.
Source:
Returns:
The fill color
Type
String

getStrokeWidth() → {Number}

Gets the stroke width in units of px
Source:
Returns:
The stroke width in units of px
Type
Number

getText() → {String}

Gets the texual description of the VisualNode.
Source:
Returns:
The text
Type
String

getX() → {Number}

Gets the x coordinate of the center of the VisualNode.
Source:
Returns:
The x-coordinate
Type
Number

getY() → {Number}

Gets the y coordinate of the center of the VisualNode.
Source:
Returns:
The y-coordinate
Type
Number

hasHiddenChild() → {Boolean}

Determines if this should be drawn with an edge to a hidden child.
Source:
Returns:
True if edge should be drawn
Type
Boolean

hasHiddenParent() → {Boolean}

Determines if this should be drawn with an edge to a hidden parent.
Source:
Returns:
True if edge should be drawn
Type
Boolean

isCollapsed() → {Boolean}

Determines if this VisualNode is a collapsed set of single nodes.
Source:
Returns:
True if this is a collapsed node.
Type
Boolean

isHighlighted() → {Boolean}

Determines if this VisualNode is highlighted.
Source:
Returns:
True if this node is highlighted
Type
Boolean

isLast() → {Boolean}

Determines if this VisualNode is the last node of its host. The last node will have an event handler on it for grey-ing out its host.
Source:
Returns:
True if this is the last VisualNode
Type
Boolean

isSelected() → {Boolean}

Returns whether the node is selected
Source:
Returns:
True if the node is selected
Type
Boolean

isStart() → {Boolean}

Determines if this VisualNode is the special starting node of its host. The start node will be drawn differently from non-start nodes.
Source:
Returns:
True if this is a start VisualNode
Type
Boolean

resetFillColor()

Sets the fillcolour to what was previously recorded prior to last non-temporary call to setFillColor.
Source:

setFillColor(newFillColor, isTemporary)

Sets the fill color of the VisualNode.
Parameters:
Name Type Description
newFillColor String The new fill color. The color must be a string that parses to a valid SVG color as defined in http://www.w3.org/TR/SVG/types.html#WSP
isTemporary Boolean When true, this VisualNode will still produce its previous colour when calling getFillColor, and calling resetFillColor will set it. When false, the record of the previous colour is lost (default).
Source:

setHasHiddenChild(val)

Sets if this should be drawn with an edge to a hidden child.
Parameters:
Name Type Description
val Boolean True if edge should be drawn
Source:

setHasHiddenParent(val)

Sets if this should be drawn with an edge to a hidden parent.
Parameters:
Name Type Description
val Boolean True if edge should be drawn
Source:

setHighlight(val)

Sets if this VisualNode is highlighted.
Parameters:
Name Type Description
val Boolean True if this node is highlighted
Source:

setHostLabelColor(newTextColor)

Sets the hostlabel colour of this node. Precondition: this VisualNode represents a host node
Parameters:
Name Type Description
newTextColor String The new text color. The color must be a string that parses to a valid SVG color as defined in http://www.w3.org/TR/SVG/types.html#WSP
Source:

setLabel(newLabel)

Sets the VisualNode's label text. The label text is displayed inside the VisualNode itself
Parameters:
Name Type Description
newLabel String The new label text
Source:

setOpacity(opacity)

Sets the opacity
Parameters:
Name Type Description
opacity Number The opacity
Source:

setPoints(x,, y,)

Sets the polygon points of a unique VisualNode
Parameters:
Name Type Description
x, Number the new non-zero x coordinates (see updateNodeShape method)
y, Number the new non-zero y coordinates
Source:

setRadius(newRadius)

Sets the radius of the VisualNode
Parameters:
Name Type Description
newRadius Number The new radius
Source:

setSelected(val)

Sets if the node is selected
Parameters:
Name Type Description
val Boolean True if the node is selected
Source:

setStrokeColor(newStrokeColor)

Sets the stroke color of the VisualNode.
Parameters:
Name Type Description
newStrokeColor String The new stroke color. The color must be a string that parses to a valid SVG color as defined in http://www.w3.org/TR/SVG/types.html#WSP
Source:

setStrokeWidth(newStrokeWidth)

Sets the stroke width in px
Parameters:
Name Type Description
newStrokeWidth Number The new stroke width in units of px
Source:

setX(newX)

Sets the x coordinate of the center of the drawing of VisualNode.
Parameters:
Name Type Description
newX Number The new x-coordinate
Source:

setY(newY)

Sets the y coordinate of the center of the VisualNode.
Parameters:
Name Type Description
newY Number The new y-coordinate
Source: