1
0
Fork 0

GraphViewer: Dispatcher UI almost finished. Editing of Nodes is not working yet as d3-attributes are displayed in addition to stored attributes

This commit is contained in:
Michael Hackstein 2013-04-08 22:04:03 +02:00
parent 5212b47cff
commit 3b9c59af97
2 changed files with 52 additions and 10 deletions

View File

@ -77,7 +77,7 @@
edges: edges,
nodes: nodes,
startCallback: function() {},
loadNode: function() {},
loadNode: this.loadNode,
reshapeNode: function() {}
},
@ -170,6 +170,20 @@
helper.simulateMouseEvent("click", "control_edit");
expect(nodeShaper.changeTo).toHaveBeenCalledWith({
actions: {
reset: true,
click: jasmine.any(Function)
}
});
expect(edgeShaper.changeTo).toHaveBeenCalledWith({
actions: {
reset: true,
click: jasmine.any(Function)
}
});
helper.simulateMouseEvent("click", "1");
expect($("#control_node_edit_modal").length).toEqual(1);
@ -198,7 +212,7 @@
$("#control_edge_edit_label_value").val("newLabel");
helper.simulateMouseEvent("click", "control_edge_edit_submit");
// Todo check adapter call
expect(adapter.patchEdge).toHaveBeenCalledWith(
edges[0],
{
@ -223,7 +237,7 @@
helper.simulateMouseEvent("click", "control_expand");
expect(edgeShaper.changeTo).toHaveBeenCalledWith({
expect(nodeShaper.changeTo).toHaveBeenCalledWith({
actions: {
reset: true,
click: jasmine.any(Function)
@ -238,7 +252,7 @@
helper.simulateMouseEvent("click", "1");
expect(this.loadNode).toHaveBeenCalledWith(nodes[0]);
expect(this.loadNode).toHaveBeenCalledWith(nodes[0]._id, jasmine.any(Function));
});
});
@ -251,6 +265,20 @@
helper.simulateMouseEvent("click", "control_delete");
expect(edgeShaper.changeTo).toHaveBeenCalledWith({
actions: {
reset: true,
click: jasmine.any(Function)
}
});
expect(edgeShaper.changeTo).toHaveBeenCalledWith({
actions: {
reset: true,
click: jasmine.any(Function)
}
});
helper.simulateMouseEvent("click", "1");
expect(adapter.deleteNode).toHaveBeenCalledWith(
@ -280,7 +308,7 @@
actions: {
reset: true,
mousedown: jasmine.any(Function),
mouseup: jasmine.any(Function),
mouseup: jasmine.any(Function)
}
});

View File

@ -41,6 +41,7 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig)
if (edgeShaper === undefined) {
throw "The EdgeShaper has to be given.";
}
var self = this,
baseClass = "event",
eventlib = new EventLibrary(),
@ -105,8 +106,8 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig)
);
},
callback = function() {
dispatcher.bind("nodes", "click", nodeCallback );
dispatcher.bind("edges", "click", edgeCallback );
rebindNodes({click: nodeCallback});
rebindEdges({click: edgeCallback});
};
createButton("edit", callback);
};
@ -115,7 +116,8 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig)
var prefix = "control_expand",
idprefix = prefix + "_",
callback = function() {
console.log("Not implemented");
rebindNodes({click: dispatcher.events.EXPAND});
rebindEdges();
};
createButton("expand", callback);
};
@ -124,7 +126,12 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig)
var prefix = "control_delete",
idprefix = prefix + "_",
callback = function() {
console.log("Not implemented");
rebindNodes({click: dispatcher.events.DELETENODE(function() {
nodeShaper.reshapeNodes();
})});
rebindEdges({click: dispatcher.events.DELETEEDGE(function() {
edgeShaper.reshapeEdges();
})});
};
createButton("delete", callback);
};
@ -133,7 +140,14 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig)
var prefix = "control_connect",
idprefix = prefix + "_",
callback = function() {
console.log("Not implemented");
rebindNodes({
mousedown: dispatcher.events.STARTCREATEEDGE(),
mouseup: dispatcher.events.FINISHCREATEEDGE(function(){
edgeShaper.reshapeEdges();
})
});
rebindEdges();
};
createButton("connect", callback);
};