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 org.simantics.browsing.ui.GraphExplorer;
\r
15 import org.simantics.browsing.ui.NodeContext;
\r
16 import org.simantics.browsing.ui.PrimitiveQueryUpdater;
\r
19 * A Viewpoint is used for describing the child node generation of a single UI
\r
20 * (e.g. tree) node. Viewpoints are created on a per UI node basis, including
\r
21 * the invisible root input of provided to
\r
22 * {@link GraphExplorer#setRoot(Object)}. Viewpoints are created by
\r
23 * {@link ViewpointFactory}s.
\r
26 * A Viewpoint is responsible for informing of any changes happening in the set
\r
27 * of children provided by it. Updates are performed using the
\r
28 * {@link PrimitiveQueryUpdater} received by the {@link ViewpointFactory} that
\r
29 * created the Viewpoint. To signal that the set of children has (possibly)
\r
31 * {@link PrimitiveQueryUpdater#scheduleReplace(NodeContext, org.simantics.browsing.ui.NodeContext.PrimitiveQueryKey, Object)}
\r
32 * and eventually the query system will re-request the viewpoint for the new
\r
36 * @author Antti Villberg
\r
38 * @see ViewpointStub
\r
40 public interface Viewpoint {
\r
42 static final NodeContext[] PENDING_CHILDREN = {};
\r
43 static final Boolean PENDING_HAS_CHILDREN = new Boolean(false);
\r
46 * @return an array of child contexts
\r
48 NodeContext[] getChildren();
\r
51 * @return <code>true</code> if the viewpoint <em>may</em> produce > 0,
\r
52 * <code>false</code> otherwise.
\r
54 Boolean getHasChildren();
\r