I have been trying to use diagram builder example of AlloyUI.
I need to add some extra custom node types as well as some additional properties for the nodes. I thought about modifying and then building the library but it sounds like an overkill for such a task and also I have had issues with building.
Is there an easy way to do this?
UPDATE
I realized I could directly modify files in build folder to get rid of build process. I tried adding something like:
var Lang = A.Lang,
..
CUSTOM = 'custom',
..
..
A.DiagramNodeCustom = A.Component.create({
NAME: DIAGRAM_NODE_NAME,
ATTRS: {
type: {
value: CUSTOM
},
},
EXTENDS: A.DiagramNodeTask
});
A.DiagramBuilder.types[CUSTOM] = A.DiagramNodeCustom;
to /build/aui-diagram-builder-impl/aui-diagram-builder-impl.js
.
I have my main javascript file structures as such:
var Y = YUI().use(
'aui-diagram-builder',
..
function(Y) {
var availableFields = [
..
{
iconClass: 'aui-diagram-node-task-icon',
label: 'Custom',
type: 'custom'
},
..
];
diagram = new Y.DiagramBuilder(
{
availableFields: availableFields,
boundingBox: '#myDiagramContainer',
srcNode: '#myDiagramBuilder'
}
).render();
..
}
);
and I can know add a custom node to my diagram. I can click on it and change the name and such but unfortunately it is invisible on the diagram. Also I still couldn't find how to add new attributes to nodes. Any ideas?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…