]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/model/ResultFolder.java
remove useless carriage return
[gpl/argeo-slc.git] / plugins / org.argeo.slc.client.ui / src / main / java / org / argeo / slc / client / ui / model / ResultFolder.java
index ac4eb9f7cc36b5deeff5d6342714f03ee8c76489..429dcedd55dd51e1c6db0ecb2d2c780ad9549bf4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2012 Mathieu Baudier
+ * Copyright (C) 2007-2012 Argeo GmbH
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 package org.argeo.slc.client.ui.model;
 
 import javax.jcr.Node;
-import javax.jcr.NodeIterator;
 import javax.jcr.RepositoryException;
 
 import org.argeo.slc.SlcException;
 import org.argeo.slc.jcr.SlcNames;
-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 {
-
-       private Node node = null;
+public class ResultFolder extends ParentNodeFolder {
 
        /**
         * 
@@ -38,42 +34,13 @@ public class ResultFolder extends ResultParent {
         *            throws an exception if null
         * @param name
         */
-       public ResultFolder(ResultFolder 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());
-               } catch (RepositoryException re) {
-                       throw new SlcException(
-                                       "Unexpected error while initializing result folder : "
-                                                       + getName(), re);
-               }
-
-       }
-
-       @Override
-       protected void initialize() {
+       public ResultFolder(ParentNodeFolder parent, Node node, String name) {
+               super(parent, node, name);
                try {
-                       NodeIterator ni = node.getNodes();
-                       while (ni.hasNext()) {
-                               Node currNode = ni.nextNode();
-                               if (currNode.isNodeType(SlcTypes.SLC_TEST_RESULT)) {
-                                       SingleResultNode srn = new SingleResultNode(this, currNode,
-                                                       currNode.getProperty(SlcNames.SLC_TEST_CASE)
-                                                                       .getString());
-                                       addChild(srn);
-                               } else if (currNode.isNodeType(SlcTypes.SLC_RESULT_FOLDER)) {
-                                       // FIXME change label
-                                       ResultFolder rf = new ResultFolder(this, currNode,
-                                                       currNode.getName());
-                                       addChild(rf);
-                               }
-                       }
+                       // 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 : "
@@ -81,60 +48,15 @@ public class ResultFolder extends ResultParent {
                }
        }
 
-       @Override
-       public synchronized void dispose() {
-               super.dispose();
-       }
-
-       public Node getNode() {
-               return node;
-       }
-
-       // /** Override normal behavior to initialize display */
-       // @Override
+       // /**
+       // * Overriden to return an ordered list of children
+       // */
        // 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);
-       // }
-       // }
+       // Object[] children = super.getChildren();
+       // return ResultParentUtils.orderChildren(children);
        // }
-
-       // @Override
-       // public boolean refreshPassedStatus() {
-       // Object[] children = getChildren();
-       // isPassed = true;
-       // checkChildrenStatus: for (int i = 0; i <= children.length; i++) {
-       // if (children[i] instanceof ResultFolder) {
        //
+       // public int compareTo(ResultFolder o) {
+       // return super.compareTo(o);
        // }
-       // if (!((ResultParent) children[i]).isPassed()) {
-       // isPassed = false;
-       // break checkChildrenStatus;
-       // }
-       // }
-       // return isPassed;
-       // }
-
 }
\ No newline at end of file