[wise-commits] wise SVN: r463 - in webgui/branches/cdi-jsf/src/main: java/org/jboss/wise/gui/treeElement and 1 other directories.

wise-commits at lists.jboss.org wise-commits at lists.jboss.org
Sat Jan 26 18:58:28 EST 2013


Author: alessio.soldano at jboss.com
Date: 2013-01-26 18:58:27 -0500 (Sat, 26 Jan 2013)
New Revision: 463

Modified:
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/ClientConversationBean.java
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/WiseTreeElement.java
   webgui/branches/cdi-jsf/src/main/webapp/index.xhtml
Log:
Adding "Add" and "Remove" functionalities in the tree gui for group elements + fixing few minor ui issues


Modified: webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/ClientConversationBean.java
===================================================================
--- webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/ClientConversationBean.java	2013-01-25 23:23:53 UTC (rev 462)
+++ webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/ClientConversationBean.java	2013-01-26 23:58:27 UTC (rev 463)
@@ -42,6 +42,7 @@
 import org.jboss.wise.core.client.WebParameter;
 import org.jboss.wise.core.client.builder.WSDynamicClientBuilder;
 import org.jboss.wise.core.client.factories.WSDynamicClientFactory;
+import org.jboss.wise.gui.treeElement.GroupWiseTreeElement;
 import org.jboss.wise.gui.treeElement.WiseTreeElement;
 import org.jboss.wise.gui.treeElement.WiseTreeElementBuilder;
 import org.richfaces.component.UITree;
@@ -100,6 +101,7 @@
 	} catch (Exception e) {
 	    throw new RuntimeException(e);
 	}
+	outputTree = null;
     }
     
     public void performInvocation() {
@@ -118,9 +120,24 @@
 	} catch (Exception e) {
 	    throw new RuntimeException(e);
 	}
-	
     }
     
+    public void addChild(GroupWiseTreeElement el) {
+	try {
+	    el.incrementChildren();
+	} catch (Exception e) {
+	    throw new RuntimeException(e);
+	}
+    }
+    
+    public void removeChild(WiseTreeElement el) {
+	try {
+	    ((GroupWiseTreeElement)el.getParent()).removeChild(el.getId());
+	} catch (Exception e) {
+	    throw new RuntimeException(e);
+	}
+    }
+    
     private static TreeNodeImpl convertOperationParametersToGui(WSMethod wsMethod, WSDynamicClient client) {
 	WiseTreeElementBuilder builder = new WiseTreeElementBuilder(client);
 	TreeNodeImpl rootElement = new TreeNodeImpl();

Modified: webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/WiseTreeElement.java
===================================================================
--- webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/WiseTreeElement.java	2013-01-25 23:23:53 UTC (rev 462)
+++ webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/WiseTreeElement.java	2013-01-26 23:58:27 UTC (rev 463)
@@ -52,6 +52,8 @@
     protected boolean nillable = true; //for primitives and explicitly not nillable elements
     private boolean removable = false; // to be used on array elements
     
+    private WiseTreeElement parent;
+    
     protected Type classType;
 
     protected WiseTreeElement() {
@@ -136,11 +138,40 @@
 	} else {
 	    return ((Class<?>) this.classType).getSimpleName();
 	}
+    }
 
+    public WiseTreeElement getParent() {
+        return parent;
     }
 
+    public void setParent(WiseTreeElement parent) {
+        this.parent = parent;
+    }
+
     /** ** Abstract method *** */
 
+    public void addChild(Object key, TreeNode child) {
+	super.addChild(key, child);
+	if (child instanceof WiseTreeElement) {
+	    ((WiseTreeElement)child).setParent(this);
+	}
+    }
+
+    public void insertChild(int idx, Object key, TreeNode child) {
+	super.insertChild(idx, key, child);
+	if (child instanceof WiseTreeElement) {
+	    ((WiseTreeElement)child).setParent(this);
+	}
+    }
+
+    public void removeChild(Object key) {
+	TreeNode child = getChild(key);
+	if (child instanceof WiseTreeElement) {
+	    ((WiseTreeElement)child).setParent(null);
+	}
+	super.removeChild(key);
+    }
+    
     /**
      * Every WiseTreeElement must be cloneable; this is required to handle
      * element's add and removal into/from arrays and collections.

Modified: webgui/branches/cdi-jsf/src/main/webapp/index.xhtml
===================================================================
--- webgui/branches/cdi-jsf/src/main/webapp/index.xhtml	2013-01-25 23:23:53 UTC (rev 462)
+++ webgui/branches/cdi-jsf/src/main/webapp/index.xhtml	2013-01-26 23:58:27 UTC (rev 463)
@@ -60,33 +60,31 @@
         						<f:selectItem itemValue="true" itemLabel="true" />
 						        <f:selectItem itemValue="false" itemLabel="false" />
         					</h:selectOneMenu>
-					        <h:outputText value="&nbsp;" />
-<!--					        <a4j:commandLink action="#{WSDLManager.removeChild(node)}" rerender="richTree"
-						        rendered="#{node.removable}">
-						        <h:graphicImage styleClass="minus" value="images/small/Minus.png" rendered="#{node.removable}" />
-					        </a4j:commandLink>  -->
+					        <a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
+				        		Remove
+        					</a4j:commandLink>
 				        </rich:treeNode>
 				        <rich:treeNode type="group">
 					        <h:outputText value="[#{node.prototype.type}]" styleClass="tipoCampo" />
         					<h:selectBooleanCheckbox value="#{node.notNil}" disabled="true" />
 		        			<h:outputText value="&nbsp;" />
-<!--				        	<a4j:commandLink name="Add" action="#{WSDLManager.addChild(node)}" reRender="richTree">
-						        <h:graphicImage styleClass="plus" value="images/small/Plus.png" />
+		        			<a4j:commandLink name="Add" action="#{clientConversationBean.addChild(node)}" reRender="richTree">
+						        Add
+<!--						        <h:graphicImage styleClass="plus" value="images/small/Plus.png" />   -->
         					</a4j:commandLink>
-		        			<a4j:commandLink action="#{WSDLManager.removeChild(node)}" rerender="richTree"
-				        		rendered="#{node.removable}">
-						        <h:graphicImage styleClass="minus" value="images/small/Minus.png" rendered="#{node.removable}" />
-        					</a4j:commandLink> -->
+        					<a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
+				        		Remove
+<!--						        <h:graphicImage styleClass="minus" value="images/small/Minus.png" rendered="#{node.removable}" />    -->
+        					</a4j:commandLink>
 		        		</rich:treeNode>
 				        <rich:treeNode type="complex">
 					        <h:outputText value="#{node.type} : #{node.name} " />
 					        <h:selectBooleanCheckbox value="#{node.notNil}" disabled="#{node.notNillable}" />
         					<h:outputText value="&nbsp;" />
 					        <h:outputText value="&nbsp;" />
-<!--					        <a4j:commandLink action="#{WSDLManager.removeChild(node)}" reRender="richTree"
-						        rendered="#{node.removable}">
-						        <h:graphicImage styleClass="minus" value="images/small/Minus.png" rendered="#{node.removable}" />
-					        </a4j:commandLink>  -->
+					        <a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
+				        		Remove
+        					</a4j:commandLink>
 				        </rich:treeNode>
 				        <rich:treeNode type="Parameterized">
 					        <h:outputText value="{#{node.namespace}} " />
@@ -98,10 +96,9 @@
 				        	<rich:calendar id="foo2" value="#{node.valueDate}" oncollapse="document.getElementById(this.id + '-chk').checked=true;return true;"
 						        popup="true"
         						showInput="true" enableManualInput="false" />
-<!--		        			<a4j:commandLink action="#{WSDLManager.removeChild(node)}" rerender="richTree"
-				        		rendered="#{node.removable}">
-						        <h:graphicImage styleClass="minus" value="images/small/Minus.png" rendered="#{node.removable}" />
-        					</a4j:commandLink> -->
+        					<a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
+				        		Remove
+        					</a4j:commandLink>
 		        		</rich:treeNode>
 				        <rich:treeNode type="Duration">
         					<h:outputText value="#{node.type} : #{node.name} " styleClass="tipoCampo" />
@@ -109,10 +106,9 @@
 				        	<h:inputText id="foo3" value="#{node.value}" onfocus="document.getElementById(this.id + '-chk').checked=true"/>
         					<h:outputText value="(MilliSeconds)" target="_blank" />
 		        			<h:outputText value="&nbsp;" />
-<!--				        	<a4j:commandLink action="#{WSDLManager.removeChild(node)}" rerender="richTree"
-						        rendered="#{node.removable}">
-        						<h:graphicImage styleClass="minus" value="images/small/Minus.png" rendered="#{node.removable}" />
-		        			</a4j:commandLink> -->
+		        			<a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
+				        		Remove
+        					</a4j:commandLink>
 				        </rich:treeNode>
         				<rich:treeNode type="qname">
 		        			<h:outputText value="#{node.type} : #{node.name} " styleClass="tipoCampo" />
@@ -122,10 +118,9 @@
 				        	<h:outputText value=" localPart: " />
         					<h:inputText value="#{node.localPart}" />
 		        			<h:outputText value="&nbsp;" />
-<!--				        	<a4j:commandLink action="#{WSDLManager.removeChild(node)}" rerender="richTree"
-						        rendered="#{node.removable}">
-        						<h:graphicImage styleClass="minus" value="images/small/Minus.png" rendered="#{node.removable}" />
-		        			</a4j:commandLink> -->
+		        			<a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
+				        		Remove
+        					</a4j:commandLink>
 				        </rich:treeNode>
         				<rich:treeNode type="Enumeration">
 		        			<h:outputText value="#{node.type} : #{node.name} " styleClass="tipoCampo" />
@@ -134,13 +129,12 @@
 		        				<f:selectItems value="#{node.validValue}" />
 				        	</h:selectOneMenu>
         					<h:outputText value="&nbsp;" />
-<!--		        			<a4j:commandLink action="#{WSDLManager.removeChild(node)}" rerender="richTree"
-				        		rendered="#{node.removable}">
-						        <h:graphicImage styleClass="minus" value="images/small/Minus.png" rendered="#{node.removable}" />
-        					</a4j:commandLink> -->
+        					<a4j:commandLink action="#{clientConversationBean.removeChild(node)}" rerender="richTree" rendered="#{node.removable}">
+				        		Remove
+        					</a4j:commandLink>
 		        		</rich:treeNode>
         		    </rich:tree>
-                    <a4j:commandButton value="Perform invocation" render="opSelectionPanel" action="#{clientConversationBean.performInvocation}" />
+                    <a4j:commandButton value="Perform invocation" render="opSelectionPanel" rerender="opSelectionPanel" action="#{clientConversationBean.performInvocation}" />
                 </h:form>
             </rich:panel>
             



More information about the wise-commits mailing list