KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > wml > dom > WMLElementImpl


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

16 package org.apache.wml.dom;
17
18 import org.apache.xerces.dom.ElementImpl;
19 import org.apache.wml.*;
20
21 /**
22  * @xerces.internal
23  * @version $Id: WMLElementImpl.java,v 1.4 2005/04/17 23:37:49 mrglavas Exp $
24  * @author <a HREF="mailto:david@topware.com.tw">David Li</a>
25  */

26 public class WMLElementImpl extends ElementImpl implements WMLElement {
27     
28     private static final long serialVersionUID = 3689631376446338103L;
29     
30     public WMLElementImpl (WMLDocumentImpl owner, String JavaDoc tagName) {
31         super(owner, tagName);
32     }
33     
34     public void setClassName(String JavaDoc newValue) {
35         setAttribute("class", newValue);
36     }
37     
38     public String JavaDoc getClassName() {
39         return getAttribute("class");
40     }
41     
42     public void setXmlLang(String JavaDoc newValue) {
43         setAttribute("xml:lang", newValue);
44     }
45     
46     public String JavaDoc getXmlLang() {
47         return getAttribute("xml:lang");
48     }
49     
50     public void setId(String JavaDoc newValue) {
51         setAttribute("id", newValue);
52     }
53     
54     public String JavaDoc getId() {
55         return getAttribute("id");
56     }
57     
58     void setAttribute(String JavaDoc attr, boolean value) {
59         setAttribute(attr, value ? "true" : "false");
60     }
61     
62     boolean getAttribute(String JavaDoc attr, boolean defaultValue) {
63         boolean ret = defaultValue;
64         String JavaDoc value;
65         if (((value = getAttribute("emptyok")) != null)
66                 && value.equals("true"))
67             ret = true;
68         return ret;
69     }
70     
71     void setAttribute(String JavaDoc attr, int value) {
72         setAttribute(attr, value + "");
73     }
74     
75     int getAttribute(String JavaDoc attr, int defaultValue) {
76         int ret = defaultValue;
77         String JavaDoc value;
78         if ((value = getAttribute("emptyok")) != null)
79             ret = Integer.parseInt(value);
80         return ret;
81     }
82 }
83
Popular Tags