Author: alessio.soldano(a)jboss.com
Date: 2013-01-30 11:31:33 -0500 (Wed, 30 Jan 2013)
New Revision: 475
Added:
webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/EmptyWiseTreeElement.java
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/DurationWiseTreeElement.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:
Few fixes on duration, xml gregorian calendar elements and handling of null results from
core
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-29
17:26:12 UTC (rev 474)
+++
webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/ClientConversationBean.java 2013-01-30
16:31:33 UTC (rev 475)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source
- * Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+ * Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
* contributors by the @authors tag. See the copyright.txt in the
* distribution for a full listing of individual contributors.
*
@@ -18,7 +18,6 @@
import java.io.Serializable;
import java.lang.reflect.Type;
-import java.net.ConnectException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
@@ -45,6 +44,7 @@
import org.jboss.wise.core.client.factories.WSDynamicClientFactory;
import org.jboss.wise.core.exception.InvocationException;
import org.jboss.wise.core.exception.WiseRuntimeException;
+import org.jboss.wise.gui.treeElement.EmptyWiseTreeElement;
import org.jboss.wise.gui.treeElement.GroupWiseTreeElement;
import org.jboss.wise.gui.treeElement.LazyLoadWiseTreeElement;
import org.jboss.wise.gui.treeElement.WiseTreeElement;
@@ -171,7 +171,7 @@
}
}
- public void onInputTextFocus(WiseTreeElement el) {
+ public void onInputFocus(WiseTreeElement el) {
el.setNotNil(true);
}
@@ -197,7 +197,12 @@
TreeNodeImpl rootElement = new TreeNodeImpl();
for (Entry<String, Object> res : result.getResult().entrySet()) {
Object resObj = res.getValue();
- WiseTreeElement wte = builder.buildTreeFromType(resObj.getClass(), res.getKey(),
resObj, true);
+ WiseTreeElement wte;
+ if (resObj != null) {
+ wte = builder.buildTreeFromType(resObj.getClass(), res.getKey(), resObj, true);
+ } else {
+ wte = new EmptyWiseTreeElement("result");
+ }
rootElement.addChild(wte.getId(), wte);
}
return rootElement;
Modified:
webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/DurationWiseTreeElement.java
===================================================================
---
webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/DurationWiseTreeElement.java 2013-01-29
17:26:12 UTC (rev 474)
+++
webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/DurationWiseTreeElement.java 2013-01-30
16:31:33 UTC (rev 475)
@@ -58,11 +58,8 @@
@Override
public void parseObject(Object obj) {
- if (obj != null) {
- this.setValue(((Duration) obj).toString());
- } else {
- this.setValue(null);
- }
+ this.setValue(obj != null ? ((Duration) obj).toString() : null);
+ this.nil = (obj == null && nillable);
}
@Override
Added:
webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/EmptyWiseTreeElement.java
===================================================================
---
webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/EmptyWiseTreeElement.java
(rev 0)
+++
webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/EmptyWiseTreeElement.java 2013-01-30
16:31:33 UTC (rev 475)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.wise.gui.treeElement;
+
+import org.jboss.wise.core.utils.IDGenerator;
+
+/**
+ * @author Alessio Soldano, alessio.soldano(a)jboss.com
+ *
+ */
+public class EmptyWiseTreeElement extends WiseTreeElement {
+
+ private static final long serialVersionUID = 1L;
+
+ public EmptyWiseTreeElement() {
+ super(true);
+ this.kind = EMPTY;
+ this.id = IDGenerator.nextVal();
+ }
+
+ public EmptyWiseTreeElement(String name) {
+ super(true);
+ this.kind = EMPTY;
+ this.id = IDGenerator.nextVal();
+ this.name = name;
+ }
+
+ /**
+ * Returns the String value of the instance corresponding to this element.
+ *
+ * @return The value
+ */
+ public String getValue() {
+ return null;
+ }
+
+ public WiseTreeElement clone() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Gets the value for this element parsing a given object instance. This is
+ * to be used to set the element value after the service invocation.
+ *
+ * @param obj
+ */
+ public void parseObject(Object obj) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object toObject() {
+ return null;
+ }
+}
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-29
17:26:12 UTC (rev 474)
+++
webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/WiseTreeElement.java 2013-01-30
16:31:33 UTC (rev 475)
@@ -36,6 +36,7 @@
public static final String SIMPLE = "simple";
public static final String COMPLEX = "complex";
public static final String DURATION = "Duration";
+ public static final String EMPTY = "empty";
public static final String ENUMERATION = "Enumeration";
public static final String GROUP = "group";
public static final String LAZY = "lazy";
Modified: webgui/branches/cdi-jsf/src/main/webapp/index.xhtml
===================================================================
--- webgui/branches/cdi-jsf/src/main/webapp/index.xhtml 2013-01-29 17:26:12 UTC (rev 474)
+++ webgui/branches/cdi-jsf/src/main/webapp/index.xhtml 2013-01-30 16:31:33 UTC (rev 475)
@@ -61,7 +61,7 @@
<f:ajax />
</h:selectBooleanCheckbox>
<h:inputText value="#{node.value}" id="foo"
label="" rendered="#{node.type!='boolean' and
node.type!='Boolean'}" columns="10" >
- <f:ajax event="valueChange" render="foo-chk"
listener="#{clientConversationBean.onInputTextFocus(node)}" />
+ <f:ajax event="valueChange" render="foo-chk"
listener="#{clientConversationBean.onInputFocus(node)}" />
</h:inputText>
<h:selectOneMenu value="#{node.value}"
rendered="#{node.type=='boolean' or node.type=='Boolean'}">
<f:selectItem itemValue="true" itemLabel="true"
/>
@@ -77,11 +77,9 @@
<h:outputText value=" " />
<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="#{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="lazy">
@@ -110,9 +108,9 @@
<h:selectBooleanCheckbox id="foo2-chk"
value="#{node.notNil}" disabled="#{node.notNillable}" >
<f:ajax />
</h:selectBooleanCheckbox>
- <rich:calendar id="foo2" value="#{node.valueDate}"
oncollapse="document.getElementById(this.id + '-chk').checked=true;return
true;"
- popup="true"
- showInput="true" enableManualInput="false" />
+ <rich:calendar id="foo2" value="#{node.valueDate}"
popup="true" showInput="true" enableManualInput="false"
>
+ <f:ajax event="change" render="foo2-chk"
listener="#{clientConversationBean.onInputFocus(node)}" />
+ </rich:calendar>
<a4j:commandLink
action="#{clientConversationBean.removeChild(node)}"
rerender="richTree" rendered="#{node.removable}">
Remove
</a4j:commandLink>
@@ -122,7 +120,9 @@
<h:selectBooleanCheckbox id="foo3-chk"
value="#{node.notNil}" disabled="#{node.notNillable}" >
<f:ajax />
</h:selectBooleanCheckbox>
- <h:inputText id="foo3" value="#{node.value}"
onfocus="document.getElementById(this.id + '-chk').checked=true"/>
+ <h:inputText id="foo3" value="#{node.value}">
+ <f:ajax event="valueChange" render="foo3-chk"
listener="#{clientConversationBean.onInputFocus(node)}" />
+ </h:inputText>
<h:outputText value="(MilliSeconds)" target="_blank"
/>
<h:outputText value=" " />
<a4j:commandLink
action="#{clientConversationBean.removeChild(node)}"
rerender="richTree" rendered="#{node.removable}">
@@ -134,9 +134,10 @@
<h:selectBooleanCheckbox id="foo4-chk"
value="#{node.notNil}" disabled="#{node.notNillable}" >
<f:ajax />
</h:selectBooleanCheckbox>
- <h:outputText value="nameSpace: " />
- <h:inputText id="foo4" value="#{node.nameSpace}"
onfocus="document.getElementById(this.id + '-chk').checked=true"/>
- <h:outputText value=" localPart: " />
+ <h:inputText id="foo4" value="#{node.nameSpace}">
+ <f:ajax event="valueChange" render="foo4-chk"
listener="#{clientConversationBean.onInputFocus(node)}" />
+ </h:inputText>
+ <h:outputText value=" : " />
<h:inputText value="#{node.localPart}" />
<h:outputText value=" " />
<a4j:commandLink
action="#{clientConversationBean.removeChild(node)}"
rerender="richTree" rendered="#{node.removable}">
@@ -212,6 +213,9 @@
<rich:treeNode type="complex">
<h:outputText value="#{node.type} : #{node.name}" />
</rich:treeNode>
+ <rich:treeNode type="empty">
+ <h:outputText value="#{node.name} = ***NIL***" />
+ </rich:treeNode>
</rich:tree>
</h:form>
</rich:panel>