I’m trying to embed a link in the Properties Panel that, when clicked, will generate an event that I can listen on to load another page in my application. I have looked at the proposal on GitHub for clickable shapes, which I would also like to see, but this is not a click at the shape level, it needs to be a property of a shape. I may have multiple clickable links per shape. The linkEntryFactory seems to fit my needs, but I think I am not understanding how it works.
I have successfully embedded the link in the properties panel via the link entryFactory. The element shows as a colored link and behaves like a clickable link on mouse rollover. I just can’t see how to listen on a click event. I see the linkSelected function in linkEntryFactory that appears to handle a click, but it seems to fire when the panel loads and not on a click of the link.
Are there any examples that use the link that might help me?
This is the only code I added to get the link to render. In addition, in my Moddle JSON, I added the model property: ‘schemaCodeGen’. It’s possible that I have this code all wrong as I have borrowed the snippet from textField, but I was just trying to get something running to see how the click event is captured.
group.entries.push(entryFactory.link({ // TODO: I have no idea how to get the click event
id : 'schema-code-gen',
label : translate('Schema Code Generation and Deployment'),
modelProperty: 'schemaCodeGen',
description: 'Click this link to view generated code, with the option to deploy a new version of the schema',
get: function(element, node) {
var bo = getBusinessObject(element);
return {
schemaCodeGen: bo.get('korio:schemaCodeGen')
};
},
set: function(element, values, node) {
var bo = getBusinessObject(element),
schemaCodeGen = values.schemaCodeGen || undefined;
return cmdHelper.updateBusinessObject(element, bo, { 'korio:schemaCodeGen': schemaCodeGen });
}
}));