KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > css > parser > DefaultConditionFactory


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.parser;
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: DefaultConditionFactory.java,v 1.4 2004/08/18 07:13:02 vhardy Exp $
37  */

38
39 public class DefaultConditionFactory implements ConditionFactory {
40
41     /**
42      * The instance of this class.
43      */

44     public final static ConditionFactory INSTANCE =
45         new DefaultConditionFactory();
46
47     /**
48      * This class does not need to be instantiated.
49      */

50     protected DefaultConditionFactory() {
51     }
52
53     /**
54      * <b>SAC</b>: Implements {@link
55      * ConditionFactory#createAndCondition(Condition,Condition)}.
56      */

57     public CombinatorCondition createAndCondition(Condition first,
58                                                   Condition second)
59     throws CSSException {
60     return new DefaultAndCondition(first, second);
61     }
62
63     /**
64      * <b>SAC</b>: Implements {@link
65      * ConditionFactory#createOrCondition(Condition,Condition)}.
66      */

67     public CombinatorCondition createOrCondition(Condition first,
68                                                  Condition second)
69     throws CSSException {
70     throw new CSSException("Not implemented in CSS2");
71     }
72
73     /**
74      * <b>SAC</b>: Implements {@link
75      * org.w3c.css.sac.ConditionFactory#createNegativeCondition(Condition)}.
76      */

77     public NegativeCondition createNegativeCondition(Condition condition)
78     throws CSSException {
79     throw new CSSException("Not implemented in CSS2");
80     }
81
82     /**
83      * <b>SAC</b>: Implements {@link
84      * ConditionFactory#createPositionalCondition(int,boolean,boolean)}.
85      */

86     public PositionalCondition createPositionalCondition(int position,
87                              boolean typeNode,
88                              boolean type)
89     throws CSSException {
90     throw new CSSException("Not implemented in CSS2");
91     }
92     
93     /**
94      * <b>SAC</b>: Implements {@link
95      *ConditionFactory#createAttributeCondition(String,String,boolean,String)}.
96      */

97     public AttributeCondition createAttributeCondition(String JavaDoc localName,
98                                String JavaDoc namespaceURI,
99                                boolean specified,
100                                String JavaDoc value)
101     throws CSSException {
102     return new DefaultAttributeCondition(localName, namespaceURI,
103                                              specified, value);
104     }
105
106     /**
107      * <b>SAC</b>: Implements {@link
108      * org.w3c.css.sac.ConditionFactory#createIdCondition(String)}.
109      */

110     public AttributeCondition createIdCondition(String JavaDoc value)
111         throws CSSException {
112     return new DefaultIdCondition(value);
113     }
114
115     /**
116      * <b>SAC</b>: Implements {@link
117      * org.w3c.css.sac.ConditionFactory#createLangCondition(String)}.
118      */

119     public LangCondition createLangCondition(String JavaDoc lang) throws CSSException {
120     return new DefaultLangCondition(lang);
121     }
122
123     /**
124      * <b>SAC</b>: Implements {@link
125  ConditionFactory#createOneOfAttributeCondition(String,String,boolean,String)}.
126      */

127     public AttributeCondition createOneOfAttributeCondition(String JavaDoc localName,
128                                 String JavaDoc nsURI,
129                                 boolean specified,
130                                 String JavaDoc value)
131     throws CSSException {
132     return new DefaultOneOfAttributeCondition(localName, nsURI, specified,
133                                                 value);
134     }
135
136     /**
137      * <b>SAC</b>: Implements {@link
138      * ConditionFactory#createBeginHyphenAttributeCondition(String,String,boolean,String)}.
139      */

140     public AttributeCondition createBeginHyphenAttributeCondition
141         (String JavaDoc localName,
142          String JavaDoc namespaceURI,
143          boolean specified,
144          String JavaDoc value)
145     throws CSSException {
146     return new DefaultBeginHyphenAttributeCondition
147         (localName, namespaceURI, specified, value);
148     }
149
150     /**
151      * <b>SAC</b>: Implements {@link
152      * org.w3c.css.sac.ConditionFactory#createClassCondition(String,String)}.
153      */

154     public AttributeCondition createClassCondition(String JavaDoc namespaceURI,
155                            String JavaDoc value)
156     throws CSSException {
157     return new DefaultClassCondition(namespaceURI, value);
158     }
159
160     /**
161      * <b>SAC</b>: Implements {@link
162      * ConditionFactory#createPseudoClassCondition(String,String)}.
163      */

164     public AttributeCondition createPseudoClassCondition(String JavaDoc namespaceURI,
165                              String JavaDoc value)
166     throws CSSException {
167     return new DefaultPseudoClassCondition(namespaceURI, value);
168     }
169
170     /**
171      * <b>SAC</b>: Implements {@link
172      * org.w3c.css.sac.ConditionFactory#createOnlyChildCondition()}.
173      */

174     public Condition createOnlyChildCondition() throws CSSException {
175     throw new CSSException("Not implemented in CSS2");
176     }
177
178     /**
179      * <b>SAC</b>: Implements {@link
180      * org.w3c.css.sac.ConditionFactory#createOnlyTypeCondition()}.
181      */

182     public Condition createOnlyTypeCondition() throws CSSException {
183     throw new CSSException("Not implemented in CSS2");
184     }
185
186     /**
187      * <b>SAC</b>: Implements {@link
188      * org.w3c.css.sac.ConditionFactory#createContentCondition(String)}.
189      */

190     public ContentCondition createContentCondition(String JavaDoc data)
191         throws CSSException {
192     throw new CSSException("Not implemented in CSS2");
193     }
194 }
195
Popular Tags