]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/content/Viewpoint.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.browsing.ui / src / org / simantics / browsing / ui / content / Viewpoint.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 org.simantics.browsing.ui.GraphExplorer;\r
15 import org.simantics.browsing.ui.NodeContext;\r
16 import org.simantics.browsing.ui.PrimitiveQueryUpdater;\r
17 \r
18 /**\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
24  * \r
25  * <p>\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
30  * changed, invoke\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
33  * children.\r
34  * </p>\r
35  * \r
36  * @author Antti Villberg\r
37  * \r
38  * @see ViewpointStub\r
39  */\r
40 public interface Viewpoint {\r
41 \r
42     static final NodeContext[] PENDING_CHILDREN     = {};\r
43     static final Boolean        PENDING_HAS_CHILDREN = new Boolean(false);\r
44 \r
45     /**\r
46      * @return an array of child contexts\r
47      */\r
48     NodeContext[] getChildren();\r
49 \r
50     /**\r
51      * @return <code>true</code> if the viewpoint <em>may</em> produce > 0,\r
52      *         <code>false</code> otherwise.\r
53      */\r
54     Boolean getHasChildren();\r
55 \r
56 }\r