001package com.hfg.html;
002
003
004//------------------------------------------------------------------------------
005/**
006 * Represents a file upload form element (<input type='file'>) 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 InputFile extends HTMLTagWithFormEvents
032{
033   //###########################################################################
034   // PRIVATE FIELDS
035   //###########################################################################
036
037
038   //###########################################################################
039   // CONSTRUCTORS
040   //###########################################################################
041
042   //--------------------------------------------------------------------------
043   public InputFile()
044   {
045      super(HTML.INPUT);
046      setAttribute(HTML.TYPE, HTML.FILE);
047   }
048
049   //--------------------------------------------------------------------------
050   public InputFile(String inName)
051   {
052      this();
053      setName(inName);
054   }
055
056   //--------------------------------------------------------------------------
057   public InputFile(String inName, String inValue)
058   {
059      this();
060      setName(inName);
061      setValue(inValue);
062   }
063
064   //###########################################################################
065   // PUBLIC METHODS
066   //###########################################################################
067
068   //--------------------------------------------------------------------------
069   public InputFile setName(String inValue)
070   {
071      setAttribute(HTML.NAME, inValue);
072      return this;
073   }
074
075   //--------------------------------------------------------------------------
076   public String getName()
077   {
078      return getAttributeValue(HTML.NAME);
079   }
080
081
082   //--------------------------------------------------------------------------
083   public InputFile setMultiple(boolean inValue)
084   {
085      if (inValue)
086      {
087         setAttribute(HTML.MULTIPLE, "1");
088      }
089      else
090      {
091         removeAttribute(HTML.MULTIPLE);
092      }
093      
094      return this;
095   }
096
097
098   //--------------------------------------------------------------------------
099   public InputFile setSize(int inValue)
100   {
101      setAttribute(HTML.SIZE, Integer.toString(inValue));
102      return this;
103   }
104
105   //--------------------------------------------------------------------------
106   public InputFile setValue(String inValue)
107   {
108      setAttribute(HTML.VALUE, inValue);
109      return this;
110   }
111
112   //--------------------------------------------------------------------------
113   public String getValue()
114   {
115      return getAttributeValue(HTML.VALUE);
116   }
117
118   // Overrides for HTMLTag setters to allow method chaining.
119
120   //--------------------------------------------------------------------------
121   @Override
122   public InputFile setId(String inValue)
123   {
124      return (InputFile) super.setId(inValue);
125   }
126
127   //--------------------------------------------------------------------------
128   @Override
129   public InputFile setStyle(CharSequence inValue)
130   {
131      return (InputFile) super.setStyle(inValue);
132   }
133
134   //--------------------------------------------------------------------------
135   @Override
136   public InputFile addStyle(String inValue)
137   {
138      return (InputFile) super.addStyle(inValue);
139   }
140
141   // Overrides for HTMLTagWithCoreEvents setters to allow method chaining.
142
143   //--------------------------------------------------------------------------
144   @Override
145   public InputFile setOnClick(String inValue)
146   {
147      return (InputFile) super.setOnClick(inValue);
148   }
149
150   //--------------------------------------------------------------------------
151   @Override
152   public InputFile setOnDblClick(String inValue)
153   {
154      return (InputFile) super.setOnDblClick(inValue);
155   }
156
157   //--------------------------------------------------------------------------
158   @Override
159   public InputFile setOnMouseDown(String inValue)
160   {
161      return (InputFile) super.setOnMouseDown(inValue);
162   }
163
164   //--------------------------------------------------------------------------
165   @Override
166   public InputFile setOnMouseMove(String inValue)
167   {
168      return (InputFile) super.setOnMouseMove(inValue);
169   }
170
171   //--------------------------------------------------------------------------
172   @Override
173   public InputFile setOnMouseOut(String inValue)
174   {
175      return (InputFile) super.setOnMouseOut(inValue);
176   }
177
178   //--------------------------------------------------------------------------
179   @Override
180   public InputFile setOnMouseOver(String inValue)
181   {
182      return (InputFile) super.setOnMouseOver(inValue);
183   }
184
185   //--------------------------------------------------------------------------
186   @Override
187   public InputFile setOnMouseUp(String inValue)
188   {
189      return (InputFile) super.setOnMouseUp(inValue);
190   }
191
192   //--------------------------------------------------------------------------
193   @Override
194   public InputFile setOnKeyDown(String inValue)
195   {
196      return (InputFile) super.setOnKeyDown(inValue);
197   }
198
199   //--------------------------------------------------------------------------
200   @Override
201   public InputFile setOnKeyPress(String inValue)
202   {
203      return (InputFile) super.setOnKeyPress(inValue);
204   }
205
206   //--------------------------------------------------------------------------
207   @Override
208   public InputFile setOnKeyUp(String inValue)
209   {
210      return (InputFile) super.setOnKeyUp(inValue);
211   }
212
213   // Overrides for HTMLTagWithFormEvents setters to allow method chaining.
214
215   //--------------------------------------------------------------------------
216   @Override
217   public InputFile setOnBlur(String inValue)
218   {
219      return (InputFile) super.setOnBlur(inValue);
220   }
221
222   //--------------------------------------------------------------------------
223   @Override
224   public InputFile setOnChange(String inValue)
225   {
226      return (InputFile) super.setOnChange(inValue);
227   }
228
229   //--------------------------------------------------------------------------
230   @Override
231   public InputFile setOnFocus(String inValue)
232   {
233      return (InputFile) super.setOnFocus(inValue);
234   }
235
236}