Module: crosscuts

Module for handling of crosscuts using the core.
To include in your module (e.g. Plugin) require via 'common/core/users/crosscut' and invoke initialize by passing a reference to a core instance.

Example

crosscuts.initialize(core);
crosscuts.getIds();

Methods


<static> addMember(node, crosscutId, memberNode [, position])

Adds a member to the crosscut at an optionally provided position.

Parameters:
Name Type Argument Default Description
node module:Core~Node

Owner of the crosscut.

crosscutId string

Crosscut id to add member to.

memberNode module:Core~Node

Node that should be added to crosscut.

position object <optional>
{x:100, y:100}

Position of the member inside crosscut.


<static> createCrosscut(node, title [, order])

Adds a new crosscut to the node.

Parameters:
Name Type Argument Description
node module:Core~Node

Owner of the new crosscut.

title string

Visible title of crosscut.

order number <optional>

Tab order starting from 0, if not given will be placed at end.

Returns:

The id of the newly created crosscut.

Type
string

<static> deleteCrosscut(node, crosscutId)

Deletes the crosscut from the node.

Parameters:
Name Type Description
node module:Core~Node

Owner of the crosscut.

crosscutId string

Id of crosscut to delete.


<static> delMember(node, crosscutId, memberNodeOrPath)

Removes the member from the specified crosscut.

Parameters:
Name Type Description
node module:Core~Node

Owner of the crosscut.

crosscutId string

Id of crosscut.

memberNodeOrPath module:Core~Node | string

Node, or path of, member to delete from crosscut.


<static> getIdFromTitle(node, title)

If title exists and is unique will return the id of the crosscut. If not it will throw an exception.

Parameters:
Name Type Description
node module:Core~Node

Owner of the crosscut.

title string
Returns:

The crosscut id.

Type
string

<static> getIds(node)

Returns all the cross-cut ideas at the provided node.

Parameters:
Name Type Description
node module:Core~Node

Owner of the crosscuts.

Returns:

The crosscut ids.

Type
Array.<string>

<static> getInfo(node)

Returns the raw stored crosscut info at the provided node.

Parameters:
Name Type Description
node module:Core~Node
Returns:
Type
Array.<object>

<static> getMemberPaths(node, crosscutId)

Returns the paths to all members in the specified crosscut.

Parameters:
Name Type Description
node module:Core~Node

Owner of the crosscut.

crosscutId string
Returns:

Paths of members

Type
Array.<string>

<static> getMemberPosition(node, crosscutId, memberNodeOrPath)

Return the position at the cross-cuts for the member in the given crosscut at the provided node.

Parameters:
Name Type Description
node module:Core~Node

Owner of the crosscut.

crosscutId string

Crosscut id to add member to.

memberNodeOrPath module:Core~Node | string

Node, or path of, member to get position of.

Returns:

The position of the member inside the crosscut.

Type
object

<static> getTitles(node)

Returns all titles of the crosscuts at the provided node.

Parameters:
Name Type Description
node module:Core~Node

Owner of the crosscuts.

Returns:
Type
Array.<string>

<static> initialize(core)

Initializes the module with a core instance. This must be called before any other method.

Parameters:
Name Type Description
core Core

An instance of a Core module.


<static> setMemberPosition(node, crosscutId, memberNodeOrPath, newPosition)

Updates the position of the member inside the specified crosscut.

Parameters:
Name Type Description
node module:Core~Node

Owner of the crosscut.

crosscutId string

Id of crosscut.

memberNodeOrPath module:Core~Node | string

Node, or path of, member to update position for.

newPosition object

Position of the member inside the crosscut.