]>
git.argeo.org Git - gpl/argeo-slc.git/blob - plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/model/SingleResultNode.java
afd1249898858f82452d877f2b83ebfe55ba1466
2 * Copyright (C) 2007-2012 Argeo GmbH
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org
.argeo
.slc
.client
.ui
.model
;
18 import javax
.jcr
.Node
;
19 import javax
.jcr
.RepositoryException
;
20 import javax
.jcr
.Workspace
;
22 import org
.argeo
.eclipse
.ui
.TreeParent
;
23 import org
.argeo
.slc
.SlcException
;
24 import org
.argeo
.slc
.jcr
.SlcNames
;
27 * UI Tree component. Wraps a result node of a JCR {@link Workspace}. It also
28 * keeps a reference to its parent node that can either be a
29 * {@link ResultFolder}, a {@link SingleResultNode} or a {@link VirtualFolder}.
33 public class SingleResultNode
extends ResultParent
implements
34 Comparable
<SingleResultNode
> {
36 private final Node node
;
37 private boolean passed
;
39 // keeps a local reference to the node's name to avoid exception when the
42 /** Creates a new UiNode in the UI Tree */
43 public SingleResultNode(TreeParent parent
, Node node
, String name
) {
47 setPassed(refreshPassedStatus());
50 public boolean refreshPassedStatus() {
53 if (node
.hasNode(SlcNames
.SLC_AGGREGATED_STATUS
)) {
54 check
= node
.getNode(SlcNames
.SLC_AGGREGATED_STATUS
);
55 passed
= check
.getProperty(SlcNames
.SLC_SUCCESS
).getBoolean();
58 // Happens only if the UI triggers a refresh while the execution
59 // is in progress and the corresponding node is being built
61 } catch (RepositoryException re
) {
62 throw new SlcException(
63 "Unexpected error while checking result status", re
);
67 /** returns the node wrapped by the current UI object */
68 public Node
getNode() {
73 * Override normal behavior : Results have no children for this view
76 public synchronized Object
[] getChildren() {
81 public boolean hasChildren() {
85 public boolean isPassed() {
90 protected void initialize() {
91 // Do nothing this object is fully initialized at instantiation time.
94 public int compareTo(SingleResultNode o
) {
95 return super.compareTo(o
);