sorry these things aren't as straightforward as they could be :S
I've updated the old example with a working case of what you're looking for. As before, not production code material, just enough to get you up and running ;)
If you look at the source code, one problem here is that the Y.DiagramBuilderImpl
creates its own Y.Connector
instances, so the way to go is to mix
some extensions into it to modify the behaviour.
As you can see in the example, we create an extension with
var CustomConnector = function() {
};
CustomConnector.ATTRS = {
testAttr: {
valueFn: function() {
return 'test attr instance value';
}
}
};
CustomConnector.prototype.initializer = function() {
var instance = this;
instance.SERIALIZABLE_ATTRS.push('testAttr');
};
CustomConnector.prototype.getPropertyModel = function() {
var instance = this;
return [
{
attributeName: 'testAttr',
editor: new Y.TextCellEditor(),
name: 'Test Attr'
}
];
};
Then, we mix
the extension into the existing Y.Connector
adding and overriding functionality as desired with:
Y.Base.mix(Y.Connector, [CustomConnector]);
One additional option could be for you to create your own CustomConnector
class extending Y.Connector
(see Base.create) and then setting that as the connector class for your DiagramBuilder
such as:
var builder = new Y.DiagramBuilder( {
availableFields: availableFields,
boundingBox: '#diagramContainer',
connector: CustomConnector,
srcNode: '#diagramBuilder'
});