]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/IHintSynchronizer.java
Some enhancements to GraphLayer-related utilities for Diagram layers
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / synchronization / IHintSynchronizer.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.diagram.synchronization;
13
14 import org.simantics.utils.datastructures.hints.IHintObservable;
15 import org.simantics.utils.datastructures.hints.IHintContext.Key;
16
17 /**
18  * A graph synchronizer for hint changes in diagram elements.
19  * 
20  * @author Tuukka Lehtonen
21  * @see ISynchronizationContext
22  * @see SynchronizationHints
23  * @see IModificationQueue
24  * @see IHintObservable
25  */
26 public interface IHintSynchronizer {
27
28     /**
29      * Makes sure the provided observable (element) if properly synchronized into the graph.
30      * 
31      * @param context
32      * @param observable
33      * @return
34      */
35     int synchronize(ISynchronizationContext context, IHintObservable observable);
36
37     /**
38      * @param queue an interface for dispatching modifications (see
39      *        {@link IModification}) for synchronizing the model according to
40      *        the hint changes
41      * @param sender the observable in which the hint has changed
42      * @param key the key of the changed hint
43      * @param oldValue the previous hint value
44      * @param newValue the new hint value, must be non-null
45      * @return <code>true</code> if the modification was processed by this
46      *         synchronizer, <code>false</code> otherwise
47      */
48     boolean hintChanged(ISynchronizationContext context, IHintObservable sender, Key key, Object oldValue, Object newValue);
49
50     /**
51      * @param queue an interface for dispatching modifications (see
52      *        {@link IModification}) for synchronizing the model according to
53      *        the hint changes
54      * @param sender the observable in which the hint has changed
55      * @param key the key of the changed hint
56      * @param oldValue the previous hint value
57      * @return <code>true</code> if the modification was processed by this
58      *         synchronizer, <code>false</code> otherwise
59      */
60     boolean hintRemoved(ISynchronizationContext context, IHintObservable sender, Key key, Object oldValue);
61
62 }