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).", editError:"The function for edit does not support two arguments (data, callback).",
editBoundError:"No edit function has been bound to this button.", editBoundError:"No edit function has been bound to this button.",
deleteError:"The function for delete does not support two arguments (data, callback).", deleteError:"The function for delete does not support two arguments (data, callback).",
createEdgeError:"Cannot link edges to a cluster.",
deleteClusterError:"Clusters cannot be deleted." deleteClusterError:"Clusters cannot be deleted."
}, },
tooltip: { 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 the user defined some levels but not all, alert and run without hierarchical layout
if (undefinedLevel == true && definedLevel == true) { 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); this.zoomExtent(true,this.constants.clustering.enabled);
if (!this.constants.clustering.enabled) { if (!this.constants.clustering.enabled) {
this.start(); this.start();

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

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

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

@ -14,7 +14,9 @@ exports['en'] = {
back: 'Back', back: 'Back',
addDescription: 'Click in an empty space to place a new node.', 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.', 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_EN'] = exports['en'];
exports['en_US'] = exports['en']; exports['en_US'] = exports['en'];
@ -35,7 +37,9 @@ exports['nl'] = {
back: 'Terug', back: 'Terug',
addDescription: 'Klik op een leeg gebied om een nieuwe node te maken.', 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.', 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_NL'] = exports['nl'];
exports['nl_BE'] = exports['nl']; exports['nl_BE'] = exports['nl'];

Loading…
Cancel
Save