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