';
for (var categoryName in catalogueConfig) {
var categoryMap = catalogueConfig[categoryName];
result += '
';
var itemCount = 0;
var itemNames = [];
for (var itemName in categoryMap) {
itemNames.push(itemName);
var itemMap = categoryMap[itemName];
result += ' | ';
if (++itemCount == itemsPerRow) {
result += '
';
for (c in itemNames) {
result += '| ' + itemNames[c] + ' | ';
}
result += '
';
itemCount = 0;
itemNames = [];
}
}
result += '
';
}
result += '
';
jQuery(selector).append(result);
jQuery('.catalogueItem').each(function(){
var nodeItemMeta = jQuery(this).metadata();
var paper = Raphael(jQuery(this)[0], jQuery(this).width(), jQuery(this).height());
if(nodeItemMeta.shape.type == 'circle'){
var circleXYR = (jQuery(this).height() / 2);
paper.circle(circleXYR, circleXYR, circleXYR - 2).attr({fill : nodeItemMeta.shape.fill});
} else if(nodeItemMeta.shape.type == 'rect'){
paper.rect(1, 1, nodeItemMeta.shape.width - 2,nodeItemMeta.shape.height - 2, 5).attr({fill : nodeItemMeta.shape.fill});
} else if(nodeItemMeta.shape.type == 'path'){
paper.path(nodeItemMeta.shape.path).attr({fill : nodeItemMeta.shape.fill});
}
});
jQuery('.catalogueItem').draggable({helper : 'clone', 'appendTo': '.canvas', containment : '.canvas', opacity : 0.7});
jQuery(".accordion").accordion({fillSpace: true});
jQuery(selector).dialog({
resize: function(event, ui) {
// This is a bit buggy in Chrome, which cuts off the bottom of the accordian
jQuery(".accordion").accordion("resize");
}
});
},
/**
* Adds a connection between two ports using the parameters specified.
* Ports are obtained through the Node.getPort()
*/
connectNodes : function(port1, port2, type, line_width, line_label) {
return NodeConnectHandler.connectNodes(port1, port2, type, line_width, line_label);
},
/**
* Shows the default data editing dialog for Nodes. Currently supports text input (default), select, and textarea. The type
* of input component is determined by an optional 'type' attribute on the node's fieldConfig.
*
* @param nodeEditDialog 'Node' or 'Connection'
* @param nodeId The ID of the item being edited
* @param nodeType The type of the item being edited
*
* This method currently requires a div name 'nodeEditDialog' to exist, which is used as the dialog.
*/
showNodeEditDialog : function (nodeEditDialog, nodeId, nodeType){
// Clear the dialog before building the new one
jQuery('#nodeEditDialog').empty();
if(nodeEditDialog == 'Node'){
var formStructure = jQuery('