X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fcontent%2FViewpoint.java;fp=bundles%2Forg.simantics.browsing.ui%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fcontent%2FViewpoint.java;h=374f117a0877cc806bdb5f19389118eaf4f9b11f;hp=0000000000000000000000000000000000000000;hb=969bd23cab98a79ca9101af33334000879fb60c5;hpb=866dba5cd5a3929bbeae85991796acb212338a08 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 index 000000000..374f117a0 --- /dev/null +++ b/bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/content/Viewpoint.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.browsing.ui.content; + +import org.simantics.browsing.ui.GraphExplorer; +import org.simantics.browsing.ui.NodeContext; +import org.simantics.browsing.ui.PrimitiveQueryUpdater; + +/** + * A Viewpoint is used for describing the child node generation of a single UI + * (e.g. tree) node. Viewpoints are created on a per UI node basis, including + * the invisible root input of provided to + * {@link GraphExplorer#setRoot(Object)}. Viewpoints are created by + * {@link ViewpointFactory}s. + * + *

+ * A Viewpoint is responsible for informing of any changes happening in the set + * of children provided by it. Updates are performed using the + * {@link PrimitiveQueryUpdater} received by the {@link ViewpointFactory} that + * created the Viewpoint. To signal that the set of children has (possibly) + * changed, invoke + * {@link PrimitiveQueryUpdater#scheduleReplace(NodeContext, org.simantics.browsing.ui.NodeContext.PrimitiveQueryKey, Object)} + * and eventually the query system will re-request the viewpoint for the new + * children. + *

+ * + * @author Antti Villberg + * + * @see ViewpointStub + */ +public interface Viewpoint { + + static final NodeContext[] PENDING_CHILDREN = {}; + static final Boolean PENDING_HAS_CHILDREN = new Boolean(false); + + /** + * @return an array of child contexts + */ + NodeContext[] getChildren(); + + /** + * @return true if the viewpoint may produce > 0, + * false otherwise. + */ + Boolean getHasChildren(); + +}