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