]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/Style.java
d18e623d049eda44b5e7b113024741f22233544e
[simantics/platform.git] / bundles / org.simantics.scenegraph.profile / src / org / simantics / scenegraph / profile / Style.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 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.RequestProcessor;
15 import org.simantics.db.Resource;
16
17 /**
18  * This interface is not intended to be implemented directly. Extend
19  * {@link StyleBase} instead.
20  * 
21  * @see StyleBase
22  * @author Antti Villberg
23  */
24 public interface Style {
25
26     /**
27      * Activates this style. Intended to start tracking the diagram items
28      * contained by the specified group and to request style applications
29      * whenever necessary through the specified profile observer. If a style
30      * instance is already active, re-activation should not do anything. A style
31      * can be re-activated after being deactivated.
32      * 
33      * @param backend
34      * @param runtimeDiagram
35      * @param configuration
36      * @param group
37      * @param observer
38      */
39     void activate(RequestProcessor backend, Resource runtimeDiagram, Resource entry, Group group, EvaluationContext observer);
40
41     /**
42      * Deactivates this style. Intended to stop tracking the currently tracked
43      * group of diagram items and clean the diagram scene graph up by
44      * removing/disabling all scene graph contributions produced by this style.
45      * Deactivating an inactive style does nothing.
46      * 
47      * @param backend
48      * @param runtimeDiagram
49      * @param configuration
50      * @param group
51      * @param observer
52      */
53     void deactivate(Resource runtimeDiagram, Resource entry, Group group, EvaluationContext observer);
54
55     /**
56      * Perform complete re-application of this style on the current set of
57      * observed diagram items.
58      * 
59      * <p>
60      * Must always be invoked from the canvas context thread.
61      * 
62      * @param context the canvas context in which the style is to be applied
63      * @param diagram
64      * @param group
65      * @param observer profile system observer for this canvas context
66      */
67     void apply(Resource entry, Group group, EvaluationContext observer);
68
69 }