View Javadoc

1   /*
2    * Created on Aug 13, 2005. Copyright 1999-2006 Faculty of Mathematics, Physics
3    * and Informatics, Comenius University, Bratislava. This file is protected by
4    * the Mozilla Public License version 1.1 (the "License"); you may not use this
5    * file except in compliance with the License. You may obtain a copy of the
6    * License at http://euromath2.sourceforge.net/license.html Unless required by
7    * applicable law or agreed to in writing, software distributed under the
8    * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
9    * OF ANY KIND, either express or implied. See the License for the specific
10   * language governing permissions and limitations under the License.
11   */
12  package sk.uniba.euromath.gene;
13  import java.util.Map;
14  import java.util.Set;
15  
16  import sk.baka.xml.gene.CoordinatorInputKey;
17  import sk.uniba.euromath.editor.EditorException;
18  import sk.uniba.euromath.gene.GeneDataProvider.RendererSite;
19  /***
20   * Receives data and renderers from GENE.
21   * @author Martin Vysny
22   */
23  public interface IEditorDataReceiver {
24  	/***
25  	 * Initializes the receiver. Called only once.
26  	 */
27  	public void initReceiver();
28  	/***
29  	 * <p>
30  	 * Editor site instance receives data change events using this method.
31  	 * </p>
32  	 * <p>
33  	 * Parameters must NOT be changed. For more info on the parameters see
34  	 * {@link GeneDataProvider} class.
35  	 * </p>
36  	 * @param rendererKeys Maps input pipe ID to a renderer instance. Shows
37  	 * current state - keys recently deleted (keys present in the
38  	 * <code>deletedKeys</code> set) are not present.
39  	 * @param rootKey The root key of the hierarchy. It is not expected to be
40  	 * changed between <code>dataChanged</code> calls, only in extreme
41  	 * situation when whole document is scraped and recreated.
42  	 * @param nametreeHierarchy The nametree (key) hierarchy. Maps key to a set
43  	 * of its children. If key is missing from the map, maps to
44  	 * <code>null</code> value or an empty set then the nametree does not have
45  	 * any children. Shows current state - keys recently deleted (keys present
46  	 * in the <code>deletedKeys</code> set) are not present.
47  	 * @param geneIdMapping Maps GENE-generated ids to the coordinator input key
48  	 * instance. Used by renderer context to map from GENE id (provided to the
49  	 * renderer) to child renderer instance. Shows current state - keys recently
50  	 * deleted (keys present in the <code>deletedKeys</code> set) are not
51  	 * present.
52  	 * @param newKeys Contains set of new keys (keys that were not introduced in
53  	 * previous GENE output processing).
54  	 * @param deletedKeys Contains set of keys that were introduced in previous
55  	 * GENE output processing but they are missing in current data.
56  	 * @throws EditorException if fatal exception occurs. Editor errors should
57  	 * be handled by the receiver properly (for example by replacing the editor
58  	 * canvas with an Error banner).
59  	 */
60  	public void dataChanged(
61  			Map<CoordinatorInputKey, RendererSite> rendererKeys,
62  			CoordinatorInputKey rootKey,
63  			Map<CoordinatorInputKey, Set<CoordinatorInputKey>> nametreeHierarchy,
64  			Map<String, CoordinatorInputKey> geneIdMapping,
65  			Set<CoordinatorInputKey> newKeys,
66  			Set<CoordinatorInputKey> deletedKeys) throws EditorException;
67  }