KickJava   Java API By Example, From Geeks To Geeks.

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


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
21 /**
22  * This class provides an implementation of the
23  * {@link org.w3c.css.sac.AttributeCondition} interface.
24  *
25  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
26  * @version $Id: DefaultAttributeCondition.java,v 1.4 2004/08/18 07:13:02 vhardy Exp $
27  */

28 public class DefaultAttributeCondition extends AbstractAttributeCondition {
29
30     /**
31      * The attribute's local name.
32      */

33     protected String JavaDoc localName;
34
35     /**
36      * The attribute's namespace URI.
37      */

38     protected String JavaDoc namespaceURI;
39
40     /**
41      * Whether this condition applies to specified attributes.
42      */

43     protected boolean specified;
44
45     /**
46      * Creates a new DefaultAttributeCondition object.
47      */

48     public DefaultAttributeCondition(String JavaDoc localName,
49                                      String JavaDoc namespaceURI,
50                                      boolean specified,
51                                      String JavaDoc value) {
52     super(value);
53     this.localName = localName;
54     this.namespaceURI = namespaceURI;
55     this.specified = specified;
56     }
57
58     /**
59      * <b>SAC</b>: Implements {@link
60      * org.w3c.css.sac.Condition#getConditionType()}.
61      */

62     public short getConditionType() {
63     return SAC_ATTRIBUTE_CONDITION;
64     }
65     
66     /**
67      * <b>SAC</b>: Implements {@link
68      * org.w3c.css.sac.AttributeCondition#getNamespaceURI()}.
69      */

70     public String JavaDoc getNamespaceURI() {
71     return namespaceURI;
72     }
73
74     /**
75      * <b>SAC</b>: Implements {@link
76      * org.w3c.css.sac.AttributeCondition#getLocalName()}.
77      */

78     public String JavaDoc getLocalName() {
79     return localName;
80     }
81
82     /**
83      * <b>SAC</b>: Implements {@link
84      * org.w3c.css.sac.AttributeCondition#getSpecified()}.
85      */

86     public boolean getSpecified() {
87     return specified;
88     }
89
90     /**
91      * Returns a text representation of this object.
92      */

93     public String JavaDoc toString() {
94     if (value == null) {
95         return "[" + localName + "]";
96     }
97     return "[" + localName + "=\"" + value + "\"]";
98     }
99 }
100
Popular Tags