KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > steadystate > css > parser > selectors > SelectorFactoryImpl


1 /*
2  * SelectorFactoryImpl.java
3  *
4  * Steady State CSS2 Parser
5  *
6  * Copyright (C) 1999, 2002 Steady State Software Ltd. All rights reserved.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  *
22  * To contact the authors of the library, write to Steady State Software Ltd.,
23  * 49 Littleworth, Wing, Buckinghamshire, LU7 0JX, England
24  *
25  * http://www.steadystate.com/css/
26  * mailto:css@steadystate.co.uk
27  *
28  * $Id: SelectorFactoryImpl.java,v 1.2 2005/04/28 20:57:20 waldbaer Exp $
29  */

30
31 package com.steadystate.css.parser.selectors;
32
33 import org.w3c.css.sac.*;
34
35 public class SelectorFactoryImpl implements SelectorFactory {
36
37     public ConditionalSelector createConditionalSelector(
38         SimpleSelector selector,
39         Condition condition) throws CSSException {
40         return new ConditionalSelectorImpl(selector, condition);
41     }
42
43     public SimpleSelector createAnyNodeSelector() throws CSSException {
44         throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
45     }
46
47     public SimpleSelector createRootNodeSelector() throws CSSException {
48         throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
49     }
50
51     public NegativeSelector createNegativeSelector(SimpleSelector selector)
52         throws CSSException {
53         throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
54     }
55
56     public ElementSelector createElementSelector(String JavaDoc namespaceURI, String JavaDoc localName)
57         throws CSSException {
58         if (namespaceURI != null) {
59             throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
60         }
61         return new ElementSelectorImpl(localName);
62     }
63
64     public CharacterDataSelector createTextNodeSelector(String JavaDoc data)
65         throws CSSException {
66         throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
67     }
68
69     public CharacterDataSelector createCDataSectionSelector(String JavaDoc data)
70         throws CSSException {
71         throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
72     }
73
74     public ProcessingInstructionSelector createProcessingInstructionSelector(
75         String JavaDoc target,
76         String JavaDoc data) throws CSSException {
77         throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
78     }
79
80     public CharacterDataSelector createCommentSelector(String JavaDoc data)
81         throws CSSException {
82         throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
83     }
84
85     public ElementSelector createPseudoElementSelector(
86         String JavaDoc namespaceURI,
87         String JavaDoc pseudoName) throws CSSException {
88         if (namespaceURI != null) {
89             throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
90         }
91         return new PseudoElementSelectorImpl(pseudoName);
92     }
93
94     public DescendantSelector createDescendantSelector(
95         Selector parent,
96         SimpleSelector descendant) throws CSSException {
97         return new DescendantSelectorImpl(parent, descendant);
98     }
99
100     public DescendantSelector createChildSelector(
101         Selector parent,
102         SimpleSelector child) throws CSSException {
103         return new ChildSelectorImpl(parent, child);
104     }
105
106     public SiblingSelector createDirectAdjacentSelector(
107         short nodeType,
108         Selector child,
109         SimpleSelector directAdjacent) throws CSSException {
110         return new DirectAdjacentSelectorImpl(nodeType, child, directAdjacent);
111     }
112 }
113
Popular Tags