001package com.hfg.html;
002
003
004//------------------------------------------------------------------------------
005/**
006 * Represents a hidden form element (<input type='hidden'>) 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 InputHidden extends HTMLTag
032{
033
034    //##########################################################################
035    // PRIVATE FIELDS
036    //##########################################################################
037
038
039    //##########################################################################
040    // CONSTRUCTORS
041    //##########################################################################
042
043    //--------------------------------------------------------------------------
044    public InputHidden()
045    {
046        super(HTML.INPUT);
047        setAttribute(HTML.TYPE, "hidden");
048    }
049
050         //--------------------------------------------------------------------------
051    public InputHidden(String inName, Object inValue)
052    {
053                this(inName, inValue != null ? inValue.toString() : "");
054    }
055
056         //--------------------------------------------------------------------------
057    public InputHidden(String inName, int inValue)
058    {
059                this(inName, inValue + "");
060    }
061
062         //--------------------------------------------------------------------------
063    public InputHidden(String inName, long inValue)
064    {
065                this(inName, inValue + "");
066    }
067
068         //--------------------------------------------------------------------------
069    public InputHidden(String inName, float inValue)
070    {
071                this(inName, inValue + "");
072    }
073
074         //--------------------------------------------------------------------------
075    public InputHidden(String inName, double inValue)
076    {
077                this(inName, inValue + "");
078    }
079
080         //--------------------------------------------------------------------------
081    public InputHidden(String inName, String inValue)
082    {
083                this();
084      setName(inName);
085        setValue(inValue);
086    }
087
088    //##########################################################################
089    // PUBLIC METHODS
090    //##########################################################################
091        
092    //--------------------------------------------------------------------------
093    public InputHidden setName(String inValue)
094    {
095        setAttribute(HTML.NAME, inValue);
096                
097                return this;
098        }
099
100    //--------------------------------------------------------------------------
101    public String getName()
102    {
103        return getAttributeValue(HTML.NAME);
104    }
105        
106    //--------------------------------------------------------------------------
107    public InputHidden setValue(String inValue)
108    {
109        setAttribute(HTML.VALUE, inValue);
110        
111                return this;
112        }
113
114    //--------------------------------------------------------------------------
115    public String getValue()
116    {
117        return getAttributeValue(HTML.VALUE);
118    }
119
120   //--------------------------------------------------------------------------
121   public InputHidden setId(String inValue)
122   {
123      setAttribute(HTML.ID, inValue);
124      return this;
125   }
126
127}