1
0
Fork 0

GraphViewer: Implemented UI Dialogs for edge colouring

This commit is contained in:
Michael Hackstein 2013-04-04 00:30:54 +02:00
parent f5c523ea56
commit c208a94f52
2 changed files with 93 additions and 1 deletions

View File

@ -177,7 +177,7 @@
helper.simulateMouseEvent("click", "control_gradientcolour");
$("#control_gradientcolour_source").attr("value", "#123456");
$("#control_gradientcolour_target").attr("value", "#654321");
helper.simulateMouseEvent("click", "control_expandcolour_submit");
helper.simulateMouseEvent("click", "control_gradientcolour_submit");
expect(shaper.changeTo).toHaveBeenCalledWith({
color: {

View File

@ -101,10 +101,102 @@ function EdgeShaperControls(list, shaper) {
button.onclick = callback;
};
this.addControlOpticSingleColour = function() {
var prefix = "control_singlecolour",
idprefix = prefix + "_",
callback = function() {
modalDialogHelper.createModalDialog("Switch to Colour",
idprefix, [{
type: "text",
id: "stroke"
}], function () {
var stroke = $("#" + idprefix + "stroke").attr("value");
shaper.changeTo({
color: {
type: "single",
stroke: stroke
}
});
}
);
},
button = document.createElement("li");
button.className = "graph_control " + prefix;
button.id = prefix;
button.appendChild(document.createTextNode("Single Colour"));
list.appendChild(button);
button.onclick = callback;
};
this.addControlOpticAttributeColour = function() {
var prefix = "control_attributecolour",
idprefix = prefix + "_",
callback = function() {
modalDialogHelper.createModalDialog("Display colour by attribute",
idprefix, [{
type: "text",
id: "key"
}], function () {
var key = $("#" + idprefix + "key").attr("value");
shaper.changeTo({
color: {
type: "attribute",
key: key
}
});
}
);
},
button = document.createElement("li");
button.className = "graph_control " + prefix;
button.id = prefix;
button.appendChild(document.createTextNode("Colour by Attribute"));
list.appendChild(button);
button.onclick = callback;
};
this.addControlOpticGradientColour = function() {
var prefix = "control_gradientcolour",
idprefix = prefix + "_",
callback = function() {
modalDialogHelper.createModalDialog("Change colours for gradient",
idprefix, [{
type: "text",
id: "source"
},{
type: "text",
id: "target"
}], function () {
var source = $("#" + idprefix + "source").attr("value"),
target = $("#" + idprefix + "target").attr("value");
shaper.changeTo({
color: {
type: "gradient",
source: source,
target: target
}
});
}
);
},
button = document.createElement("li");
button.className = "graph_control " + prefix;
button.id = prefix;
button.appendChild(document.createTextNode("Gradient Colour"));
list.appendChild(button);
button.onclick = callback;
};
this.addAllOptics = function () {
self.addControlOpticShapeNone();
self.addControlOpticShapeArrow();
self.addControlOpticLabel();
self.addControlOpticSingleColour();
self.addControlOpticAttributeColour();
self.addControlOpticGradientColour();
};
this.addAllActions = function () {