X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=plugins%2Forg.argeo.slc.client.ui%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fclient%2Fui%2Fmodel%2FResultFolder.java;h=a5c43168ec18ce34e518bd379d0ed9faf9606976;hb=cec804823540f035172eabce620e636ea4f5e80d;hp=ac4eb9f7cc36b5deeff5d6342714f03ee8c76489;hpb=e8997305e4d5fe939e2e4ec55195afdc0d488bbc;p=gpl%2Fargeo-slc.git diff --git a/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/model/ResultFolder.java b/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/model/ResultFolder.java index ac4eb9f7c..a5c43168e 100644 --- a/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/model/ResultFolder.java +++ b/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/model/ResultFolder.java @@ -27,7 +27,7 @@ import org.argeo.slc.jcr.SlcTypes; * UI Tree component that wrap a node of type ResultFolder. list either other * folders and/or a list of results. keeps a reference to its parent. */ -public class ResultFolder extends ResultParent { +public class ResultFolder extends ResultParent implements Comparable { private Node node = null; @@ -38,16 +38,17 @@ public class ResultFolder extends ResultParent { * throws an exception if null * @param name */ - public ResultFolder(ResultFolder parent, Node node, String name) { + public ResultFolder(ResultParent parent, Node node, String name) { super(name); try { if (node == null) throw new SlcException("Node Object cannot be null"); setParent(parent); this.node = node; - // initialize passed status - setPassed(node.getNode(SlcNames.SLC_STATUS) - .getProperty(SlcNames.SLC_SUCCESS).getBoolean()); + // initialize passed status if possible + if (node.hasNode(SlcNames.SLC_STATUS)) + setPassed(node.getNode(SlcNames.SLC_STATUS) + .getProperty(SlcNames.SLC_SUCCESS).getBoolean()); } catch (RepositoryException re) { throw new SlcException( "Unexpected error while initializing result folder : " @@ -90,51 +91,15 @@ public class ResultFolder extends ResultParent { return node; } - // /** Override normal behavior to initialize display */ - // @Override - // public synchronized Object[] getChildren() { - // if (isLoaded()) { - // return super.getChildren(); - // } else { - // // initialize current object - // try { - // if (node != null) { - // NodeIterator ni = node.getNodes(); - // while (ni.hasNext()) { - // Node currNode = ni.nextNode(); - // if (currNode.isNodeType(SlcTypes.SLC_TEST_RESULT)) - // addChild(new SingleResultNode(this, node, node - // .getProperty(SlcNames.SLC_TEST_CASE) - // .getString())); - // else if (currNode - // .isNodeType(SlcTypes.SLC_RESULT_FOLDER)) - // addChild(new ResultFolder(this, node, - // node.getName())); - // } - // } - // return super.getChildren(); - // } catch (RepositoryException e) { - // throw new ArgeoException( - // "Cannot initialize WorkspaceNode UI object." - // + getName(), e); - // } - // } - // } - - // @Override - // public boolean refreshPassedStatus() { - // Object[] children = getChildren(); - // isPassed = true; - // checkChildrenStatus: for (int i = 0; i <= children.length; i++) { - // if (children[i] instanceof ResultFolder) { - // - // } - // if (!((ResultParent) children[i]).isPassed()) { - // isPassed = false; - // break checkChildrenStatus; - // } - // } - // return isPassed; - // } + /** + * Overriden to return an ordered list of children + */ + public synchronized Object[] getChildren() { + Object[] children = super.getChildren(); + return ResultParentUtils.orderChildren(children); + } + public int compareTo(ResultFolder o) { + return super.compareTo(o); + } } \ No newline at end of file