|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 #include "nsIRDFResource.idl" |
|
8 #include "nsIRDFNode.idl" |
|
9 |
|
10 interface nsIRDFDataSource; |
|
11 |
|
12 // An nsIRDFObserver object is an observer that will be notified |
|
13 // when assertions are made or removed from a datasource |
|
14 [scriptable, uuid(3CC75360-484A-11D2-BC16-00805F912FE7)] |
|
15 interface nsIRDFObserver : nsISupports { |
|
16 /** |
|
17 * This method is called whenever a new assertion is made |
|
18 * in the data source |
|
19 * @param aDataSource the datasource that is issuing |
|
20 * the notification. |
|
21 * @param aSource the subject of the assertion |
|
22 * @param aProperty the predicate of the assertion |
|
23 * @param aTarget the object of the assertion |
|
24 */ |
|
25 void onAssert(in nsIRDFDataSource aDataSource, |
|
26 in nsIRDFResource aSource, |
|
27 in nsIRDFResource aProperty, |
|
28 in nsIRDFNode aTarget); |
|
29 |
|
30 /** |
|
31 * This method is called whenever an assertion is removed |
|
32 * from the data source |
|
33 * @param aDataSource the datasource that is issuing |
|
34 * the notification. |
|
35 * @param aSource the subject of the assertion |
|
36 * @param aProperty the predicate of the assertion |
|
37 * @param aTarget the object of the assertion |
|
38 */ |
|
39 void onUnassert(in nsIRDFDataSource aDataSource, |
|
40 in nsIRDFResource aSource, |
|
41 in nsIRDFResource aProperty, |
|
42 in nsIRDFNode aTarget); |
|
43 |
|
44 /** |
|
45 * This method is called when the object of an assertion |
|
46 * changes from one value to another. |
|
47 * @param aDataSource the datasource that is issuing |
|
48 * the notification. |
|
49 * @param aSource the subject of the assertion |
|
50 * @param aProperty the predicate of the assertion |
|
51 * @param aOldTarget the old object of the assertion |
|
52 * @param aNewTarget the new object of the assertion |
|
53 */ |
|
54 void onChange(in nsIRDFDataSource aDataSource, |
|
55 in nsIRDFResource aSource, |
|
56 in nsIRDFResource aProperty, |
|
57 in nsIRDFNode aOldTarget, |
|
58 in nsIRDFNode aNewTarget); |
|
59 |
|
60 /** |
|
61 * This method is called when the subject of an assertion |
|
62 * changes from one value to another. |
|
63 * @param aDataSource the datasource that is issuing |
|
64 * the notification. |
|
65 * @param aOldSource the old subject of the assertion |
|
66 * @param aNewSource the new subject of the assertion |
|
67 * @param aProperty the predicate of the assertion |
|
68 * @param aTarget the object of the assertion |
|
69 */ |
|
70 void onMove(in nsIRDFDataSource aDataSource, |
|
71 in nsIRDFResource aOldSource, |
|
72 in nsIRDFResource aNewSource, |
|
73 in nsIRDFResource aProperty, |
|
74 in nsIRDFNode aTarget); |
|
75 |
|
76 /** |
|
77 * This method is called when a datasource is about to |
|
78 * send several notifications at once. The observer can |
|
79 * use this as a cue to optimize its behavior. The observer |
|
80 * can expect the datasource to call endUpdateBatch() when |
|
81 * the group of notifications has completed. |
|
82 * @param aDataSource the datasource that is going to |
|
83 * be issuing the notifications. |
|
84 */ |
|
85 void onBeginUpdateBatch(in nsIRDFDataSource aDataSource); |
|
86 |
|
87 /** |
|
88 * This method is called when a datasource has completed |
|
89 * issuing a notification group. |
|
90 * @param aDataSource the datasource that has finished |
|
91 * issuing a group of notifications |
|
92 */ |
|
93 void onEndUpdateBatch(in nsIRDFDataSource aDataSource); |
|
94 }; |