@ -64,6 +64,8 @@ exports._createManipulatorBar = function() {
this . off ( 'select' , this . boundFunction ) ;
this . off ( 'select' , this . boundFunction ) ;
}
}
var locale = this . constants . locales [ this . constants . locale ] ;
if ( this . edgeBeingEdited !== undefined ) {
if ( this . edgeBeingEdited !== undefined ) {
this . edgeBeingEdited . _disableControlNodes ( ) ;
this . edgeBeingEdited . _disableControlNodes ( ) ;
this . edgeBeingEdited = undefined ;
this . edgeBeingEdited = undefined ;
@ -85,30 +87,31 @@ exports._createManipulatorBar = function() {
while ( this . manipulationDiv . hasChildNodes ( ) ) {
while ( this . manipulationDiv . hasChildNodes ( ) ) {
this . manipulationDiv . removeChild ( this . manipulationDiv . firstChild ) ;
this . manipulationDiv . removeChild ( this . manipulationDiv . firstChild ) ;
}
}
// add the icons to the manipulator div
// add the icons to the manipulator div
this . manipulationDiv . innerHTML = "" +
this . manipulationDiv . innerHTML = "" +
"<span class='network-manipulationUI add' id='network-manipulate-addNode'>" +
"<span class='network-manipulationUI add' id='network-manipulate-addNode'>" +
"<span class='network-manipulationLabel'>" + this . constants . labels [ 'add' ] + "</span></span>" +
"<span class='network-manipulationLabel'>" + locale [ 'add' ] + "</span></span>" +
"<div class='network-seperatorLine'></div>" +
"<div class='network-seperatorLine'></div>" +
"<span class='network-manipulationUI connect' id='network-manipulate-connectNode'>" +
"<span class='network-manipulationUI connect' id='network-manipulate-connectNode'>" +
"<span class='network-manipulationLabel'>" + this . constants . labels [ 'link' ] + "</span></span>" ;
"<span class='network-manipulationLabel'>" + locale [ 'link' ] + "</span></span>" ;
if ( this . _getSelectedNodeCount ( ) == 1 && this . triggerFunctions . edit ) {
if ( this . _getSelectedNodeCount ( ) == 1 && this . triggerFunctions . edit ) {
this . manipulationDiv . innerHTML += "" +
this . manipulationDiv . innerHTML += "" +
"<div class='network-seperatorLine'></div>" +
"<div class='network-seperatorLine'></div>" +
"<span class='network-manipulationUI edit' id='network-manipulate-editNode'>" +
"<span class='network-manipulationUI edit' id='network-manipulate-editNode'>" +
"<span class='network-manipulationLabel'>" + this . constants . labels [ 'editNode' ] + "</span></span>" ;
"<span class='network-manipulationLabel'>" + locale [ 'editNode' ] + "</span></span>" ;
}
}
else if ( this . _getSelectedEdgeCount ( ) == 1 && this . _getSelectedNodeCount ( ) == 0 ) {
else if ( this . _getSelectedEdgeCount ( ) == 1 && this . _getSelectedNodeCount ( ) == 0 ) {
this . manipulationDiv . innerHTML += "" +
this . manipulationDiv . innerHTML += "" +
"<div class='network-seperatorLine'></div>" +
"<div class='network-seperatorLine'></div>" +
"<span class='network-manipulationUI edit' id='network-manipulate-editEdge'>" +
"<span class='network-manipulationUI edit' id='network-manipulate-editEdge'>" +
"<span class='network-manipulationLabel'>" + this . constants . labels [ 'editEdge' ] + "</span></span>" ;
"<span class='network-manipulationLabel'>" + locale [ 'editEdge' ] + "</span></span>" ;
}
}
if ( this . _selectionIsEmpty ( ) == false ) {
if ( this . _selectionIsEmpty ( ) == false ) {
this . manipulationDiv . innerHTML += "" +
this . manipulationDiv . innerHTML += "" +
"<div class='network-seperatorLine'></div>" +
"<div class='network-seperatorLine'></div>" +
"<span class='network-manipulationUI delete' id='network-manipulate-delete'>" +
"<span class='network-manipulationUI delete' id='network-manipulate-delete'>" +
"<span class='network-manipulationLabel'>" + this . constants . labels [ 'del' ] + "</span></span>" ;
"<span class='network-manipulationLabel'>" + locale [ 'del' ] + "</span></span>" ;
}
}
@ -138,7 +141,7 @@ exports._createManipulatorBar = function() {
else {
else {
this . editModeDiv . innerHTML = "" +
this . editModeDiv . innerHTML = "" +
"<span class='network-manipulationUI edit editmode' id='network-manipulate-editModeButton'>" +
"<span class='network-manipulationUI edit editmode' id='network-manipulate-editModeButton'>" +
"<span class='network-manipulationLabel'>" + this . constants . labels [ 'edit' ] + "</span></span>" ;
"<span class='network-manipulationLabel'>" + locale [ 'edit' ] + "</span></span>" ;
var editModeButton = document . getElementById ( "network-manipulate-editModeButton" ) ;
var editModeButton = document . getElementById ( "network-manipulate-editModeButton" ) ;
editModeButton . onclick = this . _toggleEditMode . bind ( this ) ;
editModeButton . onclick = this . _toggleEditMode . bind ( this ) ;
}
}
@ -158,13 +161,15 @@ exports._createAddNodeToolbar = function() {
this . off ( 'select' , this . boundFunction ) ;
this . off ( 'select' , this . boundFunction ) ;
}
}
var locale = this . constants . locales [ this . constants . locale ] ;
// create the toolbar contents
// create the toolbar contents
this . manipulationDiv . innerHTML = "" +
this . manipulationDiv . innerHTML = "" +
"<span class='network-manipulationUI back' id='network-manipulate-back'>" +
"<span class='network-manipulationUI back' id='network-manipulate-back'>" +
"<span class='network-manipulationLabel'>" + this . constants . labels [ 'back' ] + " </span></span>" +
"<span class='network-manipulationLabel'>" + locale [ 'back' ] + " </span></span>" +
"<div class='network-seperatorLine'></div>" +
"<div class='network-seperatorLine'></div>" +
"<span class='network-manipulationUI none' id='network-manipulate-back'>" +
"<span class='network-manipulationUI none' id='network-manipulate-back'>" +
"<span id='network-manipulatorLabel' class='network-manipulationLabel'>" + this . constants . labels [ 'addDescription' ] + "</span></span>" ;
"<span id='network-manipulatorLabel' class='network-manipulationLabel'>" + locale [ 'addDescription' ] + "</span></span>" ;
// bind the icon
// bind the icon
var backButton = document . getElementById ( "network-manipulate-back" ) ;
var backButton = document . getElementById ( "network-manipulate-back" ) ;
@ -187,6 +192,8 @@ exports._createAddEdgeToolbar = function() {
this . _unselectAll ( true ) ;
this . _unselectAll ( true ) ;
this . freezeSimulation = true ;
this . freezeSimulation = true ;
var locale = this . constants . locales [ this . constants . locale ] ;
if ( this . boundFunction ) {
if ( this . boundFunction ) {
this . off ( 'select' , this . boundFunction ) ;
this . off ( 'select' , this . boundFunction ) ;
}
}
@ -197,10 +204,10 @@ exports._createAddEdgeToolbar = function() {
this . manipulationDiv . innerHTML = "" +
this . manipulationDiv . innerHTML = "" +
"<span class='network-manipulationUI back' id='network-manipulate-back'>" +
"<span class='network-manipulationUI back' id='network-manipulate-back'>" +
"<span class='network-manipulationLabel'>" + this . constants . labels [ 'back' ] + " </span></span>" +
"<span class='network-manipulationLabel'>" + locale [ 'back' ] + " </span></span>" +
"<div class='network-seperatorLine'></div>" +
"<div class='network-seperatorLine'></div>" +
"<span class='network-manipulationUI none' id='network-manipulate-back'>" +
"<span class='network-manipulationUI none' id='network-manipulate-back'>" +
"<span id='network-manipulatorLabel' class='network-manipulationLabel'>" + this . constants . labels [ 'linkDescription' ] + "</span></span>" ;
"<span id='network-manipulatorLabel' class='network-manipulationLabel'>" + locale [ 'linkDescription' ] + "</span></span>" ;
// bind the icon
// bind the icon
var backButton = document . getElementById ( "network-manipulate-back" ) ;
var backButton = document . getElementById ( "network-manipulate-back" ) ;
@ -237,12 +244,14 @@ exports._createEditEdgeToolbar = function() {
this . edgeBeingEdited = this . _getSelectedEdge ( ) ;
this . edgeBeingEdited = this . _getSelectedEdge ( ) ;
this . edgeBeingEdited . _enableControlNodes ( ) ;
this . edgeBeingEdited . _enableControlNodes ( ) ;
var locale = this . constants . locales [ this . constants . locale ] ;
this . manipulationDiv . innerHTML = "" +
this . manipulationDiv . innerHTML = "" +
"<span class='network-manipulationUI back' id='network-manipulate-back'>" +
"<span class='network-manipulationUI back' id='network-manipulate-back'>" +
"<span class='network-manipulationLabel'>" + this . constants . labels [ 'back' ] + " </span></span>" +
"<span class='network-manipulationLabel'>" + locale [ 'back' ] + " </span></span>" +
"<div class='network-seperatorLine'></div>" +
"<div class='network-seperatorLine'></div>" +
"<span class='network-manipulationUI none' id='network-manipulate-back'>" +
"<span class='network-manipulationUI none' id='network-manipulate-back'>" +
"<span id='network-manipulatorLabel' class='network-manipulationLabel'>" + this . constants . labels [ 'editEdgeDescription' ] + "</span></span>" ;
"<span id='network-manipulatorLabel' class='network-manipulationLabel'>" + locale [ 'editEdgeDescription' ] + "</span></span>" ;
// bind the icon
// bind the icon
var backButton = document . getElementById ( "network-manipulate-back" ) ;
var backButton = document . getElementById ( "network-manipulate-back" ) ;
@ -328,9 +337,10 @@ exports._releaseControlNode = function(pointer) {
exports . _handleConnect = function ( pointer ) {
exports . _handleConnect = function ( pointer ) {
if ( this . _getSelectedNodeCount ( ) == 0 ) {
if ( this . _getSelectedNodeCount ( ) == 0 ) {
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 ( this . constants . labels [ "createEdgeError " ] )
alert ( this . constants . locales [ this . constants . locale ] [ 'createEdgeError ' ] )
}
}
else {
else {
this . _selectObject ( node , false ) ;
this . _selectObject ( node , false ) ;
@ -386,7 +396,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 ( this . constants . labels [ "createEdgeError" ] )
alert ( this . constants . locales [ this . constants . locale ] [ "createEdgeError" ] )
}
}
else {
else {
this . _createEdge ( connectFromId , node . id ) ;
this . _createEdge ( connectFromId , node . id ) ;
@ -416,7 +426,7 @@ exports._addNode = function() {
} ) ;
} ) ;
}
}
else {
else {
throw new Error ( this . constants . labels [ 'addError' ] ) ;
throw new Error ( 'The function for add does not support two arguments (data,callback)' ) ;
this . _createManipulatorBar ( ) ;
this . _createManipulatorBar ( ) ;
this . moving = true ;
this . moving = true ;
this . start ( ) ;
this . start ( ) ;
@ -450,7 +460,7 @@ exports._createEdge = function(sourceNodeId,targetNodeId) {
} ) ;
} ) ;
}
}
else {
else {
throw new Error ( this . constants . labels [ "linkError" ] ) ;
throw new Error ( 'The function for connect does not support two arguments (data,callback)' ) ;
this . moving = true ;
this . moving = true ;
this . start ( ) ;
this . start ( ) ;
}
}
@ -481,7 +491,7 @@ exports._editEdge = function(sourceNodeId,targetNodeId) {
} ) ;
} ) ;
}
}
else {
else {
throw new Error ( this . constants . labels [ "linkError" ] ) ;
throw new Error ( 'The function for edit does not support two arguments (data, callback)' ) ;
this . moving = true ;
this . moving = true ;
this . start ( ) ;
this . start ( ) ;
}
}
@ -524,11 +534,11 @@ exports._editNode = function() {
} ) ;
} ) ;
}
}
else {
else {
throw new Error ( this . constants . labels [ "editError" ] ) ;
throw new Error ( 'The function for edit does not support two arguments (data, callback)' ) ;
}
}
}
}
else {
else {
throw new Error ( this . constants . labels [ "editBoundError" ] ) ;
throw new Error ( 'No edit function has been bound to this button' ) ;
}
}
} ;
} ;
@ -558,7 +568,7 @@ exports._deleteSelected = function() {
} ) ;
} ) ;
}
}
else {
else {
throw new Error ( this . constants . labels [ "deleteError" ] )
throw new Error ( 'The function for delete does not support two arguments (data, callback)' )
}
}
}
}
else {
else {
@ -570,7 +580,7 @@ exports._deleteSelected = function() {
}
}
}
}
else {
else {
alert ( this . constants . labels [ "deleteClusterError" ] ) ;
alert ( this . constants . locales [ this . constants . locale ] [ "deleteClusterError" ] ) ;
}
}
}
}
} ;
} ;