All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hfg.html.InputFile Maven / Gradle / Ivy

There is a newer version: 20240423
Show newest version
package com.hfg.html;


//------------------------------------------------------------------------------
/**
 * Represents a file upload form element (<input type='file'>) tag.
 *
 * @author J. Alex Taylor, hairyfatguy.com
 */
//------------------------------------------------------------------------------
// com.hfg XML/HTML Coding Library
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
// [email protected]
//------------------------------------------------------------------------------

public class InputFile extends HTMLTagWithFormEvents
{
   //###########################################################################
   // PRIVATE FIELDS
   //###########################################################################


   //###########################################################################
   // CONSTRUCTORS
   //###########################################################################

   //--------------------------------------------------------------------------
   public InputFile()
   {
      super(HTML.INPUT);
      setAttribute(HTML.TYPE, HTML.FILE);
   }

   //--------------------------------------------------------------------------
   public InputFile(String inName)
   {
      this();
      setName(inName);
   }

   //--------------------------------------------------------------------------
   public InputFile(String inName, String inValue)
   {
      this();
      setName(inName);
      setValue(inValue);
   }

   //###########################################################################
   // PUBLIC METHODS
   //###########################################################################

   //--------------------------------------------------------------------------
   public InputFile setName(String inValue)
   {
      setAttribute(HTML.NAME, inValue);
      return this;
   }

   //--------------------------------------------------------------------------
   public String getName()
   {
      return getAttributeValue(HTML.NAME);
   }


   //--------------------------------------------------------------------------
   public InputFile setMultiple(boolean inValue)
   {
      if (inValue)
      {
         setAttribute(HTML.MULTIPLE, "1");
      }
      else
      {
         removeAttribute(HTML.MULTIPLE);
      }
      
      return this;
   }


   //--------------------------------------------------------------------------
   public InputFile setSize(int inValue)
   {
      setAttribute(HTML.SIZE, Integer.toString(inValue));
      return this;
   }

   //--------------------------------------------------------------------------
   public InputFile setValue(String inValue)
   {
      setAttribute(HTML.VALUE, inValue);
      return this;
   }

   //--------------------------------------------------------------------------
   public String getValue()
   {
      return getAttributeValue(HTML.VALUE);
   }

   // Overrides for HTMLTag setters to allow method chaining.

   //--------------------------------------------------------------------------
   @Override
   public InputFile setId(String inValue)
   {
      return (InputFile) super.setId(inValue);
   }

   //--------------------------------------------------------------------------
   @Override
   public InputFile setStyle(CharSequence inValue)
   {
      return (InputFile) super.setStyle(inValue);
   }

   //--------------------------------------------------------------------------
   @Override
   public InputFile addStyle(String inValue)
   {
      return (InputFile) super.addStyle(inValue);
   }

   // Overrides for HTMLTagWithCoreEvents setters to allow method chaining.

   //--------------------------------------------------------------------------
   @Override
   public InputFile setOnClick(String inValue)
   {
      return (InputFile) super.setOnClick(inValue);
   }

   //--------------------------------------------------------------------------
   @Override
   public InputFile setOnDblClick(String inValue)
   {
      return (InputFile) super.setOnDblClick(inValue);
   }

   //--------------------------------------------------------------------------
   @Override
   public InputFile setOnMouseDown(String inValue)
   {
      return (InputFile) super.setOnMouseDown(inValue);
   }

   //--------------------------------------------------------------------------
   @Override
   public InputFile setOnMouseMove(String inValue)
   {
      return (InputFile) super.setOnMouseMove(inValue);
   }

   //--------------------------------------------------------------------------
   @Override
   public InputFile setOnMouseOut(String inValue)
   {
      return (InputFile) super.setOnMouseOut(inValue);
   }

   //--------------------------------------------------------------------------
   @Override
   public InputFile setOnMouseOver(String inValue)
   {
      return (InputFile) super.setOnMouseOver(inValue);
   }

   //--------------------------------------------------------------------------
   @Override
   public InputFile setOnMouseUp(String inValue)
   {
      return (InputFile) super.setOnMouseUp(inValue);
   }

   //--------------------------------------------------------------------------
   @Override
   public InputFile setOnKeyDown(String inValue)
   {
      return (InputFile) super.setOnKeyDown(inValue);
   }

   //--------------------------------------------------------------------------
   @Override
   public InputFile setOnKeyPress(String inValue)
   {
      return (InputFile) super.setOnKeyPress(inValue);
   }

   //--------------------------------------------------------------------------
   @Override
   public InputFile setOnKeyUp(String inValue)
   {
      return (InputFile) super.setOnKeyUp(inValue);
   }

   // Overrides for HTMLTagWithFormEvents setters to allow method chaining.

   //--------------------------------------------------------------------------
   @Override
   public InputFile setOnBlur(String inValue)
   {
      return (InputFile) super.setOnBlur(inValue);
   }

   //--------------------------------------------------------------------------
   @Override
   public InputFile setOnChange(String inValue)
   {
      return (InputFile) super.setOnChange(inValue);
   }

   //--------------------------------------------------------------------------
   @Override
   public InputFile setOnFocus(String inValue)
   {
      return (InputFile) super.setOnFocus(inValue);
   }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy