]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/content/ViewpointContribution.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.browsing.ui / src / org / simantics / browsing / ui / content / ViewpointContribution.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.browsing.ui.content;
13
14 import java.util.Arrays;
15 import java.util.Collection;
16 import java.util.Collections;
17
18 import org.simantics.browsing.ui.GraphExplorer;
19 import org.simantics.browsing.ui.NodeContext;
20 import org.simantics.browsing.ui.PrimitiveQueryUpdater;
21 import org.simantics.browsing.ui.Tester;
22
23 /**
24  * TODO: FIX THIS JAVADOC IT IS OUT-OF-DATE
25  * 
26  * A Viewpoint is used for describing the child node generation of a single UI
27  * (e.g. tree) node. Viewpoints are created on a per UI node basis, including
28  * the invisible root input of provided to
29  * {@link GraphExplorer#setRoot(Object)}. Viewpoints are created by
30  * {@link ViewpointFactory}s.
31  * 
32  * <p>
33  * A Viewpoint is responsible for informing of any changes happening in the set
34  * of children provided by it. Updates are performed using the
35  * {@link PrimitiveQueryUpdater} received by the {@link ViewpointFactory} that
36  * created the Viewpoint. To signal that the set of children has (possibly)
37  * changed, invoke
38  * {@link PrimitiveQueryUpdater#scheduleReplace(NodeContext, org.simantics.browsing.ui.NodeContext.PrimitiveQueryKey, Object)}
39  * and eventually the query system will re-request the viewpoint for the new
40  * children.
41  * </p>
42  * 
43  * @author Antti Villberg
44  * 
45  * @see ViewpointStub
46  */
47 public interface ViewpointContribution {
48
49     /**
50      * Implementers can use this collection as a return value of
51      * {@link #getContribution()} when the contribution implementation is
52      * asynchronous and the real result will be updated later.
53      * 
54      * <p>
55      * It is purposefully a different instance than {@link #NO_CONTRIBUTION}.
56      */
57     Collection<NodeContext> PENDING_CONTRIBUTION = Arrays.asList();
58
59     /**
60      * Return this from {@link #getContribution()} to indicate that no viewpoint
61      * contributions are available.
62      */
63     Collection<NodeContext> NO_CONTRIBUTION      = Collections.emptyList();
64
65     /**
66      * @return a collection of contributions, must not be <code>null</code>
67      */
68     Collection<NodeContext> getContribution();
69
70     /**
71      * @return <code>null</code> if there is no tester
72      */
73     Tester getNodeContextTester();
74
75     Class<?> getInputClass();
76     
77 }