KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > w3c > css > sac > DocumentHandler


1 /*
2  * Copyright (c) 1999 World Wide Web Consortium
3  * (Massachusetts Institute of Technology, Institut National de Recherche
4  * en Informatique et en Automatique, Keio University).
5  * All Rights Reserved. http://www.w3.org/Consortium/Legal/
6  *
7  * $Id: DocumentHandler.java,v 1.1.1.1 2003/12/28 21:23:48 davidsch Exp $
8  */

9 package org.w3c.css.sac;
10
11 /**
12  * This is the main interface that most CSS applications implement: if the
13  * application needs to be informed of basic parsing events, it implements this
14  * interface and registers an instance with the CSS parser using the
15  * setCSSHandler method.
16  *
17  * @version $Revision: 1.1.1.1 $
18  * @author Philippe Le Hegaret
19  */

20 public interface DocumentHandler {
21     
22     /**
23      * Receive notification of the beginning of a style sheet.
24      *
25      * The CSS parser will invoke this method only once, before any other
26      * methods in this interface.
27      *
28      * @param uri The URI of the style sheet. @@TODO can be NULL ! (inline style sheet)
29      * @exception CSSException Any CSS exception, possibly wrapping another
30      * exception.
31      */

32     public void startDocument(InputSource source)
33         throws CSSException;
34     
35     /**
36      * Receive notification of the end of a document.
37      *
38      * The CSS parser will invoke this method only once, and it will be the
39      * last method invoked during the parse. The parser shall not invoke this
40      * method until it has either abandoned parsing (because of an
41      * unrecoverable error) or reached the end of input.
42      *
43      * @param uri The URI of the style sheet.
44      * @exception CSSException Any CSS exception, possibly wrapping another
45      * exception.
46      */

47     public void endDocument(InputSource source) throws CSSException;
48
49     /**
50      * Receive notification of a comment.
51      * If the comment appears in a declaration (e.g. color: /* comment * / blue;),
52      * the parser notifies the comment before the declaration.
53      *
54      * @param text The comment.
55      * @exception CSSException Any CSS exception, possibly wrapping another
56      * exception.
57      */

58     public void comment(String JavaDoc text) throws CSSException;
59
60     /**
61      * Receive notification of an unknown rule t-rule not supported by this
62      * parser.
63      *
64      * @param at-rule The complete ignored at-rule.
65      * @exception CSSException Any CSS exception, possibly wrapping another
66      * exception.
67      */

68     public void ignorableAtRule(String JavaDoc atRule) throws CSSException;
69
70     /**
71      * Receive notification of an unknown rule t-rule not supported by this
72      * parser.
73      *
74      * @param prefix <code>null</code> if this is the default namespace
75      * @param uri The URI for this namespace.
76      * @exception CSSException Any CSS exception, possibly wrapping another
77      * exception.
78      */

79     public void namespaceDeclaration(String JavaDoc prefix, String JavaDoc uri)
80     throws CSSException;
81
82     /**
83      * Receive notification of a import statement in the style sheet.
84      *
85      * @param uri The URI of the imported style sheet.
86      * @param media The intended destination media for style information.
87      * @param defaultNamepaceURI The default namespace URI for the imported
88      * style sheet.
89      * @exception CSSException Any CSS exception, possibly wrapping another
90      * exception.
91      */

92     public void importStyle(String JavaDoc uri, SACMediaList media,
93                 String JavaDoc defaultNamespaceURI)
94     throws CSSException;
95
96     /**
97      * Receive notification of the beginning of a media statement.
98      *
99      * The Parser will invoke this method at the beginning of every media
100      * statement in the style sheet. there will be a corresponding endMedia()
101      * event for every startElement() event.
102      *
103      * @param media The intended destination media for style information.
104      * @exception CSSException Any CSS exception, possibly wrapping another
105      * exception.
106      */

107     public void startMedia(SACMediaList media) throws CSSException;
108
109     /**
110      * Receive notification of the end of a media statement.
111      *
112      * @param media The intended destination media for style information.
113      * @exception CSSException Any CSS exception, possibly wrapping another
114      * exception.
115      */

116     public void endMedia(SACMediaList media) throws CSSException;
117
118     /**
119      * Receive notification of the beginning of a page statement.
120      *
121      * The Parser will invoke this method at the beginning of every page
122      * statement in the style sheet. there will be a corresponding endPage()
123      * event for every startPage() event.
124      *
125      * @param name the name of the page (if any, null otherwise)
126      * @param pseudo_page the pseudo page (if any, null otherwise)
127      * @exception CSSException Any CSS exception, possibly wrapping another
128      * exception.
129      */

130     public void startPage(String JavaDoc name, String JavaDoc pseudo_page) throws CSSException;
131
132     /**
133      * Receive notification of the end of a media statement.
134      *
135      * @param media The intended destination medium for style information.
136      * @param pseudo_page the pseudo page (if any, null otherwise)
137      * @exception CSSException Any CSS exception, possibly wrapping another
138      * exception.
139      */

140     public void endPage(String JavaDoc name, String JavaDoc pseudo_page) throws CSSException;
141
142     /**
143      * Receive notification of the beginning of a font face statement.
144      *
145      * The Parser will invoke this method at the beginning of every font face
146      * statement in the style sheet. there will be a corresponding endFontFace()
147      * event for every startFontFace() event.
148      *
149      * @exception CSSException Any CSS exception, possibly wrapping another
150      * exception.
151      */

152     public void startFontFace() throws CSSException;
153
154     /**
155      * Receive notification of the end of a font face statement.
156      *
157      * @exception CSSException Any CSS exception, possibly wrapping another
158      * exception.
159      */

160     public void endFontFace() throws CSSException;
161
162     /**
163      * Receive notification of the beginning of a rule statement.
164      *
165      * @param selectors All intended selectors for all declarations.
166      * @exception CSSException Any CSS exception, possibly wrapping another
167      * exception.
168      */

169     public void startSelector(SelectorList selectors) throws CSSException;
170
171     /**
172      * Receive notification of the end of a rule statement.
173      *
174      * @param selectors All intended selectors for all declarations.
175      * @exception CSSException Any CSS exception, possibly wrapping another
176      * exception.
177      */

178     public void endSelector(SelectorList selectors) throws CSSException;
179
180     /**
181      * Receive notification of a declaration.
182      *
183      * @param name the name of the property.
184      * @param value the value of the property. All whitespace are stripped.
185      * @param important is this property important ?
186      * @exception CSSException Any CSS exception, possibly wrapping another
187      * exception.
188      */

189     public void property(String JavaDoc name, LexicalUnit value, boolean important)
190         throws CSSException;
191 }
192
Popular Tags