]> git.argeo.org Git - gpl/argeo-slc.git/blob - plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/model/ResultFolder.java
8abae3f771dd409db938e6f1137e8e3d309379ae
[gpl/argeo-slc.git] / plugins / org.argeo.slc.client.ui / src / main / java / org / argeo / slc / client / ui / model / ResultFolder.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.argeo.slc.client.ui.model;
17
18 import javax.jcr.Node;
19 import javax.jcr.RepositoryException;
20
21 import org.argeo.slc.SlcException;
22 import org.argeo.slc.jcr.SlcNames;
23
24 /**
25 * UI Tree component that wrap a node of type ResultFolder. list either other
26 * folders and/or a list of results. keeps a reference to its parent.
27 */
28 public class ResultFolder extends ParentNodeFolder implements
29 Comparable<ResultFolder> {
30
31 /**
32 *
33 * @param parent
34 * @param node
35 * throws an exception if null
36 * @param name
37 */
38 public ResultFolder(ParentNodeFolder parent, Node node, String name) {
39 super(parent, node, name);
40 try {
41 // initialize passed status if possible
42 if (node.hasNode(SlcNames.SLC_STATUS))
43 setPassed(node.getNode(SlcNames.SLC_STATUS)
44 .getProperty(SlcNames.SLC_SUCCESS).getBoolean());
45 } catch (RepositoryException re) {
46 throw new SlcException(
47 "Unexpected error while initializing result folder : "
48 + getName(), re);
49 }
50 }
51
52 /**
53 * Overriden to return an ordered list of children
54 */
55 public synchronized Object[] getChildren() {
56 Object[] children = super.getChildren();
57 return ResultParentUtils.orderChildren(children);
58 }
59
60 public int compareTo(ResultFolder o) {
61 return super.compareTo(o);
62 }
63 }