]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/EvaluationContext.java
Apply profile style only for added / removed items
[simantics/platform.git] / bundles / org.simantics.scenegraph.profile / src / org / simantics / scenegraph / profile / EvaluationContext.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2011 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.scenegraph.profile;
13
14 import org.simantics.db.Resource;
15 import org.simantics.scenegraph.INode;
16 import org.simantics.scenegraph.g2d.G2DSceneGraph;
17
18 /**
19  * @author Antti Villberg
20  * 
21  * @see ProfileKeys
22  */
23 public interface EvaluationContext extends Observer {
24
25     /**
26      * @return the runtime resource this evaluation context is attached to (i.e.
27      *         runtime diagram resource)
28      */
29     Resource getResource();
30
31     /**
32      * @return the scene graph this profile evaluation context is attached to
33      */
34     G2DSceneGraph getSceneGraph();
35
36     /**
37      * Get a constant data item attached to the evaluation context by the
38      * evaluation system.
39      * 
40      * @param key
41      * @return
42      * @see ProfileKeys
43      */
44     <T> T getConstant(String key);
45
46     /**
47      * Get the specified temporary property for the specified node. Temporary
48      * properties are removed between each round of application of currently
49      * active profile entries.
50      * 
51      * @param node node to get the property for
52      * @param key key of property to get
53      * @return <code>null</code> if property is not set for the specified node
54      */
55     <T> T getTemporaryProperty(INode node, String key);
56
57     /**
58      * Set value of temporary property for the evaluation process where this
59      * evaluation context is used. Temporary properties are removed between each
60      * round of application of currently active profile entries.
61      * 
62      * @param node node to set the property for
63      * @param key key of property to set
64      * @param value value of the property to set
65      */
66     <T> void setTemporaryProperty(INode node, String key, T value);
67
68     /**
69      * Get the specified (persistent) property for the specified node. These
70      * properties stay available through the lifetime of the evaluation context
71      * i.e. the lifetime of the runtime diagram it is associated with.
72      * 
73      * @param node node to get the property for
74      * @param key key of property to get
75      * @return <code>null</code> if property is not set for the specified node
76      */
77     <T> T getProperty(INode node, String key);
78
79     /**
80      * Set value of temporary property for the evaluation process where this
81      * evaluation context is used. These properties stay available through the
82      * lifetime of the evaluation context i.e. the lifetime of the runtime
83      * diagram it is associated with.
84      * 
85      * @param node node to set the property for
86      * @param key key of property to set
87      * @param value value of the property to set
88      * @return previous value of property
89      */
90     <T> T setProperty(INode node, String key, T value);
91
92 }