View Javadoc
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.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 {
29  
30  	/**
31  	 * 
32  	 * @param parent
33  	 * @param node
34  	 *            throws an exception if null
35  	 * @param name
36  	 */
37  	public ResultFolder(ParentNodeFolder parent, Node node, String name) {
38  		super(parent, node, name);
39  		try {
40  			// initialize passed status if possible
41  			if (node.hasNode(SlcNames.SLC_AGGREGATED_STATUS))
42  				setPassed(node.getNode(SlcNames.SLC_AGGREGATED_STATUS)
43  						.getProperty(SlcNames.SLC_SUCCESS).getBoolean());
44  		} catch (RepositoryException re) {
45  			throw new SlcException(
46  					"Unexpected error while initializing result folder : "
47  							+ getName(), re);
48  		}
49  	}
50  
51  	// /**
52  	// * Overriden to return an ordered list of children
53  	// */
54  	// public synchronized Object[] getChildren() {
55  	// Object[] children = super.getChildren();
56  	// return ResultParentUtils.orderChildren(children);
57  	// }
58  	//
59  	// public int compareTo(ResultFolder o) {
60  	// return super.compareTo(o);
61  	// }
62  }