001package com.hfg.html;
002
003
004//------------------------------------------------------------------------------
005/**
006 * Represents a submit form element (<input type='submit'>) 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 InputSubmit extends HTMLTagWithCoreEvents
032{
033
034   //##########################################################################
035   // PRIVATE FIELDS
036   //##########################################################################
037
038
039   //##########################################################################
040   // CONSTRUCTORS
041   //##########################################################################
042
043   //--------------------------------------------------------------------------
044   public InputSubmit()
045   {
046      this("Submit", "Submit");
047   }
048
049   //--------------------------------------------------------------------------
050   public InputSubmit(String inValue)
051   {
052      this("Submit", inValue);
053      setValue(inValue);
054   }
055
056   //--------------------------------------------------------------------------
057   public InputSubmit(String inName, String inValue)
058   {
059      super(HTML.INPUT);
060      setAttribute(HTML.TYPE, "submit");
061      setName(inName);
062      setValue(inValue);
063   }
064
065   //##########################################################################
066   // PUBLIC METHODS
067   //##########################################################################
068
069   //--------------------------------------------------------------------------
070   public InputSubmit 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 InputSubmit 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
098   //--------------------------------------------------------------------------
099   public InputSubmit setDisabled(boolean disabled)
100   {
101      if (disabled) {
102         setAttribute(HTML.DISABLED, HTML.DISABLED);
103      }
104      else {
105         removeAttribute(HTML.DISABLED);
106      }
107
108      return this;
109   }
110
111   //--------------------------------------------------------------------------
112   public boolean isDisabled()
113   {
114      return hasAttribute(HTML.DISABLED);
115   }
116
117   // Overrides for HTMLTag setters to allow method chaining.
118
119   //--------------------------------------------------------------------------
120   @Override
121   public InputSubmit setId(String inValue)
122   {
123      return (InputSubmit) super.setId(inValue);
124   }
125
126   //--------------------------------------------------------------------------
127   @Override
128   public InputSubmit setStyle(CharSequence inValue)
129   {
130      return (InputSubmit) super.setStyle(inValue);
131   }
132
133   //--------------------------------------------------------------------------
134   @Override
135   public InputSubmit addStyle(String inValue)
136   {
137      return (InputSubmit) super.addStyle(inValue);
138   }
139
140   // Overrides for HTMLTagWithCoreEvents setters to allow method chaining.
141
142   //--------------------------------------------------------------------------
143   @Override
144   public InputSubmit setOnClick(String inValue)
145   {
146      return (InputSubmit) super.setOnClick(inValue);
147   }
148
149   //--------------------------------------------------------------------------
150   @Override
151   public InputSubmit setOnDblClick(String inValue)
152   {
153      return (InputSubmit) super.setOnDblClick(inValue);
154   }
155
156   //--------------------------------------------------------------------------
157   @Override
158   public InputSubmit setOnMouseDown(String inValue)
159   {
160      return (InputSubmit) super.setOnMouseDown(inValue);
161   }
162
163   //--------------------------------------------------------------------------
164   @Override
165   public InputSubmit setOnMouseMove(String inValue)
166   {
167      return (InputSubmit) super.setOnMouseMove(inValue);
168   }
169
170   //--------------------------------------------------------------------------
171   @Override
172   public InputSubmit setOnMouseOut(String inValue)
173   {
174      return (InputSubmit) super.setOnMouseOut(inValue);
175   }
176
177   //--------------------------------------------------------------------------
178   @Override
179   public InputSubmit setOnMouseOver(String inValue)
180   {
181      return (InputSubmit) super.setOnMouseOver(inValue);
182   }
183
184   //--------------------------------------------------------------------------
185   @Override
186   public InputSubmit setOnMouseUp(String inValue)
187   {
188      return (InputSubmit) super.setOnMouseUp(inValue);
189   }
190
191   //--------------------------------------------------------------------------
192   @Override
193   public InputSubmit setOnKeyDown(String inValue)
194   {
195      return (InputSubmit) super.setOnKeyDown(inValue);
196   }
197
198   //--------------------------------------------------------------------------
199   @Override
200   public InputSubmit setOnKeyPress(String inValue)
201   {
202      return (InputSubmit) super.setOnKeyPress(inValue);
203   }
204
205   //--------------------------------------------------------------------------
206   @Override
207   public InputSubmit setOnKeyUp(String inValue)
208   {
209      return (InputSubmit) super.setOnKeyUp(inValue);
210   }
211}