[jbpm-commits] JBoss JBPM SVN: r5187 - projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Jul 2 08:46:13 EDT 2009
Author: heiko.braun at jboss.com
Date: 2009-07-02 08:46:12 -0400 (Thu, 02 Jul 2009)
New Revision: 5187
Modified:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDataView.java
Log:
Avoid rendering of complex data types in InstanceDataView
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java 2009-07-02 11:50:43 UTC (rev 5186)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java 2009-07-02 12:46:12 UTC (rev 5187)
@@ -245,8 +245,6 @@
for(ProcessDefinitionRef def : definitions)
{
- System.out.println("->"+def.getUrl());
-
if(FILTER_NONE==currentFilter)
{
model.add(def);
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDataView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDataView.java 2009-07-02 11:50:43 UTC (rev 5186)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDataView.java 2009-07-02 12:46:12 UTC (rev 5187)
@@ -26,11 +26,10 @@
import com.mvc4g.client.Controller;
import com.mvc4g.client.ViewInterface;
import org.gwt.mosaic.ui.client.ListBox;
-import org.gwt.mosaic.ui.client.ScrollLayoutPanel;
-import org.gwt.mosaic.ui.client.CaptionLayoutPanel;
import org.gwt.mosaic.ui.client.layout.LayoutPanel;
import org.gwt.mosaic.ui.client.list.DefaultListModel;
import org.jboss.bpm.console.client.LazyPanel;
+import org.jboss.bpm.console.client.util.ConsoleLog;
import java.util.ArrayList;
import java.util.List;
@@ -71,7 +70,7 @@
DataEntry item) {
switch (column) {
case 0:
- listBox.setText(row, column, item.key);
+ listBox.setText(row, column, item.key);
break;
case 1:
listBox.setText(row, column, item.xsd);
@@ -116,32 +115,46 @@
{
// parse the XML document into a DOM
//Document messageDom = XMLParser.parse(messageXml);
-
+
Node dataSetNode = messageDom.getElementsByTagName("dataset").item(0);
- List<Node> dataNodeList = filterChildNodes(dataSetNode.getChildNodes());
- List<DataEntry> data = new ArrayList<DataEntry>();
+ List<Node> dataSetNodeChildren = filterChildNodes(dataSetNode.getChildNodes());
+ List<DataEntry> results = new ArrayList<DataEntry>();
- for(Node n : dataNodeList)
+ for(Node dataNode : dataSetNodeChildren)
{
- DataEntry d = new DataEntry();
- NamedNodeMap atts = n.getAttributes();
+ DataEntry dataEntry = new DataEntry();
+ NamedNodeMap dataNodeAttributes = dataNode.getAttributes();
- Node valueNode = filterChildNodes(n.getChildNodes()).get(0); // expected to have just one child‚
- NamedNodeMap attsChild = valueNode.getAttributes();
+ Node valueNode = filterChildNodes(dataNode.getChildNodes()).get(0); // expected to have just one child‚
+ NamedNodeMap valueNodeAttributes = valueNode.getAttributes();
- d.key = atts.getNamedItem("key").getNodeValue();
- d.xsd = attsChild.getNamedItem("xsi:type").getNodeValue();
- d.java = atts.getNamedItem("javaType").getNodeValue();
- d.value = valueNode.getFirstChild().getNodeValue(); // text element is first child
+ dataEntry.key = dataNodeAttributes.getNamedItem("key").getNodeValue();
+ dataEntry.java = dataNodeAttributes.getNamedItem("javaType").getNodeValue();
+ dataEntry.xsd = valueNodeAttributes.getNamedItem("xsi:type").getNodeValue();
- data.add(d);
+ List<Node> valueChildElements = filterChildNodes(valueNode.getChildNodes());
+
+ if(valueChildElements.isEmpty()
+ && valueNode.hasChildNodes()
+ && Node.TEXT_NODE == valueNode.getChildNodes().item(0).getNodeType())
+ {
+ // simple type
+ dataEntry.value = valueNode.getFirstChild().getNodeValue();
+ }
+ else
+ {
+ // complex types or empty elements
+ dataEntry.value = "n/a";
+ }
+
+ results.add(dataEntry);
}
- bindData(data);
+ bindData(results);
}
- catch (DOMException e)
+ catch (Throwable e)
{
- Window.alert("Could not parse XML document.");
+ ConsoleLog.error("Failed to parse XML document", e);
}
}
@@ -149,7 +162,7 @@
private void bindData(List<DataEntry> data)
{
initialize();
-
+
final DefaultListModel<DataEntry> model =
(DefaultListModel<DataEntry>) listBox.getModel();
model.clear();
@@ -160,7 +173,7 @@
}
// layout again
- this.layout();
+ this.layout();
}
private List<Node> filterChildNodes(NodeList childNodes)
More information about the jbpm-commits
mailing list