Author: indika
Date: Thu Dec  6 00:11:34 2007
New Revision: 10602

Log:

fixed ESB-JAVA 389


Modified:
   
trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/endpoints.js

Modified: 
trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/endpoints.js
==============================================================================
--- 
trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/endpoints.js
    (original)
+++ 
trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/endpoints.js
    Thu Dec  6 00:11:34 2007
@@ -42,6 +42,7 @@
 var iscurrentepanonymouse = false;
 var isOnNewPanel = false;
 var save_state = false;
+var deletedChilds = new Array();
 
 function enableendpointstatistics(endpointname) {
 
@@ -342,16 +343,46 @@
     currentIndex.type = type;
     endpointindexs[endpointindexs.length] = currentIndex;
 }
-function removeendpointindex(index) {
+function removeendpointindex(index, pindex) {
     var limit = endpointindexs.length;
     for (var i = 0; i < limit; i++) {
         var current = endpointindexs[i] ;
         if (current != null && current != undefined && 
current.index.toString() == index.toString()) {
             endpointindexs[i] = null;
+            var lim = deletedChilds.length;
+            for (var j = 0; j < lim; j++) {
+                var child = deletedChilds[j];
+                if (child != null && child != undefined && child.id.toString() 
== pindex.toString()) {
+                    var count = child.count;
+                    if (count != undefined && count != null) {
+                        child.count = parseInt(count) + 1;
+                    } else {
+                        child.count = 1;
+                    }
+                    return;
+                }
+            }
+            var parent = new Object();
+            parent.id = pindex;
+            parent.count = 1;
+            deletedChilds[deletedChilds.length] = parent;
         }
     }
-}
 
+}
+function getDeletedChilds(pindex) {
+    var limit = deletedChilds.length;
+    for (var j = 0; j < limit; j++) {
+        var child = deletedChilds[j];
+        if (child != null && child != undefined && child.id.toString() == 
pindex.toString()) {
+            var count = child.count;
+            if (count != undefined && count != null) {
+                return parseInt(count);
+            }
+        }
+    }
+    return 0;
+}
 /**
  * Event handler for the menu items---call this when adding child endpoints
  */
@@ -359,7 +390,8 @@
     save_state = false;
     var menuStr = p_oValue.toString();
     var divstr = "childEndPointsDIV" + currentparentindex;
-    var childcount = 
parseInt(document.getElementById(divstr.toString()).childNodes.length);      
+    var childcount = 
parseInt(document.getElementById(divstr.toString()).childNodes.length);
+    childcount += getDeletedChilds(currentparentindex);
     var index = currentparentindex + "." + childcount;
     var initendpoint = createesbelement("<syn:endpoint 
xmlns:syn='http://ws.apache.org/ns/synapse'/>");
 
@@ -482,6 +514,7 @@
     var divcontrol = document.getElementById("endpointPanel");
     divcontrol.innerHTML = "";
     endpointindexs = new Array();
+    deletedChilds = new Array();
     addendpointindex(index, type);
     var endponitStr = "";
     if (isanonymous == 'true') {
@@ -521,6 +554,7 @@
     currentanonymousfun = null;
     isOnNewPanel = false;
     endpointindexs = new Array();
+    deletedChilds = new Array();
     addendpointindex(index, type);
     var endponitStr = "";
     if (isanonymous == 'true') {
@@ -657,6 +691,7 @@
 function discard() {
     document.getElementById("endpointPanel").innerHTML = "";
     endpointindexs = new Array();
+    deletedChilds = new Array();
     currentparentindex = 0;
     showEndpoints();
 }
@@ -707,6 +742,7 @@
     }
     var topdivstr = "childEndPointsDIV" + endpointindexs[0].index ;
     var topchilds = 
parseInt(document.getElementById(topdivstr.toString()).childNodes.length);
+    topchilds += getDeletedChilds(endpointindexs[0].index);
     for (var i = 0; i < topchilds; i++) {
         var cid = "0." + i  ;
         var ctype = getTypeOfChildWithId(cid)  ;
@@ -770,6 +806,7 @@
         var topChildNodes = topDiv.childNodes;
         if (topChildNodes != null && topChildNodes != undefined) {
             var topchilds = parseInt(topChildNodes.length);
+            topchilds += getDeletedChilds(id);
             for (var i = 0; i < topchilds; i++) {
                 var cid = id + "." + i  ;
                 var ctype = getTypeOfChildWithId(cid)  ;
@@ -835,6 +872,7 @@
         var topChildNodes = topDiv.childNodes;
         if (topChildNodes != null && topChildNodes != undefined) {
             var topchilds = parseInt(topChildNodes.length);
+            topchilds += getDeletedChilds(id);
             for (var i = 0; i < topchilds; i++) {
                 var cid = id + "." + i  ;
                 var ctype = getTypeOfChildWithId(cid)  ;
@@ -2270,7 +2308,7 @@
     if (format_value != null && format_value != undefined && format_value != 
"" && format_value != "Select A Value") {
 
         if (format_value == "POX") {
-            changeoptions("wsAddressingEngaged" +indexstr , false, true);
+            changeoptions("wsAddressingEngaged" + indexstr, false, true);
             changeoptions("wsRMEngaged" + indexstr, false, true);
             changeoptions("wsSecEngaged" + indexstr, false, true);
 
@@ -2284,12 +2322,12 @@
 function deleteChildEndpoint(index) {
     if (index != "0") {
         var parentid = index.substring(0, index.lastIndexOf("."));
-        var parentdiv = document.getElementById("childEndPointsDIV"+parentid);
+        var parentdiv = document.getElementById("childEndPointsDIV" + 
parentid);
         if (parentdiv != undefined && parentdiv != null) {
             var divstr = index + "_div";
             var childDiv = document.getElementById(divstr.toString());
             if (childDiv != null && childDiv != undefined) {
-                removeendpointindex(index);
+                removeendpointindex(index, parentid);
                 parentdiv.removeChild(childDiv);
             }
         }

_______________________________________________
Esb-java-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev

Reply via email to