X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.common%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fcommon%2FEvaluatorData.java;fp=bundles%2Forg.simantics.browsing.ui.common%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fcommon%2FEvaluatorData.java;h=e5e0a3e7cf554d53046f52944de76cd9221501dc;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.browsing.ui.common/src/org/simantics/browsing/ui/common/EvaluatorData.java b/bundles/org.simantics.browsing.ui.common/src/org/simantics/browsing/ui/common/EvaluatorData.java new file mode 100644 index 000000000..e5e0a3e7c --- /dev/null +++ b/bundles/org.simantics.browsing.ui.common/src/org/simantics/browsing/ui/common/EvaluatorData.java @@ -0,0 +1,220 @@ +/******************************************************************************* + * 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; + +import java.util.Collection; + +import org.simantics.browsing.ui.GraphExplorer; +import org.simantics.browsing.ui.NodeContext; +import org.simantics.browsing.ui.Tester; +import org.simantics.browsing.ui.content.CheckedStateFactory; +import org.simantics.browsing.ui.content.ComparableContextFactory; +import org.simantics.browsing.ui.content.ImageDecoratorFactory; +import org.simantics.browsing.ui.content.ImagerFactory; +import org.simantics.browsing.ui.content.LabelDecoratorFactory; +import org.simantics.browsing.ui.content.LabelerFactory; +import org.simantics.browsing.ui.content.ViewpointFactory; +import org.simantics.utils.datastructures.ComparatorFactory; + +/** + * An interface for retrieving a collection of {@link Evaluator}s based on any + * input object ({@link #get(Object)}. + * + *
+ * {@link EvaluatorDataImpl} is the default class-based concrete implementation of + * this interface that clients can and should use. + *
+ * + * @see Evaluator + * @see EvaluatorDataImpl + */ +public interface EvaluatorData { + + /** + * A transformer from one input object to another. The idea is that before + * resolving an Evaluator for an input object, all possible input + * transformations have been executed. + * + *+ * Consider classes A and B which have are of a separate inheritance + * hierarchy and share no common interfaces. In principle, this mechanism + * should allow clients to define evaluators for class B, define a + * transformer from class A to B and give input objects of class A, and + * evaluator for class B would get resolved for these inputs. + *
+ * + * NOTE: this mechanism is not in use yet. + * + */ + public interface Transformer { + Object transform(Object source); + } + + /** + * An evaluator describes available ways of + *+ * The factory tree structure allows optimization of factory resolution when + * there are lots of factories available. By grouping factories under tree + * nodes with a suitable tester allows more efficient result calculation. + * + *
+ * Should not be created directly. Use
+ *
+ * The resolution of "possible evaluators" can be based on, e.g. Class
+ * comparison, Evaluator.add*Branch(Tester)
to create new evaluation tree
+ * branches.
+ *
+ * @param eval
for any input
+ * object that is an instance of clazz
.
+ *
+ * @param clazz
+ * @param eval
+ */
+ void addEvaluator(Class> clazz, Evaluator eval);
+
+ /**
+ * Attempts to get a collection of possible Evaluator
instances
+ * for the specified input object.
+ *
+ * instanceof
queries or adaptation through
+ * Eclipse's IAdaptable
interface.
+ * Evaluator
could be found
+ * to take care of the specified kind of input
+ */
+ Collection