Skip to content

Commit

Permalink
Merge pull request #63 from rwth-acis/develop
Browse files Browse the repository at this point in the history
v1.3.0
  • Loading branch information
pdolif authored Jun 9, 2022
2 parents 2ea4a39 + eeacc93 commit e575147
Show file tree
Hide file tree
Showing 35 changed files with 360 additions and 158 deletions.
2 changes: 1 addition & 1 deletion widgets/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion widgets/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@rwth-acis/syncmeta-widgets",
"description": "SyncMeta is a near real-time collaborative modeling framework. This package only contains the used widgets. If you want to use the SyncMeta app in a docker container, see https://github.com/rwth-acis/syncmeta.",
"version": "1.1.1",
"version": "1.3.0",
"author": {
"name": "ACIS Group, RWTH Aachen",
"email": "[email protected]"
Expand Down
6 changes: 3 additions & 3 deletions widgets/src/js/attribute_widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ requirejs([
$('#wrapper').find('h1').text('Got Response from Canvas! Connecting to Yjs....');
var iwc = IWCW.getInstance(CONFIG.WIDGET.NAME.ATTRIBUTE);
iwc.setSpace(user);

yjsSync().done(function (y, spaceTitle) {
window.y = y;
window.syncmetaLog = {
Expand Down Expand Up @@ -69,7 +69,7 @@ requirejs([
}
for (nodeId in json.nodes) {
if (json.nodes.hasOwnProperty(nodeId)) {
var node = EntityManager.createNodeFromJSON(json.nodes[nodeId].type, nodeId, json.nodes[nodeId].left, json.nodes[nodeId].top, json.nodes[nodeId].width, json.nodes[nodeId].height, json.nodes[nodeId]);
var node = EntityManager.createNodeFromJSON(json.nodes[nodeId].type, nodeId, json.nodes[nodeId].left, json.nodes[nodeId].top, json.nodes[nodeId].width, json.nodes[nodeId].height, json.nodes[nodeId].zIndex, json.nodes[nodeId]);
node.registerYType();
node.addToWrapper(wrapper);
}
Expand Down Expand Up @@ -136,4 +136,4 @@ requirejs([



});
});
22 changes: 19 additions & 3 deletions widgets/src/js/attribute_widget/AbstractNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ define([
* @param {number} top y-coordinate of node position
* @param {number} width Width of node
* @param {number} height Height of node
* @param {boolean} containment containment
* @param {string} viewId the identifier of the view the node belongs to
* @constructor
*/
function AbstractNode(id, type, left, top, width, height, viewId) {
function AbstractNode(id, type, left, top, width, height, containment, viewId) {
var that = this;

AbstractEntity.call(this, id);
Expand All @@ -47,6 +48,13 @@ define([
*/
var _type = type;

/**
* Type of node
* @containment {boolean}
* @private
*/
var _containment = containment;

/**
* Label of edge
* @type {attribute_widget.SingleValueAttribute}
Expand Down Expand Up @@ -284,6 +292,14 @@ define([
return _type;
};

/**
* Get edge type
* @returns {boolean}
*/
this.getContainment = function () {
return _containment;
};

/**
* Get jQuery object of DOM node representing the node
* @returns {jQuery}
Expand Down Expand Up @@ -515,11 +531,11 @@ define([
AbstractNode.prototype.registerYType = function () {
this._registerYType();
};

AbstractNode.prototype.remove = function(){
this._remove();
}

return AbstractNode;

});
});
8 changes: 4 additions & 4 deletions widgets/src/js/attribute_widget/AttributeWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ define([

var json = operation.getJSON();
if (json) {
node = EntityManager.createNodeFromJSON(type, operation.getEntityId(), operation.getLeft(), operation.getTop(), operation.getWidth(), operation.getHeight(), operation.getJSON());
node = EntityManager.createNodeFromJSON(type, operation.getEntityId(), operation.getLeft(), operation.getTop(), operation.getWidth(), operation.getHeight(), operation.getContainment(), operation.getJSON());
} else {
node = EntityManager.createNode(type, operation.getEntityId(), operation.getLeft(), operation.getTop(), operation.getWidth(), operation.getHeight());
node = EntityManager.createNode(type, operation.getEntityId(), operation.getLeft(), operation.getTop(), operation.getWidth(), operation.getHeight(), operation.getContainment());
}
node.addToWrapper(that);
}
Expand Down Expand Up @@ -194,7 +194,7 @@ define([
switch (nodeEvent.name) {
case 'jabberId': {
var map = nodeEvent.object;
nodeAddCallback(new NodeAddOperation(map.get('id'), map.get('type'), map.get('left'), map.get('top'), map.get('width'), map.get('height'), map.get('zIndex'), map.get('json'), null, null, nodeEvent.value));
nodeAddCallback(new NodeAddOperation(map.get('id'), map.get('type'), map.get('left'), map.get('top'), map.get('width'), map.get('height'), map.get('zIndex'), map.get('containment'), map.get('json'), null, null, nodeEvent.value));
break;
}
default:
Expand Down Expand Up @@ -296,4 +296,4 @@ define([

return AttributeWrapper;

});
});
12 changes: 6 additions & 6 deletions widgets/src/js/attribute_widget/EntityManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ define(['lodash',
var viewEdgeTypes = {};

var _edges = {};

//noinspection JSUnusedGlobalSymbols
return {
/**
Expand All @@ -137,9 +137,9 @@ define(['lodash',
* @param {object} json the json representation of the node
* @returns {attribute_widget.AbstractNode}
*/
createNode : function (type, id, left, top, width, height,json) {
createNode : function (type, id, left, top, width, height, containment, json) {
var node;

if (viewNodeTypes.hasOwnProperty(type) && viewId) {
node = viewNodeTypes[type](id, left, top, width, height, json);
}
Expand Down Expand Up @@ -240,7 +240,7 @@ define(['lodash',
*/
createEdge : function (type, id, source, target) {
var edge;

if(viewId && viewEdgeTypes.hasOwnProperty(type)){
edge = viewEdgeTypes[type](id, source, target);
}
Expand Down Expand Up @@ -317,8 +317,8 @@ define(['lodash',
* @param {object} json JSON representation
* @returns {attribute_widget.AbstractNode}
*/
createNodeFromJSON : function (type, id, left, top, width, height, json) {
var node = this.createNode(type, id, left, top, width, height, json);
createNodeFromJSON : function (type, id, left, top, width, height, containment, json) {
var node = this.createNode(type, id, left, top, width, height, containment, json);
if (node) {
node.getLabel().getValue().setValue(json.label.value.value);
for (var attrId in json.attributes) {
Expand Down
11 changes: 7 additions & 4 deletions widgets/src/js/attribute_widget/NodeShapeNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ define([
'jsplumb',
'lodash',
'attribute_widget/AbstractNode',
'attribute_widget/BooleanAttribute',
'attribute_widget/SingleSelectionAttribute',
'attribute_widget/SingleValueAttribute',
'attribute_widget/IntegerAttribute',
'attribute_widget/SingleColorValueAttribute',
'attribute_widget/SingleCodeEditorValueAttribute',
'text!templates/attribute_widget/node_shape_node.html'
],/** @lends NodeShapeNode */function($,jsPlumb,_,AbstractNode,SingleSelectionAttribute,SingleValueAttribute,IntegerAttribute,SingleColorValueAttribute,SingleCodeEditorValueAttribute,nodeShapeNodeHtml) {
],/** @lends NodeShapeNode */function($,jsPlumb,_,AbstractNode,BooleanAttribute,SingleSelectionAttribute,SingleValueAttribute,IntegerAttribute,SingleColorValueAttribute,SingleCodeEditorValueAttribute,nodeShapeNodeHtml) {

NodeShapeNode.TYPE = "Node Shape";

Expand All @@ -26,12 +27,13 @@ define([
* @param {number} top y-coordinate of node position
* @param {number} width Width of node
* @param {number} height Height of node
* @param {boolean} containment Height of node
*/
function NodeShapeNode(id,left,top,width,height){
function NodeShapeNode(id,left,top,width,height,containment){

var that = this;

AbstractNode.call(this,id,NodeShapeNode.TYPE,left,top,width,height);
AbstractNode.call(this,id,NodeShapeNode.TYPE,left,top,width,height,containment);

/**
* jQuery object of node template
Expand Down Expand Up @@ -65,6 +67,7 @@ define([
this.addAttribute(new SingleColorValueAttribute(this.getEntityId()+"[color]","Color",this));
this.addAttribute(new IntegerAttribute(this.getEntityId()+"[defaultWidth]","Default Width",this));
this.addAttribute(new IntegerAttribute(this.getEntityId()+"[defaultHeight]","Default Height",this));
this.addAttribute(new BooleanAttribute(this.getEntityId()+"[containment]","Containment",this));
this.addAttribute(new SingleCodeEditorValueAttribute(this.getEntityId()+"[customShape]","Custom Shape",this));
this.addAttribute(new SingleValueAttribute(this.getEntityId()+"[customAnchors]","Custom Anchors",this));

Expand Down Expand Up @@ -92,4 +95,4 @@ define([

return NodeShapeNode;

});
});
12 changes: 6 additions & 6 deletions widgets/src/js/canvas_widget/AbstractClassNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ define([
that.getLabel().getValue().registerYType();
attr.registerYMap();
};

this.unregisterCallbacks = function(){
that.getAttribute('[attributes]').unregisterCallbacks();
}

_$node.find(".label").append(this.getLabel().get$node());

for(var attributeKey in _attributes){
Expand All @@ -106,7 +106,7 @@ define([
nodeId;

//noinspection JSAccessibilityCheck
nodeId = canvas.createNode(require('canvas_widget/ObjectNode').TYPE,appearance.left,appearance.top,appearance.width,appearance.height,that.getZIndex(),that.toJSON());
nodeId = canvas.createNode(require('canvas_widget/ObjectNode').TYPE,appearance.left,appearance.top,appearance.width,appearance.height,that.getZIndex(),that.getContainment(),that.toJSON());
var edges = that.getOutgoingEdges(),
edge,
edgeId;
Expand Down Expand Up @@ -141,7 +141,7 @@ define([
nodeId;

//noinspection JSAccessibilityCheck
nodeId = canvas.createNode(require('canvas_widget/RelationshipNode').TYPE,appearance.left,appearance.top,appearance.width,appearance.height,that.getZIndex(),that.toJSON());
nodeId = canvas.createNode(require('canvas_widget/RelationshipNode').TYPE,appearance.left,appearance.top,appearance.width,appearance.height,that.getZIndex(),that.getContainment(),that.toJSON());
var edges = that.getOutgoingEdges(),
edge,
edgeId;
Expand Down Expand Up @@ -176,7 +176,7 @@ define([
nodeId;

//noinspection JSAccessibilityCheck
nodeId = canvas.createNode(require('canvas_widget/RelationshipGroupNode').TYPE,appearance.left,appearance.top,appearance.width,appearance.height,that.getZIndex(),that.toJSON());
nodeId = canvas.createNode(require('canvas_widget/RelationshipGroupNode').TYPE,appearance.left,appearance.top,appearance.width,appearance.height,that.getZIndex(),that.getContainment(),that.toJSON());
var edges = that.getOutgoingEdges(),
edge,
edgeId;
Expand Down Expand Up @@ -214,4 +214,4 @@ define([

return AbstractClassNode;

});
});
4 changes: 2 additions & 2 deletions widgets/src/js/canvas_widget/AbstractClassNodeTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ define([
* @constructor
*/
function AbstractClassNodeTool(){
NodeTool.call(this,AbstractClassNode.TYPE,null,null,AbstractClassNode.DEFAULT_WIDTH,AbstractClassNode.DEFAULT_HEIGHT);
NodeTool.call(this,AbstractClassNode.TYPE,null,null,null,AbstractClassNode.DEFAULT_WIDTH,AbstractClassNode.DEFAULT_HEIGHT);
}

return AbstractClassNodeTool;

});
});
Loading

0 comments on commit e575147

Please sign in to comment.