This is related to this question, but it is about adding custom node types and attributes to nodes (which I have been successful in doing), and I'm looking to add custom properties on connections themselves.
I have tried overriding the methods getProperties
and getPropertyModel
on builder.connector
to no avail. Below is my current (and what I believe to be closest) attempt:
// .. adding different node types and their attributes
var builder = new Y.DiagramBuilder( {
availableFields: availableFields,
boundingBox: '#diagramContainer',
srcNode: '#diagramBuilder'
} );
builder.render();
var test = builder.connector.addAttr(
'testAttr',
{
value:'test',
validator: Y.Lang.isString,
readOnly: false,
lazyAdd: false
},
false
);
builder.connector.SERIALIZABLE_ATTRS.push('testAttr');
// just calling addAttr doesn't seem to work, so I also tried this..
test.getProperties = function() {
return [
{
attributeName: 'testAttr',
editor: new Y.TextCellEditor(),
name: 'Test Attr',
value: 'default value??'
}
]
};
Looking in the source, there seems to be a STRINGS
property that may also need to be modified, but I can only find a method for getting the strings (getStrings
) and no method for modifying them. I could try modifying it directly, but I'm not 100% sure what object it's present on (above it is not set on the builder.connector)
Thanks in advance.