001package com.hfg.html;
002
003
004//------------------------------------------------------------------------------
005/**
006 * Represents a button form element (<input type='button'>) tag.
007 *
008 * @author J. Alex Taylor, hairyfatguy.com
009 */
010//------------------------------------------------------------------------------
011// com.hfg XML/HTML Coding Library
012//
013// This library is free software; you can redistribute it and/or
014// modify it under the terms of the GNU Lesser General Public
015// License as published by the Free Software Foundation; either
016// version 2.1 of the License, or (at your option) any later version.
017//
018// This library is distributed in the hope that it will be useful,
019// but WITHOUT ANY WARRANTY; without even the implied warranty of
020// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
021// Lesser General Public License for more details.
022//
023// You should have received a copy of the GNU Lesser General Public
024// License along with this library; if not, write to the Free Software
025// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026//
027// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
028// jataylor@hairyfatguy.com
029//------------------------------------------------------------------------------
030
031public class InputButton extends HTMLTagWithFormEvents
032{
033
034   //###########################################################################
035   // PRIVATE FIELDS
036   //###########################################################################
037
038
039   //###########################################################################
040   // CONSTRUCTORS
041   //###########################################################################
042
043   //--------------------------------------------------------------------------
044   public InputButton()
045   {
046      super(HTML.INPUT);
047      setAttribute(HTML.TYPE, HTML.BUTTON);
048   }
049
050   //--------------------------------------------------------------------------
051   public InputButton(String inValue)
052   {
053      this();
054      setValue(inValue);
055   }
056
057   //--------------------------------------------------------------------------
058   public InputButton(String inName, String inValue)
059   {
060      this();
061      setName(inName);
062      setValue(inValue);
063   }
064
065   //###########################################################################
066   // PUBLIC METHODS
067   //###########################################################################
068
069   //--------------------------------------------------------------------------
070   public InputButton setName(String inValue)
071   {
072      setAttribute(HTML.NAME, inValue);
073
074      return this;
075   }
076
077   //--------------------------------------------------------------------------
078   public String getName()
079   {
080      return getAttributeValue(HTML.NAME);
081   }
082
083   //--------------------------------------------------------------------------
084   public InputButton setValue(String inValue)
085   {
086      setAttribute(HTML.VALUE, inValue);
087
088      return this;
089   }
090
091   //--------------------------------------------------------------------------
092   public String getValue()
093   {
094      return getAttributeValue(HTML.VALUE);
095   }
096
097   // Overrides for HTMLTag setters to allow method chaining.
098
099   //--------------------------------------------------------------------------
100   @Override
101   public InputButton setId(String inValue)
102   {
103      return (InputButton) super.setId(inValue);
104   }
105
106   //--------------------------------------------------------------------------
107   public InputButton setTitle(String inValue)
108   {
109      setAttribute(HTML.TITLE, inValue);
110      return this;
111   }
112
113   //--------------------------------------------------------------------------
114   public String getTitle()
115   {
116      return getAttributeValue(HTML.TITLE);
117   }
118
119   //--------------------------------------------------------------------------
120   @Override
121   public InputButton setStyle(CharSequence inValue)
122   {
123      return (InputButton) super.setStyle(inValue);
124   }
125
126   //--------------------------------------------------------------------------
127   @Override
128   public InputButton addStyle(String inValue)
129   {
130      return (InputButton) super.addStyle(inValue);
131   }
132
133    //--------------------------------------------------------------------------
134    public InputButton setDisabled(boolean disabled)
135    {
136        if (disabled) {
137            setAttribute(HTML.DISABLED, HTML.DISABLED);
138        }
139        else {
140            removeAttribute(HTML.DISABLED);
141        }
142
143        return this;
144    }
145
146    //--------------------------------------------------------------------------
147    public boolean isDisabled()
148    {
149        return hasAttribute(HTML.DISABLED);
150    }
151
152    // Overrides for HTMLTagWithCoreEvents setters to allow method chaining.
153
154   //--------------------------------------------------------------------------
155   @Override
156   public InputButton setOnClick(String inValue)
157   {
158      return (InputButton) super.setOnClick(inValue);
159   }
160
161   //--------------------------------------------------------------------------
162   @Override
163   public InputButton setOnDblClick(String inValue)
164   {
165      return (InputButton) super.setOnDblClick(inValue);
166   }
167
168   //--------------------------------------------------------------------------
169   @Override
170   public InputButton setOnMouseDown(String inValue)
171   {
172      return (InputButton) super.setOnMouseDown(inValue);
173   }
174
175   //--------------------------------------------------------------------------
176   @Override
177   public InputButton setOnMouseMove(String inValue)
178   {
179      return (InputButton) super.setOnMouseMove(inValue);
180   }
181
182   //--------------------------------------------------------------------------
183   @Override
184   public InputButton setOnMouseOut(String inValue)
185   {
186      return (InputButton) super.setOnMouseOut(inValue);
187   }
188
189   //--------------------------------------------------------------------------
190   @Override
191   public InputButton setOnMouseOver(String inValue)
192   {
193      return (InputButton) super.setOnMouseOver(inValue);
194   }
195
196   //--------------------------------------------------------------------------
197   @Override
198   public InputButton setOnMouseUp(String inValue)
199   {
200      return (InputButton) super.setOnMouseUp(inValue);
201   }
202
203   //--------------------------------------------------------------------------
204   @Override
205   public InputButton setOnKeyDown(String inValue)
206   {
207      return (InputButton) super.setOnKeyDown(inValue);
208   }
209
210   //--------------------------------------------------------------------------
211   @Override
212   public InputButton setOnKeyPress(String inValue)
213   {
214      return (InputButton) super.setOnKeyPress(inValue);
215   }
216
217   //--------------------------------------------------------------------------
218   @Override
219   public InputButton setOnKeyUp(String inValue)
220   {
221      return (InputButton) super.setOnKeyUp(inValue);
222   }
223
224   // Overrides for HTMLTagWithFormEvents setters to allow method chaining.
225
226   //--------------------------------------------------------------------------
227   @Override
228   public InputButton setOnBlur(String inValue)
229   {
230      return (InputButton) super.setOnBlur(inValue);
231   }
232
233   //--------------------------------------------------------------------------
234   @Override
235   public InputButton setOnChange(String inValue)
236   {
237      return (InputButton) super.setOnChange(inValue);
238   }
239
240   //--------------------------------------------------------------------------
241   @Override
242   public InputButton setOnFocus(String inValue)
243   {
244      return (InputButton) super.setOnFocus(inValue);
245   }
246
247}