Browse Source

Replaced most alert(...) with throw new Error(...). Added two more entries to labels

v3_develop
jos 10 years ago
parent
commit
db4c138810
4 changed files with 16 additions and 11 deletions
  1. +1
    -0
      lib/network/Network.js
  2. +1
    -1
      lib/network/mixins/HierarchicalLayoutMixin.js
  3. +8
    -8
      lib/network/mixins/ManipulationMixin.js
  4. +6
    -2
      lib/timeline/locales.js

+ 1
- 0
lib/network/Network.js View File

@ -204,6 +204,7 @@ function Network (container, data, options) {
editError:"The function for edit does not support two arguments (data, callback).",
editBoundError:"No edit function has been bound to this button.",
deleteError:"The function for delete does not support two arguments (data, callback).",
createEdgeError:"Cannot link edges to a cluster.",
deleteClusterError:"Clusters cannot be deleted."
},
tooltip: {

+ 1
- 1
lib/network/mixins/HierarchicalLayoutMixin.js View File

@ -57,7 +57,7 @@ exports._setupHierarchicalLayout = function() {
// if the user defined some levels but not all, alert and run without hierarchical layout
if (undefinedLevel == true && definedLevel == true) {
alert("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");
throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");
this.zoomExtent(true,this.constants.clustering.enabled);
if (!this.constants.clustering.enabled) {
this.start();

+ 8
- 8
lib/network/mixins/ManipulationMixin.js View File

@ -330,7 +330,7 @@ exports._handleConnect = function(pointer) {
var node = this._getNodeAt(pointer);
if (node != null) {
if (node.clusterSize > 1) {
alert("Cannot create edges to a cluster.")
alert(this.constants.labels["createEdgeError"])
}
else {
this._selectObject(node,false);
@ -386,7 +386,7 @@ exports._finishConnect = function(pointer) {
var node = this._getNodeAt(pointer);
if (node != null) {
if (node.clusterSize > 1) {
alert("Cannot create edges to a cluster.")
alert(this.constants.labels["createEdgeError"])
}
else {
this._createEdge(connectFromId,node.id);
@ -416,7 +416,7 @@ exports._addNode = function() {
});
}
else {
alert(this.constants.labels['addError']);
throw new Error(this.constants.labels['addError']);
this._createManipulatorBar();
this.moving = true;
this.start();
@ -450,7 +450,7 @@ exports._createEdge = function(sourceNodeId,targetNodeId) {
});
}
else {
alert(this.constants.labels["linkError"]);
throw new Error(this.constants.labels["linkError"]);
this.moving = true;
this.start();
}
@ -481,7 +481,7 @@ exports._editEdge = function(sourceNodeId,targetNodeId) {
});
}
else {
alert(this.constants.labels["linkError"]);
throw new Error(this.constants.labels["linkError"]);
this.moving = true;
this.start();
}
@ -524,11 +524,11 @@ exports._editNode = function() {
});
}
else {
alert(this.constants.labels["editError"]);
throw new Error(this.constants.labels["editError"]);
}
}
else {
alert(this.constants.labels["editBoundError"]);
throw new Error(this.constants.labels["editBoundError"]);
}
};
@ -558,7 +558,7 @@ exports._deleteSelected = function() {
});
}
else {
alert(this.constants.labels["deleteError"])
throw new Error(this.constants.labels["deleteError"])
}
}
else {

+ 6
- 2
lib/timeline/locales.js View File

@ -14,7 +14,9 @@ exports['en'] = {
back: 'Back',
addDescription: 'Click in an empty space to place a new node.',
linkDescription: 'Click on a node and drag the edge to another node to connect them.',
editEdgeDescription: 'Click on the control points and drag them to a node to connect to it.'
editEdgeDescription: 'Click on the control points and drag them to a node to connect to it.',
createEdgeError:"Cannot link edges to a cluster.",
deleteClusterError:"Clusters cannot be deleted."
};
exports['en_EN'] = exports['en'];
exports['en_US'] = exports['en'];
@ -35,7 +37,9 @@ exports['nl'] = {
back: 'Terug',
addDescription: 'Klik op een leeg gebied om een nieuwe node te maken.',
linkDescription: 'Klik op een node en sleep de link naar een andere node om ze te verbinden.',
editEdgeDescription: 'Klik op de verbindingspunten en sleep ze naar een node om daarmee te verbinden.'
editEdgeDescription: 'Klik op de verbindingspunten en sleep ze naar een node om daarmee te verbinden.',
createEdgeError:"Cannot link edges to a cluster.",
deleteClusterError:"Clusters cannot be deleted."
};
exports['nl_NL'] = exports['nl'];
exports['nl_BE'] = exports['nl'];

Loading…
Cancel
Save