]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - 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
diff --git a/bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/content/Viewpoint.java b/bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/content/Viewpoint.java
new file mode 100644 (file)
index 0000000..374f117
--- /dev/null
@@ -0,0 +1,56 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.browsing.ui.content;\r
+\r
+import org.simantics.browsing.ui.GraphExplorer;\r
+import org.simantics.browsing.ui.NodeContext;\r
+import org.simantics.browsing.ui.PrimitiveQueryUpdater;\r
+\r
+/**\r
+ * A Viewpoint is used for describing the child node generation of a single UI\r
+ * (e.g. tree) node. Viewpoints are created on a per UI node basis, including\r
+ * the invisible root input of provided to\r
+ * {@link GraphExplorer#setRoot(Object)}. Viewpoints are created by\r
+ * {@link ViewpointFactory}s.\r
+ * \r
+ * <p>\r
+ * A Viewpoint is responsible for informing of any changes happening in the set\r
+ * of children provided by it. Updates are performed using the\r
+ * {@link PrimitiveQueryUpdater} received by the {@link ViewpointFactory} that\r
+ * created the Viewpoint. To signal that the set of children has (possibly)\r
+ * changed, invoke\r
+ * {@link PrimitiveQueryUpdater#scheduleReplace(NodeContext, org.simantics.browsing.ui.NodeContext.PrimitiveQueryKey, Object)}\r
+ * and eventually the query system will re-request the viewpoint for the new\r
+ * children.\r
+ * </p>\r
+ * \r
+ * @author Antti Villberg\r
+ * \r
+ * @see ViewpointStub\r
+ */\r
+public interface Viewpoint {\r
+\r
+    static final NodeContext[] PENDING_CHILDREN     = {};\r
+    static final Boolean        PENDING_HAS_CHILDREN = new Boolean(false);\r
+\r
+    /**\r
+     * @return an array of child contexts\r
+     */\r
+    NodeContext[] getChildren();\r
+\r
+    /**\r
+     * @return <code>true</code> if the viewpoint <em>may</em> produce > 0,\r
+     *         <code>false</code> otherwise.\r
+     */\r
+    Boolean getHasChildren();\r
+\r
+}\r