Author: ruwan
Date: Mon Jan 21 00:15:11 2008
New Revision: 12570
Log:
Fixing all the issues with POJOCommand UI
Modified:
branches/esb/java/1.6/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/pojoCommand_mediator.js
branches/esb/java/1.6/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/pojoCommand_edit.xsl
branches/esb/java/1.6/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/pojoCommand_view.xsl
Modified:
branches/esb/java/1.6/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/pojoCommand_mediator.js
==============================================================================
---
branches/esb/java/1.6/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/pojoCommand_mediator.js
(original)
+++
branches/esb/java/1.6/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/pojoCommand_mediator.js
Mon Jan 21 00:15:11 2008
@@ -34,7 +34,7 @@
if (browsername.indexOf(IE_BROWSER_NAME) != -1) {
prefix = "syn:";
}
- // todo: need to check on IE possible IE issue
+
var existingprops = mediator.getElementsByTagName(prefix + "property");
while (existingprops.length > 0) {
var attrs = existingprops[0].attributes;
@@ -55,18 +55,91 @@
for (var i = 0; i < propertyNamess.length; i++) {
var propName_shown = propertyNamess[i].getAttribute("value");
var propName_real = propName_shown.charAt(0).toLowerCase() +
propName_shown.substring(1, propName_shown.length);
- var propValue_real = document.getElementById("command_med_prop" +
propName_real);
- var propType_real = document.getElementsByName("prop_type_" +
propName_real)[0].value;
+ var propReadValue_real =
document.getElementById("command_med_prop_read" + propName_real);
+ var propReadType_real = document.getElementsByName("prop_type_read_" +
propName_real)[0].value; // todo: check 0
+ var propUpdateValue_real =
document.getElementById("command_med_prop_update" + propName_real);
+ var propUpdateType_real =
document.getElementsByName("prop_type_update_" + propName_real)[0].value;
+ var read_value, update_value;
+ if (propReadValue_real != null) {
+ read_value = propReadValue_real.value;
+ } else {
+ read_value = "";
+ }
+
+ if (propUpdateValue_real != null) {
+ update_value = propUpdateValue_real.value;
+ } else {
+ update_value = "";
+ }
// alert(propValue_real.value)
- if (validate || (propValue_real != null && propValue_real.value !=
"")) {
+ if (propReadType_real != "none" || propUpdateType_real != "none") {
// var propchild = getsynproperty();
// alert(propValue_real)
var propchild = createesbelement("<syn:property
xmlns:syn='http://ws.apache.org/ns/synapse'/>");
propchild.setAttribute("name", propName_real);
- if (propType_real == "value") {
- propchild.setAttribute("value", propValue_real.value);
- } else if (propType_real == "expression") {
- propchild.setAttribute("expression", propValue_real.value);
+ var propchild2 = null;
+ if (propReadType_real == "value" && propUpdateType_real ==
"message") {
+ // ReadValueUpdateMessage
+ propchild.setAttribute("value", read_value);
+ propchild.setAttribute("expression", update_value);
+ } else if (propReadType_real == "value" && propUpdateType_real ==
"context") {
+ // ReadValueUpdateContext
+ propchild.setAttribute("value", read_value);
+ propchild.setAttribute("context-name", update_value);
+ } else if (propReadType_real == "value" && propUpdateType_real ==
"none") {
+ // ReadValue
+ propchild.setAttribute("value", read_value);
+ } else if (propReadType_real == "message" && propUpdateType_real
== "message") {
+ propchild.setAttribute("expression", read_value);
+ if (read_value == update_value) {
+ // ReadAndUpdateMessage
+ propchild.setAttribute("action", "ReadAndUpdateMessage")
+ } else {
+ // ReadMessage + UpdateMessage
+ propchild.setAttribute("action", "ReadMessage");
+ propchild2 = createesbelement("<syn:property
xmlns:syn='http://ws.apache.org/ns/synapse'/>");
+ propchild2.setAttribute("name", propName_real);
+ propchild2.setAttribute("expression", update_value);
+ propchild2.setAttribute("action", "UpdateMessage");
+ }
+ } else if (propReadType_real == "message" && propUpdateType_real
== "context") {
+ // ReadMessageAndUpdateContext
+ propchild.setAttribute("expression", read_value);
+ propchild.setAttribute("context-name", update_value);
+ propchild.setAttribute("action", "ReadMessage");
+ } else if (propReadType_real == "message" && propUpdateType_real
== "none") {
+ // ReadMessage
+ propchild.setAttribute("expression", read_value);
+ propchild.setAttribute("action", "ReadMessage");
+ } else if (propReadType_real == "context" && propUpdateType_real
== "message") {
+ // ReadContextAndUpdateMessage
+ propchild.setAttribute("context-name", read_value);
+ propchild.setAttribute("expression", update_value);
+ propchild.setAttribute("action", "ReadContext");
+ } else if (propReadType_real == "context" && propUpdateType_real
== "context") {
+ propchild.setAttribute("context-name", read_value);
+ if (read_value == update_value) {
+ // ReadAndUpdateContext
+ propchild.setAttribute("action", "ReadAndUpdateContext")
+ } else {
+ // ReadContext + UpdateContext
+ propchild.setAttribute("action", "ReadContext");
+ propchild2 = createesbelement("<syn:property
xmlns:syn='http://ws.apache.org/ns/synapse'/>");
+ propchild2.setAttribute("name", propName_real);
+ propchild2.setAttribute("context-name", update_value);
+ propchild2.setAttribute("action", "UpdateContext");
+ }
+ } else if (propReadType_real == "context" && propUpdateType_real
== "none") {
+ // ReadContext
+ propchild.setAttribute("context-name", read_value);
+ propchild.setAttribute("action", "ReadContext");
+ } else if (propReadType_real == "none" && propUpdateType_real ==
"message") {
+ // UpdateMessage
+ propchild.setAttribute("expression", update_value);
+ propchild.setAttribute("action", "UpdateMessage")
+ } else if (propReadType_real == "none" && propUpdateType_real ==
"context") {
+ propchild.setAttribute("context-name", update_value);
+ propchild.setAttribute("action", "UpdateContext")
}
var attaching_ns = namespaces[propName_real];
if (attaching_ns != undefined) {
@@ -75,10 +148,16 @@
var nsparts = splitted_ns[j].split("###");
if (nsparts.length == 2) {
propchild.setAttribute("xmlns:" + nsparts[0],
nsparts[1]);
+ if (propchild2 != null) {
+ propchild2.setAttribute("xmlns:" + nsparts[0],
nsparts[1]);
+ }
}
}
}
mediator.appendChild(propchild);
+ if (propchild2 != null) {
+ mediator.appendChild(propchild2);
+ }
}
}
// alert((new XMLSerializer()).serializeToString(mediator))
@@ -160,6 +239,13 @@
processXML(mediator, "mediators/pojoCommand_edit.xsl",
document.getElementById("command_edit_div"))
}
+function reloadChanges() {
+ var position = geteditingmediatorposition();
+ var mediator = getnestedmediator(internalmodel.sequence, position);
+ collectdata["pojoCommand"](mediator);
+ editmediator(position);
+}
+
function removecommandmedprop(propname) {
// editing mediator position in the internal model
Modified:
branches/esb/java/1.6/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/pojoCommand_edit.xsl
==============================================================================
---
branches/esb/java/1.6/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/pojoCommand_edit.xsl
(original)
+++
branches/esb/java/1.6/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/pojoCommand_edit.xsl
Mon Jan 21 00:15:11 2008
@@ -61,17 +61,17 @@
<p>Properties defined for POJOCommand mediator</p>
<br/>
<div id="common_table_content">
- <table border="0" cellpadding="0" cellspacing="0" width="600">
+ <table border="0" cellpadding="0" cellspacing="0" width="1000">
<tr>
<th>Property Name</th>
- <th>Property Type</th>
- <th>Value / Expression</th>
- <th></th>
+ <th>Read Info</th>
+ <th>Update Info</th>
+ <th>Actions</th>
</tr>
<xsl:for-each select="syn:property">
<tr>
<xsl:attribute name="name">syn-property</xsl:attribute>
- <td>
+ <td rowspan="2">
<input type="text" name="property_name"
class="esb-edit small_textbox" disabled="true">
<xsl:attribute name="value">
<xsl:value-of
select="concat(translate(substring(@name,1,1),
@@ -81,79 +81,146 @@
</input>
</td>
- <xsl:if test="@value">
- <td>
- <select class="esb-edit small_textbox">
- <xsl:attribute name="id"><xsl:value-of
select="concat('propertyType',@esb_med_pos)"/></xsl:attribute>
- <xsl:attribute name="name"><xsl:value-of
select="concat('prop_type_', @name)"/></xsl:attribute>
- <xsl:attribute name="onchange">
-
javascript:showNamespaceButtonForProperties('<xsl:value-of
select="@esb_med_pos"/>','propertyType','namespaceCell');;
- </xsl:attribute>
- <option value="value"
selected="true">Value</option>
- <option
value="expression">Expression</option>
- </select>
- </td>
- <td>
- <input type="text" class="esb-edit
small_textbox">
+ <!--<xsl:if test="@value">-->
+ <!--<td>-->
+ <!--<select class="esb-edit small_textbox">-->
+ <!--<xsl:attribute name="id"><xsl:value-of
select="concat('propertyType',@esb_med_pos)"/></xsl:attribute>-->
+ <!--<xsl:attribute
name="name"><xsl:value-of select="concat('prop_type_',
@name)"/></xsl:attribute>-->
+ <!--<xsl:attribute name="onchange">-->
+
<!--javascript:showNamespaceButtonForProperties('<xsl:value-of
select="@esb_med_pos"/>','propertyType','namespaceCell');;-->
+ <!--</xsl:attribute>-->
+ <!--<option value="value"
selected="true">Value</option>-->
+ <!--<option
value="expression">Expression</option>-->
+ <!--</select>-->
+ <!--</td>-->
+ <!--<td>-->
+ <!--<input type="text" class="esb-edit
small_textbox">-->
+ <!--<xsl:attribute name="id">-->
+ <!--<xsl:value-of
select="concat('command_med_prop', @name)"/>-->
+ <!--</xsl:attribute>-->
+ <!--<xsl:attribute
name="value"><xsl:value-of select="@value"/></xsl:attribute>-->
+ <!--</input>-->
+ <!--</td>-->
+ <!--<td>-->
+ <!--<xsl:attribute name="id"><xsl:value-of
select="concat('namespaceCell',@esb_med_pos)"/></xsl:attribute>-->
+ <!--</td>-->
+ <!--</xsl:if>-->
+
+
+
+
+
+
+ <td>From:
+ <select class="esb-edit small_textbox">
+ <xsl:attribute name="id"><xsl:value-of
select="concat('propertyReadType',@esb_med_pos)"/></xsl:attribute>
+ <xsl:attribute name="name"><xsl:value-of
select="concat('prop_type_read_', @name)"/></xsl:attribute>
+ <xsl:attribute name="onchange">
+ javascript:reloadChanges();return false;
+ </xsl:attribute>
+ <option value="none">- NONE -</option>
+ <option value="value">
+ <xsl:if test="@value">
+ <xsl:attribute
name="selected">true</xsl:attribute>
+ </xsl:if>
+ Value
+ </option>
+ <option value="message">
+ <xsl:if test="not(@value) and
@action!='UpdateMessage' and @expression">
+ <xsl:attribute
name="selected">true</xsl:attribute>
+ </xsl:if>
+ Message
+ </option>
+ <option value="context">
+ <xsl:if test="not(@value) and
@action!='UpdateContext' and @context-name">
+ <xsl:attribute
name="selected">true</xsl:attribute>
+ </xsl:if>
+ Context
+ </option>
+ </select>
+ </td>
+ <td>To:
+ <select class="esb-edit small_textbox">
+ <xsl:attribute name="id"><xsl:value-of
select="concat('propertyUpdateType',@esb_med_pos)"/></xsl:attribute>
+ <xsl:attribute name="name"><xsl:value-of
select="concat('prop_type_update_', @name)"/></xsl:attribute>
+ <xsl:attribute name="onchange">
+ javascript:reloadChanges();return false;
+ </xsl:attribute>
+ <option value="none">- NONE -</option>
+ <option value="message">
+ <xsl:if test="(@action!='ReadMessage' and
@expression) or (@value and @expression)">
+ <xsl:attribute
name="selected">true</xsl:attribute>
+ </xsl:if>
+ Message
+ </option>
+ <option value="context">
+ <xsl:if test="(@action!='ReadContext' and
@context-name) or (@value and @context-name)">
+ <xsl:attribute
name="selected">true</xsl:attribute>
+ </xsl:if>
+ Context
+ </option>
+ </select>
+ </td>
+ <td rowspan="2"><a href="#" id="delete_link">
+ <xsl:attribute
name="onclick">javascript: removecommandmedprop('<xsl:value-of
select="@name"/>'); return
false;</xsl:attribute>    </a></td>
+ </tr><tr>
+ <td>
+ <xsl:if test="@value">Value:
+ <input class="esb-edit small_textbox"
type="text">
<xsl:attribute name="id">
- <xsl:value-of
select="concat('command_med_prop', @name)"/>
+ <xsl:value-of
select="concat('command_med_prop_read', @name)"/>
+ </xsl:attribute>
+ <xsl:attribute name="value">
+ <xsl:value-of select="@value"/>
</xsl:attribute>
- <xsl:attribute name="value"><xsl:value-of
select="@value"/></xsl:attribute>
</input>
- </td>
- <td>
- <xsl:attribute name="id"><xsl:value-of
select="concat('namespaceCell',@esb_med_pos)"/></xsl:attribute>
- </td>
- </xsl:if>
-
- <xsl:if test="@expression">
- <td id="property_value">
- <select class="esb-edit small_textbox">
- <xsl:attribute name="id"><xsl:value-of
select="concat('propertyType',@esb_med_pos)"/></xsl:attribute>
- <xsl:attribute name="name"><xsl:value-of
select="concat('prop_type_', @name)"/></xsl:attribute>
- <xsl:attribute name="onchange">
-
javascript:showNamespaceButtonForProperties('<xsl:value-of
select="@esb_med_pos"/>','propertyType','namespaceCell');;
- </xsl:attribute>
- <option value="value">Value</option>
- <option value="expression"
selected="true">Expression</option>
- </select>
- </td>
- <td>
- <input type="text" class="esb-edit
small_textbox">
+ </xsl:if>
+ <xsl:if test="not(@value) and @expression and
(@action='ReadMessage' or @action='UpdateContext' or
@action='ReadAndUpdateMessage')">Expression:
+ <input class="esb-edit small_textbox"
type="text">
<xsl:attribute name="id">
- <xsl:value-of
select="concat('command_med_prop', @name)"/>
+ <xsl:value-of
select="concat('command_med_prop_read', @name)"/>
+ </xsl:attribute>
+ <xsl:attribute name="value">
+ <xsl:value-of select="@expression"/>
</xsl:attribute>
- <xsl:attribute name="value"><xsl:value-of
select="@expression"/></xsl:attribute>
</input>
- </td>
- <td>
- <xsl:attribute name="id"><xsl:value-of
select="concat('namespaceCell',@esb_med_pos)"/></xsl:attribute>
- <a title="Namespace Editor" class="ns_editor">
- <xsl:attribute name="onclick">
-
javascript:showNameSpaceEditor('<xsl:value-of select="@esb_med_pos"/>','','');
- </xsl:attribute>
-
<xsl:text>    </xsl:text>
- </a>
- </td>
- </xsl:if>
-
-
+ </xsl:if>
+ <xsl:if test="not(@value) and @context-name and
(@action='ReadContext' or @action='UpdateMessage' or
@action='ReadAndUpdateContext')">Context name:
+ <input class="esb-edit small_textbox"
type="text">
+ <xsl:attribute name="id">
+ <xsl:value-of
select="concat('command_med_prop_read', @name)"/>
+ </xsl:attribute>
+ <xsl:attribute name="value">
+ <xsl:value-of select="@context-name"/>
+ </xsl:attribute>
+ </input>
+ </xsl:if>
+ </td>
+ <td>
+ <xsl:if test="(@expression and
(@action='UpdateMessage' or @action='ReadContext' or
@action='ReadAndUpdateMessage')) or (@value and @expression)">Expression:
+ <input class="esb-edit small_textbox"
type="text">
+ <xsl:attribute name="id">
+ <xsl:value-of
select="concat('command_med_prop_update', @name)"/>
+ </xsl:attribute>
+ <xsl:attribute name="value">
+ <xsl:value-of select="@expression"/>
+ </xsl:attribute>
+ </input>
+ </xsl:if>
+ <xsl:if test="(@context-name and
(@action='UpdateContext' or @action='ReadMessage' or
@action='ReadAndUpdateContext')) or (@value and @context-name)">Context name:
+ <input class="esb-edit small_textbox"
type="text">
+ <xsl:attribute name="id">
+ <xsl:value-of
select="concat('command_med_prop_update', @name)"/>
+ </xsl:attribute>
+ <xsl:attribute name="value">
+ <xsl:value-of select="@context-name"/>
+ </xsl:attribute>
+ </input>
+ </xsl:if>
+ </td>
- <!--<td>-->
- <!--<input type="text" class="esb-edit
small_textbox">-->
- <!--<xsl:attribute name="id">-->
- <!--<xsl:value-of select="concat('command_med_prop',
@name)"/>-->
- <!--</xsl:attribute>-->
- <!--<xsl:attribute name="value"><xsl:value-of
select="@value"/></xsl:attribute>-->
- <!--</input>-->
- <!--</td>-->
- <!--<td>-->
- <!--<xsl:attribute name="id"><xsl:value-of
select="concat('namespaceCell',@esb_med_pos)"/></xsl:attribute>-->
- <!--</td>-->
- <td><a href="#" id="delete_link">
- <xsl:attribute name="onclick">javascript:
removecommandmedprop('<xsl:value-of select="@name"/>'); return
false;</xsl:attribute>    </a></td>
- </tr>
+ </tr>
</xsl:for-each>
</table>
</div>
Modified:
branches/esb/java/1.6/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/pojoCommand_view.xsl
==============================================================================
---
branches/esb/java/1.6/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/pojoCommand_view.xsl
(original)
+++
branches/esb/java/1.6/esb/java/modules/distribution/src/main/www/extensions/core/xslt/mediators/pojoCommand_view.xsl
Mon Jan 21 00:15:11 2008
@@ -54,12 +54,39 @@
<table border="0" cellpadding="0" cellspacing="0" width="600">
<tr>
<th>Property Name</th>
- <th>Property Type</th>
- <th>Value / Expression</th>
+ <th>Read Info</th>
+ <th>Update Info</th>
</tr>
<xsl:for-each select="syn:property">
- <xsl:call-template name="syn-property-view"/>
- </xsl:for-each>
+ <tr>
+ <td>
+ <xsl:value-of
select="concat(translate(substring(@name,1,1),
+
'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'),
+ substring(@name,2,string-length(@name)))"/>
+ </td>
+ <td>
+ <xsl:if test="@value">Value:
+ <xsl:value-of select="@value"/>
+ </xsl:if>
+ <xsl:if test="not(@value) and @expression and
(@action='ReadMessage' or @action='UpdateContext' or
@action='ReadAndUpdateMessage')">Expression:
+ <xsl:value-of select="@expression"/>
+ </xsl:if>
+ <xsl:if test="not(@value) and @context-name and
(@action='ReadContext' or @action='UpdateMessage' or
@action='ReadAndUpdateContext')">Context name:
+ <xsl:value-of select="@context-name"/>
+ </xsl:if>
+ </td>
+ <td>
+ <xsl:if test="(@expression and
(@action='UpdateMessage' or @action='ReadContext' or
@action='ReadAndUpdateMessage')) or (@value and @expression)">Expression:
+ <xsl:value-of select="@expression"/>
+ </xsl:if>
+ <xsl:if test="(@context-name and
(@action='UpdateContext' or @action='ReadMessage' or
@action='ReadAndUpdateContext')) or (@value and @context-name)">Context name:
+ <xsl:value-of select="@context-name"/>
+ </xsl:if>
+ </td>
+
+
+ </tr>
+ </xsl:for-each>
</table>
</div>
</xsl:if>
_______________________________________________
Esb-java-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev