KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > html > dom > HTMLFormElementImpl


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.html.dom;
17
18 import org.w3c.dom.Node JavaDoc;
19 import org.w3c.dom.NodeList JavaDoc;
20 import org.w3c.dom.html.HTMLCollection;
21 import org.w3c.dom.html.HTMLFormElement;
22
23 /**
24  * @xerces.internal
25  * @version $Revision: 1.11 $ $Date: 2005/04/18 00:46:04 $
26  * @author <a HREF="mailto:arkin@exoffice.com">Assaf Arkin</a>
27  * @see org.w3c.dom.html.HTMLFormElement
28  * @see org.apache.xerces.dom.ElementImpl
29  */

30 public class HTMLFormElementImpl
31     extends HTMLElementImpl
32     implements HTMLFormElement
33 {
34
35     private static final long serialVersionUID = 3690757284875876658L;
36
37     public HTMLCollection getElements()
38     {
39         if ( _elements == null )
40             _elements = new HTMLCollectionImpl( this, HTMLCollectionImpl.ELEMENT );
41         return _elements;
42     }
43   
44
45     public int getLength()
46     {
47         return getElements().getLength();
48     }
49   
50   
51     public String JavaDoc getName()
52     {
53         return getAttribute( "name" );
54     }
55     
56     
57     public void setName( String JavaDoc name )
58     {
59         setAttribute( "name", name );
60     }
61
62     
63     public String JavaDoc getAcceptCharset()
64     {
65         return getAttribute( "accept-charset" );
66     }
67     
68     
69     public void setAcceptCharset( String JavaDoc acceptCharset )
70     {
71         setAttribute( "accept-charset", acceptCharset );
72     }
73
74   
75       public String JavaDoc getAction()
76     {
77         return getAttribute( "action" );
78     }
79     
80     
81     public void setAction( String JavaDoc action )
82     {
83         setAttribute( "action", action );
84     }
85   
86   
87       public String JavaDoc getEnctype()
88     {
89         return getAttribute( "enctype" );
90     }
91     
92     
93     public void setEnctype( String JavaDoc enctype )
94     {
95         setAttribute( "enctype", enctype );
96     }
97
98     
99       public String JavaDoc getMethod()
100     {
101         return capitalize( getAttribute( "method" ) );
102     }
103     
104     
105     public void setMethod( String JavaDoc method )
106     {
107         setAttribute( "method", method );
108     }
109   
110   
111     public String JavaDoc getTarget()
112     {
113         return getAttribute( "target" );
114     }
115     
116     
117     public void setTarget( String JavaDoc target )
118     {
119         setAttribute( "target", target );
120     }
121
122     
123     public void submit()
124     {
125         // No scripting in server-side DOM. This method is moot.
126
}
127
128     
129     public void reset()
130     {
131         // No scripting in server-side DOM. This method is moot.
132
}
133
134     /*
135      * Explicit implementation of getChildNodes() to avoid problems with
136      * overriding the getLength() method hidden in the super class.
137      */

138     public NodeList JavaDoc getChildNodes() {
139         return getChildNodesUnoptimized();
140     }
141     
142     /**
143      * Explicit implementation of cloneNode() to ensure that cache used
144      * for getElements() gets cleared.
145      */

146     public Node JavaDoc cloneNode( boolean deep ) {
147         HTMLFormElementImpl clonedNode = (HTMLFormElementImpl)super.cloneNode( deep );
148         clonedNode._elements = null;
149         return clonedNode;
150     }
151     
152     /**
153      * Constructor requires owner document.
154      *
155      * @param owner The owner HTML document
156      */

157     public HTMLFormElementImpl( HTMLDocumentImpl owner, String JavaDoc name )
158     {
159         super( owner, name );
160     }
161   
162     
163     /**
164      * Collection of all elements contained in this FORM.
165      */

166     private HTMLCollectionImpl _elements;
167     
168 }
169
170
Popular Tags