001: /**
002: * org/ozone-db/xml/dom/html/HTMLInputElementImpl.java
003: *
004: * The contents of this file are subject to the OpenXML Public
005: * License Version 1.0; you may not use this file except in compliance
006: * with the License. You may obtain a copy of the License at
007: * http://www.openxml.org/license.html
008: *
009: * THIS SOFTWARE IS DISTRIBUTED ON AN "AS IS" BASIS WITHOUT WARRANTY
010: * OF ANY KIND, EITHER EXPRESSED OR IMPLIED. THE INITIAL DEVELOPER
011: * AND ALL CONTRIBUTORS SHALL NOT BE LIABLE FOR ANY DAMAGES AS A
012: * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
013: * DERIVATIVES. SEE THE LICENSE FOR THE SPECIFIC LANGUAGE GOVERNING
014: * RIGHTS AND LIMITATIONS UNDER THE LICENSE.
015: *
016: * The Initial Developer of this code under the License is Assaf Arkin.
017: * Portions created by Assaf Arkin are Copyright (C) 1998, 1999.
018: * All Rights Reserved.
019: */package org.ozoneDB.xml.dom.html;
020:
021: import org.ozoneDB.xml.dom.*;
022: import org.w3c.dom.*;
023: import org.w3c.dom.html.*;
024:
025: /**
026: * @version $Revision: 1.1 $ $Date: 2001/12/18 11:03:24 $
027: * @author <a href="mailto:arkin@trendline.co.il">Assaf Arkin</a>
028: * @see org.w3c.dom.html.HTMLInputElement
029: * @see ElementImpl
030: */
031: public final class HTMLInputElementImpl extends HTMLElementImpl
032: implements HTMLInputElement, HTMLFormControl {
033:
034: public String getDefaultValue() {
035: // ! NOT FULLY IMPLEMENTED !
036: return getAttribute("defaultValue");
037: }
038:
039: public void setDefaultValue(String defaultValue) {
040: // ! NOT FULLY IMPLEMENTED !
041: setAttribute("defaultValue", defaultValue);
042: }
043:
044: public boolean getDefaultChecked() {
045: // ! NOT FULLY IMPLEMENTED !
046: return getAttribute("defaultChecked") != null;
047: }
048:
049: public void setDefaultChecked(boolean defaultChecked) {
050: // ! NOT FULLY IMPLEMENTED !
051: setAttribute("defaultChecked", defaultChecked ? "" : null);
052: }
053:
054: public String getAccept() {
055: return getAttribute("accept");
056: }
057:
058: public void setAccept(String accept) {
059: setAttribute("accept", accept);
060: }
061:
062: public String getAccessKey() {
063: String accessKey;
064:
065: // Make sure that the access key is a single character.
066: accessKey = getAttribute("accesskey");
067: if (accessKey != null && accessKey.length() > 1) {
068: accessKey = accessKey.substring(0, 1);
069: }
070: return accessKey;
071: }
072:
073: public void setAccessKey(String accessKey) {
074: // Make sure that the access key is a single character.
075: if (accessKey != null && accessKey.length() > 1) {
076: accessKey = accessKey.substring(0, 1);
077: }
078: setAttribute("accesskey", accessKey);
079: }
080:
081: public String getAlign() {
082: return capitalize(getAttribute("align"));
083: }
084:
085: public void setAlign(String align) {
086: setAttribute("align", align);
087: }
088:
089: public String getAlt() {
090: return getAttribute("alt");
091: }
092:
093: public void setAlt(String alt) {
094: setAttribute("alt", alt);
095: }
096:
097: public boolean getChecked() {
098: return getAttribute("checked") != null;
099: }
100:
101: public void setChecked(boolean checked) {
102: setAttribute("checked", checked ? "" : null);
103: }
104:
105: public boolean getDisabled() {
106: return getAttribute("disabled") != null;
107: }
108:
109: public void setDisabled(boolean disabled) {
110: setAttribute("disabled", disabled ? "" : null);
111: }
112:
113: public int getMaxLength() {
114: return toInteger(getAttribute("maxlength"));
115: }
116:
117: public void setMaxLength(int maxLength) {
118: setAttribute("maxlength", String.valueOf(maxLength));
119: }
120:
121: public String getName() {
122: return getAttribute("name");
123: }
124:
125: public void setName(String name) {
126: setAttribute("name", name);
127: }
128:
129: public boolean getReadOnly() {
130: return getAttribute("readonly") != null;
131: }
132:
133: public void setReadOnly(boolean readOnly) {
134: setAttribute("readonly", readOnly ? "" : null);
135: }
136:
137: public String getSize() {
138: return getAttribute("size");
139: }
140:
141: public void setSize(String size) {
142: setAttribute("size", size);
143: }
144:
145: public String getSrc() {
146: return getAttribute("src");
147: }
148:
149: public void setSrc(String src) {
150: setAttribute("src", src);
151: }
152:
153: public int getTabIndex() {
154: try {
155: return Integer.parseInt(getAttribute("tabindex"));
156: } catch (NumberFormatException except) {
157: return 0;
158: }
159: }
160:
161: public void setTabIndex(int tabIndex) {
162: setAttribute("tabindex", String.valueOf(tabIndex));
163: }
164:
165: public String getType() {
166: return getAttribute("type");
167: }
168:
169: public String getUseMap() {
170: return getAttribute("useMap");
171: }
172:
173: public void setUseMap(String useMap) {
174: setAttribute("useMap", useMap);
175: }
176:
177: public String getValue() {
178: return getAttribute("value");
179: }
180:
181: public void setValue(String value) {
182: setAttribute("value", value);
183: }
184:
185: public void blur() {
186: // No scripting in server-side DOM. This method is moot.
187: }
188:
189: public void focus() {
190: // No scripting in server-side DOM. This method is moot.
191: }
192:
193: public void select() {
194: // No scripting in server-side DOM. This method is moot.
195: }
196:
197: public void click() {
198: // No scripting in server-side DOM. This method is moot.
199: }
200:
201: /**
202: * Constructor requires owner document.
203: *
204: * @param owner The owner HTML document
205: */
206: public HTMLInputElementImpl(HTMLDocumentImpl owner, String name) {
207: super (owner, "INPUT");
208: }
209:
210: }
|