mirror of https://gitee.com/bigwinds/arangodb
GraphViewer: Further adaption of CSS for the admin interface
This commit is contained in:
parent
7049c7c80e
commit
caaff89ec6
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
<script type="text/javascript" src="../graph/colourMapper.js"></script>
|
<script type="text/javascript" src="../graph/colourMapper.js"></script>
|
||||||
<script type="text/javascript" src="../graph/edgeShaper.js"></script>
|
<script type="text/javascript" src="../graph/edgeShaper.js"></script>
|
||||||
|
<script type="text/javascript" src="../ui/uiComponentsHelper.js"></script>
|
||||||
<script type="text/javascript" src="../ui/modalDialogHelper.js"></script>
|
<script type="text/javascript" src="../ui/modalDialogHelper.js"></script>
|
||||||
<script type="text/javascript" src="../ui/edgeShaperControls.js"></script>
|
<script type="text/javascript" src="../ui/edgeShaperControls.js"></script>
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,30 @@
|
||||||
list.id = "control_list";
|
list.id = "control_list";
|
||||||
shaperUI = new EdgeShaperControls(list, shaper);
|
shaperUI = new EdgeShaperControls(list, shaper);
|
||||||
spyOn(shaper, 'changeTo');
|
spyOn(shaper, 'changeTo');
|
||||||
|
this.addMatchers({
|
||||||
|
toConformToListCSS: function() {
|
||||||
|
var li = this.actual,
|
||||||
|
a = li.firstChild,
|
||||||
|
lbl = a.firstChild,
|
||||||
|
msg = "";
|
||||||
|
this.message = function() {
|
||||||
|
return "Expected " + msg;
|
||||||
|
};
|
||||||
|
if (li === undefined || li.tagName.toLowerCase() !== "li") {
|
||||||
|
msg = "first element to be a li";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (a === undefined || a.tagName.toLowerCase() !== "a") {
|
||||||
|
msg = "first element to be a a";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (lbl === undefined || lbl.tagName.toLowerCase() !== "label") {
|
||||||
|
msg = "first element to be a label";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
|
@ -71,6 +95,7 @@
|
||||||
shaperUI.addControlOpticShapeNone();
|
shaperUI.addControlOpticShapeNone();
|
||||||
|
|
||||||
expect($("#control_list #control_none").length).toEqual(1);
|
expect($("#control_list #control_none").length).toEqual(1);
|
||||||
|
expect($("#control_list #control_none")[0]).toConformToListCSS();
|
||||||
|
|
||||||
helper.simulateMouseEvent("click", "control_none");
|
helper.simulateMouseEvent("click", "control_none");
|
||||||
|
|
||||||
|
@ -87,6 +112,7 @@
|
||||||
shaperUI.addControlOpticShapeArrow();
|
shaperUI.addControlOpticShapeArrow();
|
||||||
|
|
||||||
expect($("#control_list #control_arrow").length).toEqual(1);
|
expect($("#control_list #control_arrow").length).toEqual(1);
|
||||||
|
expect($("#control_list #control_arrow")[0]).toConformToListCSS();
|
||||||
|
|
||||||
helper.simulateMouseEvent("click", "control_arrow");
|
helper.simulateMouseEvent("click", "control_arrow");
|
||||||
|
|
||||||
|
@ -104,6 +130,7 @@
|
||||||
shaperUI.addControlOpticLabel();
|
shaperUI.addControlOpticLabel();
|
||||||
|
|
||||||
expect($("#control_list #control_label").length).toEqual(1);
|
expect($("#control_list #control_label").length).toEqual(1);
|
||||||
|
expect($("#control_list #control_label")[0]).toConformToListCSS();
|
||||||
|
|
||||||
helper.simulateMouseEvent("click", "control_label");
|
helper.simulateMouseEvent("click", "control_label");
|
||||||
$("#control_label_key").attr("value", "theAnswer");
|
$("#control_label_key").attr("value", "theAnswer");
|
||||||
|
@ -125,6 +152,7 @@
|
||||||
shaperUI.addControlOpticSingleColour();
|
shaperUI.addControlOpticSingleColour();
|
||||||
|
|
||||||
expect($("#control_list #control_singlecolour").length).toEqual(1);
|
expect($("#control_list #control_singlecolour").length).toEqual(1);
|
||||||
|
expect($("#control_list #control_singlecolour")[0]).toConformToListCSS();
|
||||||
|
|
||||||
helper.simulateMouseEvent("click", "control_singlecolour");
|
helper.simulateMouseEvent("click", "control_singlecolour");
|
||||||
$("#control_singlecolour_stroke").attr("value", "#123456");
|
$("#control_singlecolour_stroke").attr("value", "#123456");
|
||||||
|
@ -149,6 +177,7 @@
|
||||||
shaperUI.addControlOpticAttributeColour();
|
shaperUI.addControlOpticAttributeColour();
|
||||||
|
|
||||||
expect($("#control_list #control_attributecolour").length).toEqual(1);
|
expect($("#control_list #control_attributecolour").length).toEqual(1);
|
||||||
|
expect($("#control_list #control_attributecolour")[0]).toConformToListCSS();
|
||||||
|
|
||||||
helper.simulateMouseEvent("click", "control_attributecolour");
|
helper.simulateMouseEvent("click", "control_attributecolour");
|
||||||
$("#control_attributecolour_key").attr("value", "label");
|
$("#control_attributecolour_key").attr("value", "label");
|
||||||
|
@ -173,6 +202,7 @@
|
||||||
shaperUI.addControlOpticGradientColour();
|
shaperUI.addControlOpticGradientColour();
|
||||||
|
|
||||||
expect($("#control_list #control_gradientcolour").length).toEqual(1);
|
expect($("#control_list #control_gradientcolour").length).toEqual(1);
|
||||||
|
expect($("#control_list #control_gradientcolour")[0]).toConformToListCSS();
|
||||||
|
|
||||||
helper.simulateMouseEvent("click", "control_gradientcolour");
|
helper.simulateMouseEvent("click", "control_gradientcolour");
|
||||||
$("#control_gradientcolour_source").attr("value", "#123456");
|
$("#control_gradientcolour_source").attr("value", "#123456");
|
||||||
|
@ -194,10 +224,6 @@
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
it('should be able to add all optic controls to the list', function () {
|
it('should be able to add all optic controls to the list', function () {
|
||||||
shaperUI.addAllOptics();
|
shaperUI.addAllOptics();
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,30 @@
|
||||||
list.id = "control_list";
|
list.id = "control_list";
|
||||||
shaperUI = new NodeShaperControls(list, shaper);
|
shaperUI = new NodeShaperControls(list, shaper);
|
||||||
spyOn(shaper, 'changeTo');
|
spyOn(shaper, 'changeTo');
|
||||||
|
this.addMatchers({
|
||||||
|
toConformToListCSS: function() {
|
||||||
|
var li = this.actual,
|
||||||
|
a = li.firstChild,
|
||||||
|
lbl = a.firstChild,
|
||||||
|
msg = "";
|
||||||
|
this.message = function() {
|
||||||
|
return "Expected " + msg;
|
||||||
|
};
|
||||||
|
if (li === undefined || li.tagName.toLowerCase() !== "li") {
|
||||||
|
msg = "first element to be a li";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (a === undefined || a.tagName.toLowerCase() !== "a") {
|
||||||
|
msg = "first element to be a a";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (lbl === undefined || lbl.tagName.toLowerCase() !== "label") {
|
||||||
|
msg = "first element to be a label";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
|
@ -71,6 +95,7 @@
|
||||||
shaperUI.addControlOpticShapeNone();
|
shaperUI.addControlOpticShapeNone();
|
||||||
|
|
||||||
expect($("#control_list #control_none").length).toEqual(1);
|
expect($("#control_list #control_none").length).toEqual(1);
|
||||||
|
expect($("#control_list #control_none")[0]).toConformToListCSS();
|
||||||
|
|
||||||
helper.simulateMouseEvent("click", "control_none");
|
helper.simulateMouseEvent("click", "control_none");
|
||||||
|
|
||||||
|
@ -87,7 +112,8 @@
|
||||||
shaperUI.addControlOpticShapeCircle();
|
shaperUI.addControlOpticShapeCircle();
|
||||||
|
|
||||||
expect($("#control_list #control_circle").length).toEqual(1);
|
expect($("#control_list #control_circle").length).toEqual(1);
|
||||||
|
expect($("#control_list #control_circle")[0]).toConformToListCSS();
|
||||||
|
|
||||||
helper.simulateMouseEvent("click", "control_circle");
|
helper.simulateMouseEvent("click", "control_circle");
|
||||||
expect($("#control_circle_modal").length).toEqual(1);
|
expect($("#control_circle_modal").length).toEqual(1);
|
||||||
|
|
||||||
|
@ -113,6 +139,7 @@
|
||||||
shaperUI.addControlOpticShapeRect();
|
shaperUI.addControlOpticShapeRect();
|
||||||
|
|
||||||
expect($("#control_list #control_rect").length).toEqual(1);
|
expect($("#control_list #control_rect").length).toEqual(1);
|
||||||
|
expect($("#control_list #control_rect")[0]).toConformToListCSS();
|
||||||
|
|
||||||
helper.simulateMouseEvent("click", "control_rect");
|
helper.simulateMouseEvent("click", "control_rect");
|
||||||
$("#control_rect_width").attr("value", 42);
|
$("#control_rect_width").attr("value", 42);
|
||||||
|
@ -139,6 +166,7 @@
|
||||||
shaperUI.addControlOpticLabel();
|
shaperUI.addControlOpticLabel();
|
||||||
|
|
||||||
expect($("#control_list #control_label").length).toEqual(1);
|
expect($("#control_list #control_label").length).toEqual(1);
|
||||||
|
expect($("#control_list #control_label")[0]).toConformToListCSS();
|
||||||
|
|
||||||
helper.simulateMouseEvent("click", "control_label");
|
helper.simulateMouseEvent("click", "control_label");
|
||||||
$("#control_label_key").attr("value", "theAnswer");
|
$("#control_label_key").attr("value", "theAnswer");
|
||||||
|
@ -160,6 +188,7 @@
|
||||||
shaperUI.addControlOpticSingleColour();
|
shaperUI.addControlOpticSingleColour();
|
||||||
|
|
||||||
expect($("#control_list #control_singlecolour").length).toEqual(1);
|
expect($("#control_list #control_singlecolour").length).toEqual(1);
|
||||||
|
expect($("#control_list #control_singlecolour")[0]).toConformToListCSS();
|
||||||
|
|
||||||
helper.simulateMouseEvent("click", "control_singlecolour");
|
helper.simulateMouseEvent("click", "control_singlecolour");
|
||||||
$("#control_singlecolour_fill").attr("value", "#123456");
|
$("#control_singlecolour_fill").attr("value", "#123456");
|
||||||
|
@ -186,6 +215,7 @@
|
||||||
shaperUI.addControlOpticAttributeColour();
|
shaperUI.addControlOpticAttributeColour();
|
||||||
|
|
||||||
expect($("#control_list #control_attributecolour").length).toEqual(1);
|
expect($("#control_list #control_attributecolour").length).toEqual(1);
|
||||||
|
expect($("#control_list #control_attributecolour")[0]).toConformToListCSS();
|
||||||
|
|
||||||
helper.simulateMouseEvent("click", "control_attributecolour");
|
helper.simulateMouseEvent("click", "control_attributecolour");
|
||||||
$("#control_attributecolour_key").attr("value", "label");
|
$("#control_attributecolour_key").attr("value", "label");
|
||||||
|
@ -210,6 +240,7 @@
|
||||||
shaperUI.addControlOpticExpandColour();
|
shaperUI.addControlOpticExpandColour();
|
||||||
|
|
||||||
expect($("#control_list #control_expandcolour").length).toEqual(1);
|
expect($("#control_list #control_expandcolour").length).toEqual(1);
|
||||||
|
expect($("#control_list #control_expandcolour")[0]).toConformToListCSS();
|
||||||
|
|
||||||
helper.simulateMouseEvent("click", "control_expandcolour");
|
helper.simulateMouseEvent("click", "control_expandcolour");
|
||||||
$("#control_expandcolour_expanded").attr("value", "#123456");
|
$("#control_expandcolour_expanded").attr("value", "#123456");
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */
|
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */
|
||||||
/*global $, _, d3*/
|
/*global $, _, d3*/
|
||||||
/*global document*/
|
/*global document*/
|
||||||
/*global EdgeShaper, modalDialogHelper*/
|
/*global EdgeShaper, modalDialogHelper, uiComponentsHelper*/
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief Graph functionality
|
/// @brief Graph functionality
|
||||||
///
|
///
|
||||||
|
@ -37,50 +37,39 @@ function EdgeShaperControls(list, shaper) {
|
||||||
if (shaper === undefined) {
|
if (shaper === undefined) {
|
||||||
throw "The EdgeShaper has to be given.";
|
throw "The EdgeShaper has to be given.";
|
||||||
}
|
}
|
||||||
var self = this;
|
var self = this,
|
||||||
|
baseClass = "graph";
|
||||||
|
|
||||||
this.addControlOpticShapeNone = function() {
|
this.addControlOpticShapeNone = function() {
|
||||||
var prefix = "control_none",
|
var prefix = "control_none",
|
||||||
idprefix = prefix + "_",
|
idprefix = prefix + "_";
|
||||||
callback = function() {
|
uiComponentsHelper.createButton(baseClass, list, "None", prefix, function() {
|
||||||
shaper.changeTo({
|
shaper.changeTo({
|
||||||
shape: {
|
shape: {
|
||||||
type: EdgeShaper.shapes.NONE
|
type: EdgeShaper.shapes.NONE
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
});
|
||||||
button = document.createElement("li");
|
|
||||||
button.className = "graph_control " + prefix;
|
|
||||||
button.id = prefix;
|
|
||||||
button.appendChild(document.createTextNode("None"));
|
|
||||||
list.appendChild(button);
|
|
||||||
button.onclick = callback;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addControlOpticShapeArrow = function() {
|
this.addControlOpticShapeArrow = function() {
|
||||||
var prefix = "control_arrow",
|
var prefix = "control_arrow",
|
||||||
idprefix = prefix + "_",
|
idprefix = prefix + "_";
|
||||||
callback = function() {
|
uiComponentsHelper.createButton(baseClass, list, "Arrow", prefix, function() {
|
||||||
shaper.changeTo({
|
shaper.changeTo({
|
||||||
shape: {
|
shape: {
|
||||||
type: EdgeShaper.shapes.ARROW
|
type: EdgeShaper.shapes.ARROW
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
});
|
||||||
button = document.createElement("li");
|
|
||||||
button.className = "graph_control " + prefix;
|
|
||||||
button.id = prefix;
|
|
||||||
button.appendChild(document.createTextNode("Arrow"));
|
|
||||||
list.appendChild(button);
|
|
||||||
button.onclick = callback;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.addControlOpticLabel = function() {
|
this.addControlOpticLabel = function() {
|
||||||
var prefix = "control_label",
|
var prefix = "control_label",
|
||||||
idprefix = prefix + "_",
|
idprefix = prefix + "_";
|
||||||
callback = function() {
|
uiComponentsHelper.createButton(baseClass, list, "Label", prefix, function() {
|
||||||
modalDialogHelper.createModalDialog("Switch Label Attribute",
|
modalDialogHelper.createModalDialog("Switch Label Attribute",
|
||||||
idprefix, [{
|
idprefix, [{
|
||||||
type: "text",
|
type: "text",
|
||||||
|
@ -92,13 +81,7 @@ function EdgeShaperControls(list, shaper) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
});
|
||||||
button = document.createElement("li");
|
|
||||||
button.className = "graph_control " + prefix;
|
|
||||||
button.id = prefix;
|
|
||||||
button.appendChild(document.createTextNode("Label"));
|
|
||||||
list.appendChild(button);
|
|
||||||
button.onclick = callback;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -106,8 +89,8 @@ function EdgeShaperControls(list, shaper) {
|
||||||
|
|
||||||
this.addControlOpticSingleColour = function() {
|
this.addControlOpticSingleColour = function() {
|
||||||
var prefix = "control_singlecolour",
|
var prefix = "control_singlecolour",
|
||||||
idprefix = prefix + "_",
|
idprefix = prefix + "_";
|
||||||
callback = function() {
|
uiComponentsHelper.createButton(baseClass, list, "Single Colour", prefix, function() {
|
||||||
modalDialogHelper.createModalDialog("Switch to Colour",
|
modalDialogHelper.createModalDialog("Switch to Colour",
|
||||||
idprefix, [{
|
idprefix, [{
|
||||||
type: "text",
|
type: "text",
|
||||||
|
@ -122,19 +105,13 @@ function EdgeShaperControls(list, shaper) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
});
|
||||||
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() {
|
this.addControlOpticAttributeColour = function() {
|
||||||
var prefix = "control_attributecolour",
|
var prefix = "control_attributecolour",
|
||||||
idprefix = prefix + "_",
|
idprefix = prefix + "_";
|
||||||
callback = function() {
|
uiComponentsHelper.createButton(baseClass, list, "Colour by Attribute", prefix, function() {
|
||||||
modalDialogHelper.createModalDialog("Display colour by attribute",
|
modalDialogHelper.createModalDialog("Display colour by attribute",
|
||||||
idprefix, [{
|
idprefix, [{
|
||||||
type: "text",
|
type: "text",
|
||||||
|
@ -149,19 +126,13 @@ function EdgeShaperControls(list, shaper) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
});
|
||||||
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() {
|
this.addControlOpticGradientColour = function() {
|
||||||
var prefix = "control_gradientcolour",
|
var prefix = "control_gradientcolour",
|
||||||
idprefix = prefix + "_",
|
idprefix = prefix + "_";
|
||||||
callback = function() {
|
uiComponentsHelper.createButton(baseClass, list, "Gradient Colour", prefix, function() {
|
||||||
modalDialogHelper.createModalDialog("Change colours for gradient",
|
modalDialogHelper.createModalDialog("Change colours for gradient",
|
||||||
idprefix, [{
|
idprefix, [{
|
||||||
type: "text",
|
type: "text",
|
||||||
|
@ -181,13 +152,7 @@ function EdgeShaperControls(list, shaper) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
});
|
||||||
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 () {
|
this.addAllOptics = function () {
|
||||||
|
|
|
@ -57,6 +57,15 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig)
|
||||||
callback
|
callback
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
createIcon = function(icon, title, callback) {
|
||||||
|
uiComponentsHelper.createIconButton(
|
||||||
|
baseClass,
|
||||||
|
list,
|
||||||
|
icon,
|
||||||
|
"control_" + title,
|
||||||
|
callback
|
||||||
|
);
|
||||||
|
},
|
||||||
rebindNodes = function(actions) {
|
rebindNodes = function(actions) {
|
||||||
dispatcher.rebind("nodes", actions);
|
dispatcher.rebind("nodes", actions);
|
||||||
},
|
},
|
||||||
|
@ -75,7 +84,7 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig)
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
createButton("drag", callback);
|
createIcon("move", "drag", callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addControlEdit = function() {
|
this.addControlEdit = function() {
|
||||||
|
@ -109,7 +118,7 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig)
|
||||||
rebindNodes({click: nodeCallback});
|
rebindNodes({click: nodeCallback});
|
||||||
rebindEdges({click: edgeCallback});
|
rebindEdges({click: edgeCallback});
|
||||||
};
|
};
|
||||||
createButton("edit", callback);
|
createIcon("edit", "edit", callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addControlExpand = function() {
|
this.addControlExpand = function() {
|
||||||
|
@ -119,7 +128,7 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig)
|
||||||
rebindNodes({click: dispatcher.events.EXPAND});
|
rebindNodes({click: dispatcher.events.EXPAND});
|
||||||
rebindEdges();
|
rebindEdges();
|
||||||
};
|
};
|
||||||
createButton("expand", callback);
|
createIcon("plus", "expand", callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addControlDelete = function() {
|
this.addControlDelete = function() {
|
||||||
|
@ -133,7 +142,7 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig)
|
||||||
edgeShaper.reshapeEdges();
|
edgeShaper.reshapeEdges();
|
||||||
})});
|
})});
|
||||||
};
|
};
|
||||||
createButton("delete", callback);
|
createIcon("trash", "delete", callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addControlConnect = function() {
|
this.addControlConnect = function() {
|
||||||
|
@ -149,7 +158,7 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig)
|
||||||
});
|
});
|
||||||
rebindEdges();
|
rebindEdges();
|
||||||
};
|
};
|
||||||
createButton("connect", callback);
|
createIcon("resize-horizontal", "connect", callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -43,8 +43,8 @@ function GraphViewerUI(container, adapterConfig) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var graphViewer,
|
var graphViewer,
|
||||||
width = container.offsetWidth, // TODO
|
width = container.offsetWidth - 60,
|
||||||
height = container.offsetHeight, // TODO
|
height = container.offsetHeight,
|
||||||
menubar = document.createElement("ul"),
|
menubar = document.createElement("ul"),
|
||||||
svg,
|
svg,
|
||||||
makeBootstrapDropdown = function (div, id, title) {
|
makeBootstrapDropdown = function (div, id, title) {
|
||||||
|
@ -68,7 +68,9 @@ function GraphViewerUI(container, adapterConfig) {
|
||||||
return d3.select("#" + container.id)
|
return d3.select("#" + container.id)
|
||||||
.append("svg")
|
.append("svg")
|
||||||
.attr("width",width)
|
.attr("width",width)
|
||||||
.attr("height",height);
|
.attr("height",height)
|
||||||
|
.attr("class", "pull-right")
|
||||||
|
.attr("style", "width:" + width + "px");
|
||||||
},
|
},
|
||||||
createToolbox = function() {
|
createToolbox = function() {
|
||||||
var toolbox = document.createElement("div"),
|
var toolbox = document.createElement("div"),
|
||||||
|
@ -80,7 +82,7 @@ function GraphViewerUI(container, adapterConfig) {
|
||||||
graphViewer.dispatcherConfig
|
graphViewer.dispatcherConfig
|
||||||
);
|
);
|
||||||
toolbox.id = "toolbox";
|
toolbox.id = "toolbox";
|
||||||
toolbox.className = "toolbox";
|
toolbox.className = "toolbox pull-left";
|
||||||
container.appendChild(toolbox);
|
container.appendChild(toolbox);
|
||||||
toolbox.appendChild(toollist);
|
toolbox.appendChild(toollist);
|
||||||
dispatcherUI.addAll();
|
dispatcherUI.addAll();
|
||||||
|
|
|
@ -34,10 +34,27 @@ var uiComponentsHelper = uiComponentsHelper || {};
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
uiComponentsHelper.createButton = function(baseclass, list, title, prefix, callback) {
|
uiComponentsHelper.createButton = function(baseclass, list, title, prefix, callback) {
|
||||||
var button = document.createElement("li");
|
var button = document.createElement("li"),
|
||||||
|
a = document.createElement("a"),
|
||||||
|
label = document.createElement("label");
|
||||||
button.className = baseclass + "_control " + prefix;
|
button.className = baseclass + "_control " + prefix;
|
||||||
button.id = prefix;
|
button.id = prefix;
|
||||||
button.appendChild(document.createTextNode(title));
|
button.appendChild(a);
|
||||||
|
a.appendChild(label);
|
||||||
|
label.appendChild(document.createTextNode(title));
|
||||||
|
list.appendChild(button);
|
||||||
|
button.onclick = callback;
|
||||||
|
};
|
||||||
|
|
||||||
|
uiComponentsHelper.createIconButton = function(baseclass, list, icon, prefix, callback) {
|
||||||
|
var button = document.createElement("li"),
|
||||||
|
a = document.createElement("a"),
|
||||||
|
i = document.createElement("i");
|
||||||
|
button.className = baseclass + "_control " + prefix;
|
||||||
|
button.id = prefix;
|
||||||
|
button.appendChild(a);
|
||||||
|
a.appendChild(i);
|
||||||
|
i.className = "icon-" + icon;
|
||||||
list.appendChild(button);
|
list.appendChild(button);
|
||||||
button.onclick = callback;
|
button.onclick = callback;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue