001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.html.dom;
018:
019: import org.w3c.dom.html.HTMLInputElement;
020:
021: /**
022: * @xerces.internal
023: * @version $Revision: 447255 $ $Date: 2006-09-18 01:36:42 -0400 (Mon, 18 Sep 2006) $
024: * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
025: * @see org.w3c.dom.html.HTMLInputElement
026: * @see org.apache.xerces.dom.ElementImpl
027: */
028: public class HTMLInputElementImpl extends HTMLElementImpl implements
029: HTMLInputElement, HTMLFormControl {
030:
031: private static final long serialVersionUID = 640139325394332007L;
032:
033: public String getDefaultValue() {
034: // ! NOT FULLY IMPLEMENTED !
035: return getAttribute("defaultValue");
036: }
037:
038: public void setDefaultValue(String defaultValue) {
039: // ! NOT FULLY IMPLEMENTED !
040: setAttribute("defaultValue", defaultValue);
041: }
042:
043: public boolean getDefaultChecked() {
044: // ! NOT FULLY IMPLEMENTED !
045: return getBinary("defaultChecked");
046: }
047:
048: public void setDefaultChecked(boolean defaultChecked) {
049: // ! NOT FULLY IMPLEMENTED !
050: setAttribute("defaultChecked", defaultChecked);
051: }
052:
053: public String getAccept() {
054: return getAttribute("accept");
055: }
056:
057: public void setAccept(String accept) {
058: setAttribute("accept", accept);
059: }
060:
061: public String getAccessKey() {
062: String accessKey;
063:
064: // Make sure that the access key is a single character.
065: accessKey = getAttribute("accesskey");
066: if (accessKey != null && accessKey.length() > 1)
067: accessKey = accessKey.substring(0, 1);
068: return accessKey;
069: }
070:
071: public void setAccessKey(String accessKey) {
072: // Make sure that the access key is a single character.
073: if (accessKey != null && accessKey.length() > 1)
074: accessKey = accessKey.substring(0, 1);
075: setAttribute("accesskey", accessKey);
076: }
077:
078: public String getAlign() {
079: return capitalize(getAttribute("align"));
080: }
081:
082: public void setAlign(String align) {
083: setAttribute("align", align);
084: }
085:
086: public String getAlt() {
087: return getAttribute("alt");
088: }
089:
090: public void setAlt(String alt) {
091: setAttribute("alt", alt);
092: }
093:
094: public boolean getChecked() {
095: return getBinary("checked");
096: }
097:
098: public void setChecked(boolean checked) {
099: setAttribute("checked", checked);
100: }
101:
102: public boolean getDisabled() {
103: return getBinary("disabled");
104: }
105:
106: public void setDisabled(boolean disabled) {
107: setAttribute("disabled", disabled);
108: }
109:
110: public int getMaxLength() {
111: return getInteger(getAttribute("maxlength"));
112: }
113:
114: public void setMaxLength(int maxLength) {
115: setAttribute("maxlength", String.valueOf(maxLength));
116: }
117:
118: public String getName() {
119: return getAttribute("name");
120: }
121:
122: public void setName(String name) {
123: setAttribute("name", name);
124: }
125:
126: public boolean getReadOnly() {
127: return getBinary("readonly");
128: }
129:
130: public void setReadOnly(boolean readOnly) {
131: setAttribute("readonly", readOnly);
132: }
133:
134: public String getSize() {
135: return getAttribute("size");
136: }
137:
138: public void setSize(String size) {
139: setAttribute("size", size);
140: }
141:
142: public String getSrc() {
143: return getAttribute("src");
144: }
145:
146: public void setSrc(String src) {
147: setAttribute("src", src);
148: }
149:
150: public int getTabIndex() {
151: try {
152: return Integer.parseInt(getAttribute("tabindex"));
153: } catch (NumberFormatException except) {
154: return 0;
155: }
156: }
157:
158: public void setTabIndex(int tabIndex) {
159: setAttribute("tabindex", String.valueOf(tabIndex));
160: }
161:
162: public String getType() {
163: return getAttribute("type");
164: }
165:
166: public String getUseMap() {
167: return getAttribute("useMap");
168: }
169:
170: public void setUseMap(String useMap) {
171: setAttribute("useMap", useMap);
172: }
173:
174: public String getValue() {
175: return getAttribute("value");
176: }
177:
178: public void setValue(String value) {
179: setAttribute("value", value);
180: }
181:
182: public void blur() {
183: // No scripting in server-side DOM. This method is moot.
184: }
185:
186: public void focus() {
187: // No scripting in server-side DOM. This method is moot.
188: }
189:
190: public void select() {
191: // No scripting in server-side DOM. This method is moot.
192: }
193:
194: public void click() {
195: // No scripting in server-side DOM. This method is moot.
196: }
197:
198: /**
199: * Constructor requires owner document.
200: *
201: * @param owner The owner HTML document
202: */
203: public HTMLInputElementImpl(HTMLDocumentImpl owner, String name) {
204: super(owner, name);
205: }
206:
207: }
|