Element Inspector Toolbar

Allows additional toolbar items to be added to the Element Inspector.

Tutorial

Web Plugin

Register the resources needed.

app.registerJavaScript("/org/visallo/examples/detail_toolbar/plugin.js", true);
app.registerResourceBundle("/org/visallo/examples/detail_toolbar/messages.properties");

Register Extension

Now, register the toolbar item.

visallo.registry.registerExtension('org.visallo.detail.toolbar', {
    title: i18n('org.visallo.examples.detail_toolbar.google'),
    event: 'detail-toolbar-google',
    canHandle: function(objects) {
        return objects.vertices.length === 1 && objects.edges.length === 0
            && /#person$/.test(objects.vertices[0].conceptType);
    }
});

Listen

Register a document-level listener for the event specified in the extension. The formatters.vertex.title function transforms an element into a title string using the ontology title formula.

visallo.connect().then(function(api) {
    $(document).on('detail-toolbar-google', function(e, data) {
        var person = data.vertices[0];
        var name = api.formatters.vertex.title(person);
        var url = 'http://www.google.com/#safe=on&q=' + name;
        window.open(url, '_blank');
    });
});

results matching ""

    No results matching ""