Highlight

Highlight

new Highlight(graph, props) → {Highlight}

Source:
Properties:
Name Type Description
guid string

Unique GUID for highlight.

graph Graph

Main Graph Object.

type string

Stores the type of highlight as string, default type will be activity if none provide, others can be: 'role', 'relation', 'suggestion', 'alias', 'comment', 'note'.

items array

Stores items of the highlight with which the it is associated with, e-g Element, Connection or Roles object.

layers array

Stores layers of the highlight with ranges of the selection in that layer associated with highlight e-g: { layer: HighlightLayer, ranges: [HighlighterRange]}

attrs array

Stores any custom attributes to be added for nodes of the Highlight { name: NAME OF ATTRIBUTE, value: VALUE OF ATTRIBUTE}

Main Highlight Class, it will be used to create highlights for DCR

Parameters:
Name Type Description
graph Graph

A graph object of the current application is passed so it can be used to update the garph easily.

props object

An object is passed with basic or updates to basic properties of the highlight object.

Returns:

Returns Highlight Object.

Type
Highlight

Methods

(static) addItem(item) → {Highlight}

Source:

Add an item to Highlight

Parameters:
Name Type Description
item object

An object either of Class Element, Connection or Roles of graph is to be passed.

Returns:

Returns an object of Highlight Class.

Type
Highlight

(static) addRange(layer, range) → {Highlight}

Source:

Add a range to Highlight

Parameters:
Name Type Description
layer HighlightLayer

A HighlightLayer object is required to add the range to that layer for current Highlight

range object

An object containing range details e-g: {start = null; end = null; text = null}

Returns:

Returns an object of Highlight Class.

Type
Highlight

(static) getItemId(item) → {string}

Source:

Get the Id of the items in Highlight

Parameters:
Name Type Description
item object

An object either of Class Element, Connection or Roles of graph is to be passed.

Returns:

Returns id of the item or undefined.

Type
string

(static) remove(removeItems) → {bool}

Source:

Remove Highlight from graph Highlights

Parameters:
Name Type Description
removeItems bool

TODO: If we want to remove associated items as well, we have pass removeItems= true.

Returns:

Always returns true.

Type
bool

(static) removeItem(item) → {Highlight}

Source:

Removes an item from Highlight, if there is no item then the Highlight is removed from Graph Highlights.

Parameters:
Name Type Description
item object

An object either of Class Element, Connection or Roles of graph is to be passed.

Returns:

Returns an object of Highlight Class.

Type
Highlight

(static) removeRange(layer, range) → {Highlight}

Source:

Remove a range from Highlight

Parameters:
Name Type Description
layer HighlightLayer

A HighlightLayer object is required to add the range to that layer for current Highlight

range object

An object containing range details e-g: {start = null; end = null; text = null}

Returns:

Returns an object of Highlight Class.

Type
Highlight