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
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.browsing.ui.content;
\r
14 import java.util.Arrays;
\r
15 import java.util.Collection;
\r
16 import java.util.Collections;
\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
24 * TODO: FIX THIS JAVADOC IT IS OUT-OF-DATE
\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
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
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
43 * @author Antti Villberg
\r
45 * @see ViewpointStub
\r
47 public interface ViewpointContribution {
\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
55 * It is purposefully a different instance than {@link #NO_CONTRIBUTION}.
\r
57 Collection<NodeContext> PENDING_CONTRIBUTION = Arrays.asList();
\r
60 * Return this from {@link #getContribution()} to indicate that no viewpoint
\r
61 * contributions are available.
\r
63 Collection<NodeContext> NO_CONTRIBUTION = Collections.emptyList();
\r
66 * @return a collection of contributions, must not be <code>null</code>
\r
68 Collection<NodeContext> getContribution();
\r
71 * @return <code>null</code> if there is no tester
\r
73 Tester getNodeContextTester();
\r
75 Class<?> getInputClass();
\r