Author: ruwan
Date: Sun Dec  9 21:50:21 2007
New Revision: 10756

Log:

Fixing the issue ESBJAVA-395

Modified:
   
trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/cache_mediator.js
   
trunk/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/cache_edit.xsl
   
trunk/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/cache_view.xsl

Modified: 
trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/cache_mediator.js
==============================================================================
--- 
trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/cache_mediator.js
     (original)
+++ 
trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/cache_mediator.js
     Sun Dec  9 21:50:21 2007
@@ -18,6 +18,18 @@
  * This js file is for the clone mediator specific UI operations
  */
 
+initedit["cache"] = function initcacheedit(mediator) {
+
+    var onchit = mediator.getElementsByTagName("onCacheHit");
+    if (onchit != undefined && onchit.length == 0) {
+        if (mediator.getElementsByTagName("syn:onchit").length == 0) {
+            mediator.appendChild(createesbelement("<syn:onCacheHit 
xmlns:syn='http://ws.apache.org/ns/synapse'/>"));
+        }
+    }
+
+    setnodepositions(internalmodel.sequence);
+}
+
 collectdata["cache"] = function collectcachedata(mediator, validate) {
 
     var cache_id = document.getElementById("cache_id");
@@ -65,10 +77,10 @@
         }
 
         var mediatorChilds = mediator.childNodes;
+        if (mediatorChilds == undefined || mediatorChilds.length == 0) {
+            mediatorChilds = mediator.children;
+        }
         if (mediatorChilds != undefined) {
-            if (mediatorChilds.length == 0) {
-                mediatorChilds = mediator.children;
-            }
             for (var i=0; i<mediatorChilds.length; i++) {
                 if (mediatorChilds[i].localName == "implementation") {
                     mediator.removeChild(mediatorChilds[i]);
@@ -133,7 +145,18 @@
     var value = select.options[select.options.selectedIndex].value;
     var position = geteditingmediatorposition();
     var mediator = getnestedmediator(internalmodel.sequence, position);
-    mediator.setAttribute("_cacheType", value);
+
+    var cache_id = document.getElementById("cache_id");
+    var cache_scope = document.getElementById("cache_scope");
+    if (cache_id != undefined && cache_id.value != undefined && cache_id.value 
!= "") {
+        mediator.setAttribute("id", cache_id.value);
+    }
+
+    if (cache_scope != undefined && cache_scope.options != undefined && 
cache_scope.options.selectedIndex != undefined) {
+        mediator.setAttribute("scope", 
cache_scope.options[cache_scope.options.selectedIndex].value);
+    }
+    
+    mediator.setAttribute("collector", (value == "collector"));
     editmediator(position);
 }
 

Modified: 
trunk/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/cache_edit.xsl
==============================================================================
--- 
trunk/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/cache_edit.xsl
      (original)
+++ 
trunk/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/cache_edit.xsl
      Sun Dec  9 21:50:21 2007
@@ -70,19 +70,19 @@
                     <td>
                         <select id="cacheFlow" onchange="javascript: 
changeCacheType(); return false;" class="esb-edit">
                             <option value="finder">
-                                <xsl:if test="not(@_cacheType) or 
@_cacheType!='collector'">
+                                <xsl:if test="not(@collector) or 
@collector!='true'">
                                 <xsl:attribute 
name="selected">true</xsl:attribute>
                                 </xsl:if>
                                 Finder</option>
                             <option value="collector">
-                                <xsl:if test="@_cacheType='collector'">
+                                <xsl:if test="@collector='true'">
                                 <xsl:attribute 
name="selected">true</xsl:attribute>
                                 </xsl:if>
                                 Collector</option>
                         </select>
                     </td>
                 </tr>
-                <xsl:if test="not(@_cacheType) or @_cacheType!='collector'">
+                <xsl:if test="not(@collector) or @collector!='true'">
                 <tr>
                     <td style="width: 200px;">Hash Generator </td>
                     <td>
@@ -92,28 +92,28 @@
                     </td>
                 </tr>
 
-                <tr>
-                    <td style="width: 200px;">Cache Scope </td>
-                    <td>
-                        <select type="text" id="cache_scope" class="esb-edit">
-                            <xsl:choose>
-                            <xsl:when test="@scope='per-host'">
-                                <option value="per-host" 
selected="true">Per-Host</option>
-                                <option 
value="per-mediator">Per-Mediator</option>
-                            </xsl:when>
-                            <xsl:when test="@scope='per-mediator'">
-                                <option value="per-host">Per-Host</option>
-                                <option value="per-mediator" 
selected="true">Per-Mediator</option>
-                            </xsl:when>
-                                <xsl:otherwise>
-                                    <option value="per-host">Per-Host</option>
-                                    <option 
value="per-mediator">Per-Mediator</option>
-                                </xsl:otherwise>
-
-                            </xsl:choose>
-                        </select>
-                    </td>
-                </tr>
+                <!--<tr>-->
+                    <!--<td style="width: 200px;">Cache Scope </td>-->
+                    <!--<td>-->
+                        <!--<select type="text" id="cache_scope" 
class="esb-edit">-->
+                            <!--<xsl:choose>-->
+                            <!--<xsl:when test="@scope='per-host'">-->
+                                <!--<option value="per-host" 
selected="true">Per-Host</option>-->
+                                <!--<option 
value="per-mediator">Per-Mediator</option>-->
+                            <!--</xsl:when>-->
+                            <!--<xsl:when test="@scope='per-mediator'">-->
+                                <!--<option 
value="per-host">Per-Host</option>-->
+                                <!--<option value="per-mediator" 
selected="true">Per-Mediator</option>-->
+                            <!--</xsl:when>-->
+                                <!--<xsl:otherwise>-->
+                                    <!--<option 
value="per-host">Per-Host</option>-->
+                                    <!--<option 
value="per-mediator">Per-Mediator</option>-->
+                                <!--</xsl:otherwise>-->
+
+                            <!--</xsl:choose>-->
+                        <!--</select>-->
+                    <!--</td>-->
+                <!--</tr>-->
 
                 <tr>
                     <td style="width: 200px;">Cache Timeout </td>
@@ -127,7 +127,7 @@
 
             </tbody>
         </table>
-                <xsl:if test="not(@_cacheType) or @_cacheType!='collector'">
+                <xsl:if test="not(@collector) or @collector!='true'">
 
             <div class="sub-small-title">Cache Implementation Details</div>
             <table border="0" cellpadding="0" cellspacing="0" 
class="data-table">

Modified: 
trunk/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/cache_view.xsl
==============================================================================
--- 
trunk/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/cache_view.xsl
      (original)
+++ 
trunk/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/cache_view.xsl
      Sun Dec  9 21:50:21 2007
@@ -34,24 +34,37 @@
                     <td><xsl:value-of select="@id"/></td>
                 </tr>
 
-                <tr>
-                    <td>Hash Generator </td>
-                    <td><xsl:value-of select="@hashGenerator"/></td>
-                </tr>
 
                 <tr>
                     <td>Cache Scope </td>
                     <td><xsl:value-of select="@scope"/></td>
                 </tr>
+                <xsl:if test="@collector='true'">
+                    <tr>
+                        <td>Cache Type </td>
+                        <td>Collector</td>
+                    </tr>
+                </xsl:if>
 
-                <tr>
-                    <td>Cache Timeout </td>
-                    <td><xsl:value-of select="@timeout"/></td>
-                </tr>
+                <xsl:if test="not(@collector) or @collector!='true'">
+                    <tr>
+                        <td>Cache Type </td>
+                        <td>Finder</td>
+                    </tr>
+                    <tr>
+                        <td>Hash Generator </td>
+                        <td><xsl:value-of select="@hashGenerator"/></td>
+                    </tr>
+                    <tr>
+                        <td>Cache Timeout </td>
+                        <td><xsl:value-of select="@timeout"/></td>
+                    </tr>
+                </xsl:if>
 
             </tbody>
         </table>
 
+            <xsl:if test="not(@collector) or @collector!='true'">
             <div class="sub-small-title">Cache Implementation Details</div>
             <table border="0" cellpadding="0" cellspacing="0" 
class="data-table">
                 <tbody>
@@ -90,6 +103,7 @@
                     </xsl:for-each>
                 </xsl:otherwise>
             </xsl:choose>
+            </xsl:if>
         </div>
 
         <br/>

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

Reply via email to