Author: alessio.soldano(a)jboss.com
Date: 2013-02-15 13:58:25 -0500 (Fri, 15 Feb 2013)
New Revision: 521
Added:
webgui/trunk/src/main/webapp/resources/
webgui/trunk/src/main/webapp/resources/css/
webgui/trunk/src/main/webapp/resources/css/styles.css
Modified:
webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java
webgui/trunk/src/main/webapp/index.xhtml
webgui/trunk/src/main/webapp/templates/template.xhtml
Log:
[WISE-186] Add popup panel for request message preview + add css file
Modified: webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java
===================================================================
--- webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java 2013-02-15
18:57:03 UTC (rev 520)
+++ webgui/trunk/src/main/java/org/jboss/wise/gui/ClientConversationBean.java 2013-02-15
18:58:25 UTC (rev 521)
@@ -16,6 +16,7 @@
*/
package org.jboss.wise.gui;
+import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.io.Serializable;
import java.lang.reflect.Type;
@@ -77,7 +78,8 @@
private TreeNodeImpl outputTree;
private String error;
private UITree inTree;
-
+ private String requestPreview;
+
@PostConstruct
public void init() {
//this is called each time a new browser tab is used and whenever the conversation
expires (hence a new bean is created)
@@ -166,6 +168,28 @@
}
}
+ public void generateRequestPreview() {
+ requestPreview = null;
+ StringTokenizer st = new StringTokenizer(currentOperation, ";");
+ String serviceName = st.nextToken();
+ String portName = st.nextToken();
+ String operationName = st.nextToken();
+ try {
+ WSMethod wsMethod = client.getWSMethod(serviceName, portName, operationName);
+ Map<String, Object> params = new HashMap<String, Object>();
+ for (Iterator<Object> it = inputTree.getChildrenKeysIterator(); it.hasNext();
) {
+ WiseTreeElement wte = (WiseTreeElement)inputTree.getChild(it.next());
+ params.put(wte.getName(), wte.isNil() ? null : wte.toObject());
+ }
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ wsMethod.writeRequestPreview(params, os);
+ requestPreview = os.toString("UTF-8");
+ } catch (Exception e) {
+ requestPreview = toErrorMessage(e);
+ logException(e);
+ }
+ }
+
public void addChild(GroupWiseTreeElement el) {
el.incrementChildren();
}
@@ -359,7 +383,15 @@
public void setError(String error) {
this.error = error;
}
+
+ public String getRequestPreview() {
+ return requestPreview;
+ }
+ public void setRequestPreview(String requestPreview) {
+ this.requestPreview = requestPreview;
+ }
+
private static String toErrorMessage(Exception e) {
StringBuilder sb = new StringBuilder();
if (e instanceof WiseRuntimeException) {
Modified: webgui/trunk/src/main/webapp/index.xhtml
===================================================================
--- webgui/trunk/src/main/webapp/index.xhtml 2013-02-15 18:57:03 UTC (rev 520)
+++ webgui/trunk/src/main/webapp/index.xhtml 2013-02-15 18:58:25 UTC (rev 521)
@@ -179,7 +179,23 @@
</rich:tree>
<a4j:commandButton value="Perform invocation"
render="opSelectionPanel" rerender="opSelectionPanel"
action="#{clientConversationBean.performInvocation}"
status="perfInvStatus" />
+ <h:outputText value=" " />
+
+ <a4j:commandButton value="Preview message"
render="popupPreview"
action="#{clientConversationBean.generateRequestPreview}"
+ id="previewButton"
oncomplete="#{rich:component('popupPreview')}.show();">
+ </a4j:commandButton>
</h:form>
+ <rich:popupPanel id="popupPreview" modal="true"
resizeable="true"
onmaskclick="#{rich:component('popupPreview')}.hide()"
minWidth="550" minHeight="450">
+ <f:facet name="header">
+ <h:outputText value="SOAP request message preview" />
+ </f:facet>
+ <f:facet name="controls">
+ <h:outputLink value="#"
onclick="#{rich:component('popupPreview')}.hide(); return
false;">X</h:outputLink>
+ </f:facet>
+ <p>Below is a preview of the SOAP message that will be generated upon
invocation. The actual message going on the wire might be different
+ depending on the selected service policy (security, addressing,
reliable-messaging, etc.), if any.</p>
+ <div align="center"><h:inputTextarea
value="#{clientConversationBean.requestPreview}" cols="80"
rows="20" readonly="true"
styleClass="preformatted"/></div>
+ </rich:popupPanel>
</rich:panel>
<br />
Added: webgui/trunk/src/main/webapp/resources/css/styles.css
===================================================================
--- webgui/trunk/src/main/webapp/resources/css/styles.css (rev 0)
+++ webgui/trunk/src/main/webapp/resources/css/styles.css 2013-02-15 18:58:25 UTC (rev
521)
@@ -0,0 +1,3 @@
+.preformatted {
+ white-space: pre;
+}
Modified: webgui/trunk/src/main/webapp/templates/template.xhtml
===================================================================
--- webgui/trunk/src/main/webapp/templates/template.xhtml 2013-02-15 18:57:03 UTC (rev
520)
+++ webgui/trunk/src/main/webapp/templates/template.xhtml 2013-02-15 18:58:25 UTC (rev
521)
@@ -5,6 +5,7 @@
<h:head>
<title>wise-gui</title>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8"/>
+ <h:outputStylesheet name="css/styles.css" />
</h:head>
<h:body>