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