org.visallo.graph.selection

Add custom graph selection menu items

Add custom cytoscape selection menu items. Graph provides select all, none, and invert by default.

The text displayed to the user uses the message bundle key:

 graph.selector.[identifier].displayName=Selection Text to Display

Example

var doRandomSelection = function(cy) {
    var nodes = cy.nodes().unselect(),
        randomIndex = Math.floor(Math.random() * nodes.length);
    nodes[randomIndex].select();
}
doRandomSelection.identifier = 'myRandomSelector';
// optionally: doRandomSelection.visibility = 'always';
registry.registerExtension('org.visallo.graph.selection', doRandomSelection);

Registration

registry.registerExtension("org.visallo.graph.selection", config)

Source:
Tutorials:
See:
Configuration Properties:
Name Type Description
config function

Function that does the custom selection

Properties
Name Type Attributes Description
identifier string

Unique id for selection

visibility string <optional>

When should the item be available based on the current selection

  • selected When there is currently something selected
  • none-selected When nothing is selected
  • always Always show this option regardless of selection state

Validation Function

Extensions registered must pass this validation check to be used.

function extensionValidator(e) {
    return 'identifier' in e && _.contains([
        'selected',
        'none-selected',
        'always'
    ], e.visibility);
}