1
0
Fork 0

issue #611: a bit more preselection in the graph viewer

This commit is contained in:
Jan Steemann 2013-10-16 09:51:36 +02:00
parent 9bb89bb654
commit dd8fef21a4
6 changed files with 46 additions and 17 deletions

View File

@ -49,7 +49,6 @@ function ArangoAdapter(nodes, edges, config) {
}
}
var self = this,
absAdapter,
absConfig = {},
@ -599,6 +598,18 @@ function ArangoAdapter(nodes, edges, config) {
});
}
};
self.getNodeCollection = function () {
return nodeCollection;
};
self.getEdgeCollection = function () {
return edgeCollection;
};
self.getDirection = function () {
return direction;
}
self.setWidth = absAdapter.setWidth;
self.changeTo = absAdapter.changeTo;

View File

@ -431,17 +431,18 @@ function NodeShaper(parent, flags, idfunc) {
}
if (config.label !== undefined) {
parseLabelFlag(config.label);
self.label = config.label;
}
if (config.actions !== undefined) {
parseActionFlag(config.actions);
}
if (config.color !== undefined) {
parseColorFlag(config.color);
self.color = config.color;
}
if (config.distortion !== undefined) {
parseDistortionFlag(config.distortion);
}
};
self.parent = parent;
@ -518,7 +519,14 @@ function NodeShaper(parent, flags, idfunc) {
self.setGVStartFunction = function(func) {
start = func;
};
self.getLabel = function() {
return self.label || "";
};
self.getColor = function() {
return self.color.key || "";
};
}
NodeShaper.shapes = Object.freeze({

View File

@ -43,6 +43,7 @@ function ArangoAdapterControls(list, adapter) {
this.addControlChangeCollections = function(callback) {
var prefix = "control_adapter_collections",
idprefix = prefix + "_";
adapter.getCollections(function(nodeCols, edgeCols) {
adapter.getGraphs(function(graphs) {
uiComponentsHelper.createButton(baseClass, list, "Collections", prefix, function() {
@ -58,12 +59,14 @@ function ArangoAdapterControls(list, adapter) {
type: "list",
id: "node_collection",
text: "Vertex collection",
objects: nodeCols
objects: nodeCols,
selected: adapter.getNodeCollection()
},{
type: "list",
id: "edge_collection",
text: "Edge collection",
objects: edgeCols
objects: edgeCols,
selected: adapter.getEdgeCollection()
}
]
},{
@ -81,7 +84,8 @@ function ArangoAdapterControls(list, adapter) {
]
},{
type: "checkbox",
id: "undirected"
id: "undirected",
selected: (adapter.getDirection() === "any"),
}], function () {
var nodes = $("#" + idprefix + "node_collection")
.children("option")
@ -116,6 +120,7 @@ function ArangoAdapterControls(list, adapter) {
var prefix = "control_adapter_priority",
idprefix = prefix + "_",
prioList = adapter.getPrioList();
uiComponentsHelper.createButton(baseClass, list, "Group By", prefix, function() {
modalDialogHelper.createModalChangeDialog("Group By",
idprefix, [{

View File

@ -388,7 +388,7 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf
adapterUI.addControlChangeCollections(updateAttributeExamples);
adapterUI.addControlChangePriority();
nodeShaperUI.addControlOpticLabelAndColour();
nodeShaperUI.addControlOpticLabelAndColour(graphViewer.adapter);
/*
buttons.appendChild(nodeShaperDropDown);

View File

@ -161,21 +161,23 @@ var modalDialogHelper = modalDialogHelper || {};
$("#" + idprefix + "modal").modal('show');
},
createTextInput = function(id) {
createTextInput = function(id, value) {
var input = document.createElement("input");
input.type = "text";
input.id = id;
input.value = value;
return input;
},
createCheckboxInput = function(id) {
createCheckboxInput = function(id, selected) {
var input = document.createElement("input");
input.type = "checkbox";
input.id = id;
input.checked = selected;
return input;
},
createListInput = function(id, list) {
createListInput = function(id, list, selected) {
var input = document.createElement("select");
input.id = id;
_.each(
@ -184,6 +186,7 @@ var modalDialogHelper = modalDialogHelper || {};
}), function(entry) {
var option = document.createElement("option");
option.value = entry;
option.selected = (entry === selected);
option.appendChild(
document.createTextNode(entry)
);
@ -314,13 +317,13 @@ var modalDialogHelper = modalDialogHelper || {};
contentTh.className = "collectionTh";
switch(o.type) {
case "text":
contentTh.appendChild(createTextInput(idprefix + o.id));
contentTh.appendChild(createTextInput(idprefix + o.id, o.value || ""));
break;
case "checkbox":
contentTh.appendChild(createCheckboxInput(idprefix + o.id));
contentTh.appendChild(createCheckboxInput(idprefix + o.id, o.selected || false));
break;
case "list":
contentTh.appendChild(createListInput(idprefix + o.id, o.objects));
contentTh.appendChild(createListInput(idprefix + o.id, o.objects, o.selected || undefined));
break;
case "extendable":
insertExtendableInput(idprefix, o.id, o.objects, contentTh, table, tr);

View File

@ -218,7 +218,7 @@ function NodeShaperControls(list, shaper) {
// Mixed Buttons
//////////////////////////////////////////////////////////////////
this.addControlOpticLabelAndColour = function() {
this.addControlOpticLabelAndColour = function(adapter) {
var prefix = "control_node_labelandcolour",
idprefix = prefix + "_";
uiComponentsHelper.createButton(baseClass, list, "Label", prefix, function() {
@ -226,24 +226,26 @@ function NodeShaperControls(list, shaper) {
idprefix, [{
type: "text",
id: "label-attribute",
text: "Vertex label attribute"
text: "Vertex label attribute",
value: shaper.getLabel() || ""
},{
type: "decission",
id: "samecolour",
group: "colour",
text: "Use this attribute for coloring, too",
isDefault: true
isDefault: (shaper.getLabel() === shaper.getColor())
},{
type: "decission",
id: "othercolour",
group: "colour",
text: "Use different attribute for coloring",
isDefault: false,
isDefault: (shaper.getLabel() !== shaper.getColor()),
interior: [
{
type: "text",
id: "colour-attribute",
text: "Color attribute"
text: "Color attribute",
value: shaper.getColor() || ""
}
]
}], function () {