in core/src/main/resources/org/apache/karaf/webconsole/core/behavior/dracula/dracula_graph.js [222:269]
drawNode: function(node) {
var point = this.translate([node.layoutPosX, node.layoutPosY]);
node.point = point;
/* if node has already been drawn, move the nodes */
if(node.shape) {
var oBBox = node.shape.getBBox();
var opoint = { x: oBBox.x + oBBox.width / 2, y: oBBox.y + oBBox.height / 2};
node.shape.translate(Math.round(point[0] - opoint.x), Math.round(point[1] - opoint.y));
this.r.safari();
return node;
}/* else, draw new nodes */
var shape;
/* if a node renderer function is provided by the user, then use it
or the default render function instead */
if(!node.render) {
node.render = function(r, node) {
/* the default node drawing */
var color = Raphael.getColor();
var ellipse = r.ellipse(0, 0, 30, 20).attr({fill: color, stroke: color, "stroke-width": 2});
/* set DOM node ID */
ellipse.node.id = node.label || node.id;
shape = r.set().
push(ellipse).
push(r.text(0, 30, node.label || node.id));
return shape;
}
}
/* or check for an ajax representation of the nodes */
if(node.shapes) {
// TODO ajax representation evaluation
}
shape = node.render(this.r, node).hide();
shape.attr({"fill-opacity": .6});
/* re-reference to the node an element belongs to, needed for dragging all elements of a node */
shape.items.forEach(function(item){ item.set = shape; item.node.style.cursor = "move"; });
shape.mousedown(this.dragger);
var box = shape.getBBox();
shape.translate(Math.round(point[0]-(box.x+box.width/2)),Math.round(point[1]-(box.y+box.height/2)))
//console.log(box,point);
node.hidden || shape.show();
node.shape = shape;
},