X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.browsing.ui.common%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fcommon%2Fviewpoints%2FViewpointStub.java;h=4895d3f75425ed00df79a8703c7656a41e52c18a;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=0e91bb907e14148f71d5a8313e978d1d772f5de0;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.browsing.ui.common/src/org/simantics/browsing/ui/common/viewpoints/ViewpointStub.java b/bundles/org.simantics.browsing.ui.common/src/org/simantics/browsing/ui/common/viewpoints/ViewpointStub.java index 0e91bb907..4895d3f75 100644 --- a/bundles/org.simantics.browsing.ui.common/src/org/simantics/browsing/ui/common/viewpoints/ViewpointStub.java +++ b/bundles/org.simantics.browsing.ui.common/src/org/simantics/browsing/ui/common/viewpoints/ViewpointStub.java @@ -1,123 +1,123 @@ -/******************************************************************************* - * 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.common.viewpoints; - -import java.util.Collection; - -import org.simantics.browsing.ui.BuiltinKeys; -import org.simantics.browsing.ui.NodeContext; -import org.simantics.browsing.ui.PrimitiveQueryUpdater; -import org.simantics.browsing.ui.common.NodeContextBuilder; -import org.simantics.browsing.ui.common.NodeContextUtil; -import org.simantics.browsing.ui.content.Viewpoint; - -/** - * @author Tuukka Lehtonen - */ -public abstract class ViewpointStub implements Viewpoint { - - protected NodeContext[] children = Viewpoint.PENDING_CHILDREN; - protected Boolean hasChildren = Viewpoint.PENDING_HAS_CHILDREN; - - final public void setChildren(PrimitiveQueryUpdater updater, NodeContext[] children) { - if (children == null) - throw new NullPointerException(this + ": null children produced by " + getClass().getName()); - for(NodeContext c : children) updater.incRef(c); - for(NodeContext c : this.children) updater.decRef(c); - this.children = children; - } - - public void setHasChildren(Boolean hasChildren) { - if (children == null) - throw new NullPointerException(this + ": null hasChildren produced by " + getClass().getName()); - this.hasChildren = hasChildren; - } - - /** - * A utility method for transforming an array of objects into an - * INodeContext array which is the return value of a ViewpointFactory. - * - *
- * The INodeContext's are constructed using - * {@link NodeContextBuilder#buildWithInput(Object)}. - *
- * - * @param children - * @return the specified children wrapped into simpleINodeContext
s
- */
- public NodeContext[] toContextsWithInput(Object... children) {
- return NodeContextUtil.toContextsWithInput(children);
- }
-
- /**
- * A utility method for transforming a collection of objects into an
- * INodeContext array which is the return value of a ViewpointFactory.
- *
- * - * The INodeContext's are constructed using - * {@link NodeContextBuilder#buildWithInput(Object)}. - *
- * - * @param children - * @return the specified children wrapped into simpleINodeContext
s
- */
- public NodeContext[] toContextsWithInput(Collection> children) {
- return NodeContextUtil.toContextsWithInput(children);
- }
-
- /**
- * A utility method for transforming a collection of objects into an
- * INodeContext array which is the return value of a ViewpointFactory.
- *
- * - * The INodeContext's are constructed using the specified factory. - *
- * - * @param children - * @return the specified children wrapped into INodeContext's through the - * specifiedfactory
- */
- public NodeContext[] toContexts(Collection> children, NodeContextUtil.NodeContextFactory factory) {
- return NodeContextUtil.toContexts(children, factory);
- }
-
- /**
- * @param null
if input is null
or if the class
- * does not match
- */
- @SuppressWarnings("unchecked")
- protected + * The INodeContext's are constructed using + * {@link NodeContextBuilder#buildWithInput(Object)}. + *
+ * + * @param children + * @return the specified children wrapped into simpleINodeContext
s
+ */
+ public NodeContext[] toContextsWithInput(Object... children) {
+ return NodeContextUtil.toContextsWithInput(children);
+ }
+
+ /**
+ * A utility method for transforming a collection of objects into an
+ * INodeContext array which is the return value of a ViewpointFactory.
+ *
+ * + * The INodeContext's are constructed using + * {@link NodeContextBuilder#buildWithInput(Object)}. + *
+ * + * @param children + * @return the specified children wrapped into simpleINodeContext
s
+ */
+ public NodeContext[] toContextsWithInput(Collection> children) {
+ return NodeContextUtil.toContextsWithInput(children);
+ }
+
+ /**
+ * A utility method for transforming a collection of objects into an
+ * INodeContext array which is the return value of a ViewpointFactory.
+ *
+ * + * The INodeContext's are constructed using the specified factory. + *
+ * + * @param children + * @return the specified children wrapped into INodeContext's through the + * specifiedfactory
+ */
+ public NodeContext[] toContexts(Collection> children, NodeContextUtil.NodeContextFactory factory) {
+ return NodeContextUtil.toContexts(children, factory);
+ }
+
+ /**
+ * @param null
if input is null
or if the class
+ * does not match
+ */
+ @SuppressWarnings("unchecked")
+ protected