KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > css > engine > sac > CSSConditionFactory


1 /*
2
3    Copyright 2002-2003 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16
17  */

18 package org.apache.batik.css.engine.sac;
19
20 import org.w3c.css.sac.AttributeCondition;
21 import org.w3c.css.sac.CSSException;
22 import org.w3c.css.sac.CombinatorCondition;
23 import org.w3c.css.sac.Condition;
24 import org.w3c.css.sac.ConditionFactory;
25 import org.w3c.css.sac.ContentCondition;
26 import org.w3c.css.sac.LangCondition;
27 import org.w3c.css.sac.NegativeCondition;
28 import org.w3c.css.sac.PositionalCondition;
29
30
31 /**
32  * This class provides an implementation of the
33  * {@link org.w3c.css.sac.ConditionFactory} interface.
34  *
35  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
36  * @version $Id: CSSConditionFactory.java,v 1.5 2004/08/18 07:12:51 vhardy Exp $
37  */

38 public class CSSConditionFactory implements ConditionFactory {
39
40     /**
41      * The class attribute namespace URI.
42      */

43     protected String JavaDoc classNamespaceURI;
44
45     /**
46      * The class attribute local name.
47      */

48     protected String JavaDoc classLocalName;
49     
50     /**
51      * The id attribute namespace URI.
52      */

53     protected String JavaDoc idNamespaceURI;
54
55     /**
56      * The id attribute local name.
57      */

58     protected String JavaDoc idLocalName;
59     
60     /**
61      * Creates a new condition factory.
62      */

63     public CSSConditionFactory(String JavaDoc cns, String JavaDoc cln,
64                                String JavaDoc idns, String JavaDoc idln) {
65         classNamespaceURI = cns;
66         classLocalName = cln;
67         idNamespaceURI = idns;
68         idLocalName = idln;
69     }
70
71     /**
72      * <b>SAC</b>: Implements {@link
73      * ConditionFactory#createAndCondition(Condition,Condition)}.
74      */

75     public CombinatorCondition createAndCondition(Condition first,
76                                                   Condition second)
77     throws CSSException {
78     return new CSSAndCondition(first, second);
79     }
80
81     /**
82      * <b>SAC</b>: Implements {@link
83      * ConditionFactory#createOrCondition(Condition,Condition)}.
84      */

85     public CombinatorCondition createOrCondition(Condition first,
86                                                  Condition second)
87     throws CSSException {
88     throw new CSSException("Not implemented in CSS2");
89     }
90
91     /**
92      * <b>SAC</b>: Implements {@link
93      * org.w3c.css.sac.ConditionFactory#createNegativeCondition(Condition)}.
94      */

95     public NegativeCondition createNegativeCondition(Condition condition)
96     throws CSSException {
97     throw new CSSException("Not implemented in CSS2");
98     }
99
100     /**
101      * <b>SAC</b>: Implements {@link
102      * ConditionFactory#createPositionalCondition(int,boolean,boolean)}.
103      */

104     public PositionalCondition createPositionalCondition(int position,
105                              boolean typeNode,
106                              boolean type)
107     throws CSSException {
108     throw new CSSException("Not implemented in CSS2");
109     }
110     
111     /**
112      * <b>SAC</b>: Implements {@link
113      *ConditionFactory#createAttributeCondition(String,String,boolean,String)}.
114      */

115     public AttributeCondition createAttributeCondition(String JavaDoc localName,
116                                String JavaDoc namespaceURI,
117                                boolean specified,
118                                String JavaDoc value)
119     throws CSSException {
120     return new CSSAttributeCondition(localName, namespaceURI, specified,
121                                            value);
122     }
123
124     /**
125      * <b>SAC</b>: Implements {@link
126      * org.w3c.css.sac.ConditionFactory#createIdCondition(String)}.
127      */

128     public AttributeCondition createIdCondition(String JavaDoc value)
129         throws CSSException {
130     return new CSSIdCondition(idNamespaceURI, idLocalName, value);
131     }
132
133     /**
134      * <b>SAC</b>: Implements {@link
135      * org.w3c.css.sac.ConditionFactory#createLangCondition(String)}.
136      */

137     public LangCondition createLangCondition(String JavaDoc lang) throws CSSException {
138     return new CSSLangCondition(lang);
139     }
140
141     /**
142      * <b>SAC</b>: Implements {@link
143  ConditionFactory#createOneOfAttributeCondition(String,String,boolean,String)}.
144      */

145     public AttributeCondition createOneOfAttributeCondition(String JavaDoc localName,
146                                 String JavaDoc nsURI,
147                                 boolean specified,
148                                 String JavaDoc value)
149     throws CSSException {
150     return new CSSOneOfAttributeCondition(localName, nsURI, specified,
151                                                 value);
152     }
153
154     /**
155      * <b>SAC</b>: Implements {@link
156      * ConditionFactory#createBeginHyphenAttributeCondition(String,String,boolean,String)}.
157      */

158     public AttributeCondition createBeginHyphenAttributeCondition
159         (String JavaDoc localName,
160          String JavaDoc namespaceURI,
161          boolean specified,
162          String JavaDoc value)
163     throws CSSException {
164     return new CSSBeginHyphenAttributeCondition
165         (localName, namespaceURI, specified, value);
166     }
167
168     /**
169      * <b>SAC</b>: Implements {@link
170      * org.w3c.css.sac.ConditionFactory#createClassCondition(String,String)}.
171      */

172     public AttributeCondition createClassCondition(String JavaDoc namespaceURI,
173                            String JavaDoc value)
174     throws CSSException {
175     return new CSSClassCondition(classLocalName, classNamespaceURI, value);
176     }
177
178     /**
179      * <b>SAC</b>: Implements {@link
180      * ConditionFactory#createPseudoClassCondition(String,String)}.
181      */

182     public AttributeCondition createPseudoClassCondition(String JavaDoc namespaceURI,
183                              String JavaDoc value)
184     throws CSSException {
185     return new CSSPseudoClassCondition(namespaceURI, value);
186     }
187
188     /**
189      * <b>SAC</b>: Implements {@link
190      * org.w3c.css.sac.ConditionFactory#createOnlyChildCondition()}.
191      */

192     public Condition createOnlyChildCondition() throws CSSException {
193     throw new CSSException("Not implemented in CSS2");
194     }
195
196     /**
197      * <b>SAC</b>: Implements {@link
198      * org.w3c.css.sac.ConditionFactory#createOnlyTypeCondition()}.
199      */

200     public Condition createOnlyTypeCondition() throws CSSException {
201     throw new CSSException("Not implemented in CSS2");
202     }
203
204     /**
205      * <b>SAC</b>: Implements {@link
206      * org.w3c.css.sac.ConditionFactory#createContentCondition(String)}.
207      */

208     public ContentCondition createContentCondition(String JavaDoc data)
209         throws CSSException {
210     throw new CSSException("Not implemented in CSS2");
211     }
212 }
213
Popular Tags