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