Author: alessio.soldano(a)jboss.com
Date: 2013-01-30 12:33:57 -0500 (Wed, 30 Jan 2013)
New Revision: 476
Added:
webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/ByteArrayWiseTreeElement.java
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/WiseTreeElementBuilder.java
webgui/branches/cdi-jsf/src/main/webapp/index.xhtml
Log:
Adding byte array element for xsd base64binary
Added:
webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/ByteArrayWiseTreeElement.java
===================================================================
---
webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/ByteArrayWiseTreeElement.java
(rev 0)
+++
webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/ByteArrayWiseTreeElement.java 2013-01-30
17:33:57 UTC (rev 476)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * 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.
+ *
+ * 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 javax.xml.bind.DatatypeConverter;
+
+/**
+ * A simple tree element to handle byte[]
+ *
+ * @author alessio.soldano(a)jboss.com
+ *
+ */
+public class ByteArrayWiseTreeElement extends SimpleWiseTreeElement {
+
+ private static final long serialVersionUID = 1L;
+
+ public ByteArrayWiseTreeElement() {
+ this.kind = BYTE_ARRAY;
+ }
+
+ public ByteArrayWiseTreeElement(Class<?> classType, String name, String value)
{
+ this.kind = BYTE_ARRAY;
+ this.classType = classType;
+ this.nil = value == null;
+ this.name = name;
+ this.value = value;
+ }
+
+ @Override
+ public WiseTreeElement clone() {
+ ByteArrayWiseTreeElement element = new ByteArrayWiseTreeElement();
+ element.setName(this.name);
+ element.setNil(this.nil);
+ element.setClassType(this.classType);
+ element.setValue(this.value);
+ element.setRemovable(this.isRemovable());
+ element.setNillable(this.isNillable());
+ return element;
+ }
+
+ @Override
+ public void parseObject(Object obj) {
+ if (obj != null) {
+ this.setValue(DatatypeConverter.printBase64Binary((byte[])obj));
+ } else {
+ this.setValue(null);
+ }
+ this.nil = (obj == null && nillable);
+ }
+
+ @Override
+ public Object toObject() {
+ if (isNil()) return null;
+ byte[] result = null;
+ if (value != null) {
+ return DatatypeConverter.parseBase64Binary(value);
+ }
+ return result;
+ }
+}
\ No newline at end of file
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-30
16:31:33 UTC (rev 475)
+++
webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/WiseTreeElement.java 2013-01-30
17:33:57 UTC (rev 476)
@@ -34,6 +34,7 @@
private static final long serialVersionUID = 5298756163814063425L;
public static final String SIMPLE = "simple";
+ public static final String BYTE_ARRAY = "byteArray";
public static final String COMPLEX = "complex";
public static final String DURATION = "Duration";
public static final String EMPTY = "empty";
Modified:
webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/WiseTreeElementBuilder.java
===================================================================
---
webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/WiseTreeElementBuilder.java 2013-01-30
16:31:33 UTC (rev 475)
+++
webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/WiseTreeElementBuilder.java 2013-01-30
17:33:57 UTC (rev 476)
@@ -117,6 +117,13 @@
Set<Type> stack) {
if (cl.isArray()) {
+ if (byte.class.equals(cl.getComponentType())) {
+ ByteArrayWiseTreeElement element = new ByteArrayWiseTreeElement(cl, name, null);
+ if (obj != null) {
+ element.parseObject(obj);
+ }
+ return element;
+ }
Logger.getLogger(this.getClass()).debug("* array");
Logger.getLogger(this.getClass()).debug("Component type: " +
cl.getComponentType());
throw new WiseRuntimeException("Converter doesn't support this Object[]
yet.");
Modified: webgui/branches/cdi-jsf/src/main/webapp/index.xhtml
===================================================================
--- webgui/branches/cdi-jsf/src/main/webapp/index.xhtml 2013-01-30 16:31:33 UTC (rev 475)
+++ webgui/branches/cdi-jsf/src/main/webapp/index.xhtml 2013-01-30 17:33:57 UTC (rev 476)
@@ -157,6 +157,18 @@
Remove
</a4j:commandLink>
</rich:treeNode>
+ <rich:treeNode type="byteArray">
+ <h:outputText value="#{node.type} : #{node.name} " />
+ <h:selectBooleanCheckbox id="foo6-chk"
value="#{node.notNil}" disabled="#{node.notNillable}" >
+ <f:ajax />
+ </h:selectBooleanCheckbox>
+ <h:inputText value="#{node.value}" id="foo6" >
+ <f:ajax event="valueChange" render="foo6-chk"
listener="#{clientConversationBean.onInputFocus(node)}" />
+ </h:inputText>
+ <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" rerender="opSelectionPanel"
action="#{clientConversationBean.performInvocation}"
status="perfInvStatus" />
@@ -213,6 +225,11 @@
<rich:treeNode type="complex">
<h:outputText value="#{node.type} : #{node.name}" />
</rich:treeNode>
+ <rich:treeNode type="byteArray">
+ <h:outputText value="#{node.type} : #{node.name} =
#{node.value}"
+ rendered="#{node.notNil}" />
+ <h:outputText value="#{node.type} : #{node.name} = ***NIL***"
rendered="#{node.nil}" />
+ </rich:treeNode>
<rich:treeNode type="empty">
<h:outputText value="#{node.name} = ***NIL***" />
</rich:treeNode>