KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > xml > dom > html > HTMLButtonElementImpl


1 /**
2  * org/ozone-db/xml/dom/html/HTMLButtonElementImpl.java
3  *
4  * The contents of this file are subject to the OpenXML Public
5  * License Version 1.0; you may not use this file except in compliance
6  * with the License. You may obtain a copy of the License at
7  * http://www.openxml.org/license.html
8  *
9  * THIS SOFTWARE IS DISTRIBUTED ON AN "AS IS" BASIS WITHOUT WARRANTY
10  * OF ANY KIND, EITHER EXPRESSED OR IMPLIED. THE INITIAL DEVELOPER
11  * AND ALL CONTRIBUTORS SHALL NOT BE LIABLE FOR ANY DAMAGES AS A
12  * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
13  * DERIVATIVES. SEE THE LICENSE FOR THE SPECIFIC LANGUAGE GOVERNING
14  * RIGHTS AND LIMITATIONS UNDER THE LICENSE.
15  *
16  * The Initial Developer of this code under the License is Assaf Arkin.
17  * Portions created by Assaf Arkin are Copyright (C) 1998, 1999.
18  * All Rights Reserved.
19  */

20
21 package org.ozoneDB.xml.dom.html;
22
23 import org.ozoneDB.xml.dom.ElementImpl;
24 import org.w3c.dom.html.HTMLButtonElement;
25
26
27 /**
28  * @version $Revision: 1.2 $ $Date: 2003/11/20 23:18:42 $
29  * @author <a HREF="mailto:arkin@trendline.co.il">Assaf Arkin</a>
30  * @see org.w3c.dom.html.HTMLButtonElement
31  * @see ElementImpl
32  */

33 public final class HTMLButtonElementImpl extends HTMLElementImpl implements HTMLButtonElement, HTMLFormControl {
34
35
36     public String JavaDoc getAccessKey() {
37         String JavaDoc accessKey;
38
39         // Make sure that the access key is a single character.
40
accessKey = getAttribute( "accesskey" );
41         if (accessKey != null && accessKey.length() > 1) {
42             accessKey = accessKey.substring( 0, 1 );
43         }
44         return accessKey;
45     }
46
47
48     public void setAccessKey( String JavaDoc accessKey ) {
49         // Make sure that the access key is a single character.
50
if (accessKey != null && accessKey.length() > 1) {
51             accessKey = accessKey.substring( 0, 1 );
52         }
53         setAttribute( "accesskey", accessKey );
54     }
55
56
57     public boolean getDisabled() {
58         return getAttribute( "disabled" ) != null;
59     }
60
61
62     public void setDisabled( boolean disabled ) {
63         setAttribute( "disabled", disabled ? "" : null );
64     }
65
66
67     public String JavaDoc getName() {
68         return getAttribute( "name" );
69     }
70
71
72     public void setName( String JavaDoc name ) {
73         setAttribute( "name", name );
74     }
75
76
77     public int getTabIndex() {
78         try {
79             return Integer.parseInt( getAttribute( "tabindex" ) );
80         } catch (NumberFormatException JavaDoc except) {
81             return 0;
82         }
83     }
84
85
86     public void setTabIndex( int tabIndex ) {
87         setAttribute( "tabindex", String.valueOf( tabIndex ) );
88     }
89
90
91     public String JavaDoc getType() {
92         return capitalize( getAttribute( "type" ) );
93     }
94
95
96     public String JavaDoc getValue() {
97         return getAttribute( "value" );
98     }
99
100
101     public void setValue( String JavaDoc value ) {
102         setAttribute( "value", value );
103     }
104
105
106     /**
107      * Constructor requires owner document.
108      *
109      * @param owner The owner HTML document
110      */

111     public HTMLButtonElementImpl( HTMLDocumentImpl owner, String JavaDoc name ) {
112         super( owner, "BUTTON" );
113     }
114
115
116 }
117
Popular Tags