com.hfg.html.InputRadio Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com_hfg Show documentation
Show all versions of com_hfg Show documentation
com.hfg xml, html, svg, and bioinformatics utility library
package com.hfg.html;
//------------------------------------------------------------------------------
/**
* Represents a radio form element (<input type='radio'>) 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 InputRadio extends HTMLTagWithFormEvents
{
//##########################################################################
// PRIVATE FIELDS
//##########################################################################
private static String sTagName = HTML.INPUT;
//##########################################################################
// CONSTRUCTORS
//##########################################################################
//--------------------------------------------------------------------------
public InputRadio()
{
super(sTagName);
setAttribute(HTML.TYPE, "radio");
}
//--------------------------------------------------------------------------
public InputRadio(String inName, String inValue)
{
this();
setName(inName);
setValue(inValue);
}
//--------------------------------------------------------------------------
public InputRadio(String inName, String inValue, boolean checked)
{
this(inName, inValue);
setChecked(checked);
}
//##########################################################################
// PUBLIC METHODS
//##########################################################################
//--------------------------------------------------------------------------
public InputRadio setName(String inValue)
{
setAttribute(HTML.NAME, inValue);
return this;
}
//--------------------------------------------------------------------------
public String getName()
{
return getAttributeValue(HTML.NAME);
}
//--------------------------------------------------------------------------
public InputRadio setValue(String inValue)
{
setAttribute(HTML.VALUE, inValue);
return this;
}
//--------------------------------------------------------------------------
public String getValue()
{
return getAttributeValue(HTML.VALUE);
}
//--------------------------------------------------------------------------
public InputRadio setChecked(boolean checked)
{
if (checked) {
setAttribute(HTML.CHECKED, "true");
}
else {
removeAttribute(HTML.CHECKED);
}
return this;
}
//--------------------------------------------------------------------------
public boolean isChecked()
{
return hasAttribute(HTML.CHECKED);
}
//--------------------------------------------------------------------------
public InputRadio setDisabled(boolean disabled)
{
if (disabled) {
setAttribute(HTML.DISABLED, HTML.DISABLED);
}
else {
removeAttribute(HTML.DISABLED);
}
return this;
}
//--------------------------------------------------------------------------
public boolean isDisabled()
{
return hasAttribute(HTML.DISABLED);
}
// Overrides for HTMLTag setters to allow method chaining.
//--------------------------------------------------------------------------
@Override
public InputRadio setId(String inValue)
{
return (InputRadio) super.setId(inValue);
}
//--------------------------------------------------------------------------
@Override
public InputRadio setStyle(CharSequence inValue)
{
return (InputRadio) super.setStyle(inValue);
}
//--------------------------------------------------------------------------
@Override
public InputRadio addStyle(String inValue)
{
return (InputRadio) super.addStyle(inValue);
}
// Overrides for HTMLTagWithCoreEvents setters to allow method chaining.
//--------------------------------------------------------------------------
@Override
public InputRadio setOnClick(String inValue)
{
return (InputRadio) super.setOnClick(inValue);
}
//--------------------------------------------------------------------------
@Override
public InputRadio setOnDblClick(String inValue)
{
return (InputRadio) super.setOnDblClick(inValue);
}
//--------------------------------------------------------------------------
@Override
public InputRadio setOnMouseDown(String inValue)
{
return (InputRadio) super.setOnMouseDown(inValue);
}
//--------------------------------------------------------------------------
@Override
public InputRadio setOnMouseMove(String inValue)
{
return (InputRadio) super.setOnMouseMove(inValue);
}
//--------------------------------------------------------------------------
@Override
public InputRadio setOnMouseOut(String inValue)
{
return (InputRadio) super.setOnMouseOut(inValue);
}
//--------------------------------------------------------------------------
@Override
public InputRadio setOnMouseOver(String inValue)
{
return (InputRadio) super.setOnMouseOver(inValue);
}
//--------------------------------------------------------------------------
@Override
public InputRadio setOnMouseUp(String inValue)
{
return (InputRadio) super.setOnMouseUp(inValue);
}
//--------------------------------------------------------------------------
@Override
public InputRadio setOnKeyDown(String inValue)
{
return (InputRadio) super.setOnKeyDown(inValue);
}
//--------------------------------------------------------------------------
@Override
public InputRadio setOnKeyPress(String inValue)
{
return (InputRadio) super.setOnKeyPress(inValue);
}
//--------------------------------------------------------------------------
@Override
public InputRadio setOnKeyUp(String inValue)
{
return (InputRadio) super.setOnKeyUp(inValue);
}
// Overrides for HTMLTagWithFormEvents setters to allow method chaining.
//--------------------------------------------------------------------------
@Override
public InputRadio setOnBlur(String inValue)
{
return (InputRadio) super.setOnBlur(inValue);
}
//--------------------------------------------------------------------------
@Override
public InputRadio setOnChange(String inValue)
{
return (InputRadio) super.setOnChange(inValue);
}
//--------------------------------------------------------------------------
@Override
public InputRadio setOnFocus(String inValue)
{
return (InputRadio) super.setOnFocus(inValue);
}
}