com.hfg.html.Textarea 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;
import com.hfg.xml.XMLNode;
//------------------------------------------------------------------------------
/**
* Represents a textarea (<textarea>) 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 Textarea extends HTMLTagWithFormEvents
{
//##########################################################################
// PRIVATE FIELDS
//##########################################################################
//##########################################################################
// CONSTRUCTORS
//##########################################################################
//--------------------------------------------------------------------------
public Textarea()
{
super(HTML.TEXTAREA);
// This defeats isEmptyTag() so that the textarea will always be printed
// as a tag pair. Some browsers (at least Mozilla and Safari) have trouble
// with a textarea written as an empty tag.
setContent("");
}
//--------------------------------------------------------------------------
public Textarea(String inName, String inValue)
{
this();
addContent(inValue);
setName(inName);
}
//--------------------------------------------------------------------------
public Textarea(String inName, String inValue, int inRows, int inCols)
{
this(inName, inValue);
setRows(inRows);
setCols(inCols);
}
//--------------------------------------------------------------------------
public Textarea(XMLNode inXMLNode)
{
this();
initFromXMLNode(inXMLNode);
}
//##########################################################################
// PUBLIC METHODS
//##########################################################################
//--------------------------------------------------------------------------
public Textarea setName(String inValue)
{
setAttribute(HTML.NAME, inValue);
return this;
}
//--------------------------------------------------------------------------
public String getName()
{
return getAttributeValue(HTML.NAME);
}
//--------------------------------------------------------------------------
public Textarea setCols(int inValue)
{
setAttribute(HTML.COLS, inValue);
return this;
}
//--------------------------------------------------------------------------
public String getCols()
{
return getAttributeValue(HTML.COLS);
}
//--------------------------------------------------------------------------
public Textarea setRows(int inValue)
{
setAttribute(HTML.ROWS, inValue);
return this;
}
//--------------------------------------------------------------------------
public String getRows()
{
return getAttributeValue(HTML.ROWS);
}
//--------------------------------------------------------------------------
public Textarea setWrapOff()
{
setAttribute(HTML.WRAP, HTML.OFF);
return this;
}
//--------------------------------------------------------------------------
public Textarea setWrap(String inValue)
{
setAttribute(HTML.WRAP, inValue);
return this;
}
//--------------------------------------------------------------------------
public String getWrap()
{
return getAttributeValue(HTML.WRAP);
}
//--------------------------------------------------------------------------
public Textarea setDisabled(boolean disabled)
{
if (disabled) {
setAttribute(HTML.DISABLED, HTML.DISABLED);
}
else {
removeAttribute(HTML.DISABLED);
}
return this;
}
//--------------------------------------------------------------------------
public boolean isDisabled()
{
return hasAttribute(HTML.DISABLED);
}
//--------------------------------------------------------------------------
public Textarea setPlaceholder(String inValue)
{
setAttribute(HTML.PLACEHOLDER, inValue);
return this;
}
//--------------------------------------------------------------------------
public String getPlaceholder()
{
return getAttributeValue(HTML.PLACEHOLDER);
}
//--------------------------------------------------------------------------
public Textarea setOnInput(String inValue)
{
setAttribute(HTML.ONINPUT, inValue);
return this;
}
//--------------------------------------------------------------------------
public Textarea setOnSelect(String inValue)
{
setAttribute(HTML.ONSELECT, inValue);
return this;
}
//--------------------------------------------------------------------------
public String getOnSelect()
{
return getAttributeValue(HTML.ONSELECT);
}
// Overrides for HTMLTag setters to allow method chaining.
//--------------------------------------------------------------------------
@Override
public Textarea addClass(String inValue)
{
return (Textarea) super.addClass(inValue);
}
//--------------------------------------------------------------------------
@Override
public Textarea setClass(String inValue)
{
return (Textarea) super.setClass(inValue);
}
//--------------------------------------------------------------------------
@Override
public Textarea setId(String inValue)
{
return (Textarea) super.setId(inValue);
}
//--------------------------------------------------------------------------
@Override
public Textarea setStyle(CharSequence inValue)
{
return (Textarea) super.setStyle(inValue);
}
//--------------------------------------------------------------------------
@Override
public Textarea addStyle(String inValue)
{
return (Textarea) super.addStyle(inValue);
}
// Overrides for HTMLTagWithCoreEvents setters to allow method chaining.
//--------------------------------------------------------------------------
@Override
public Textarea setOnClick(String inValue)
{
return (Textarea) super.setOnClick(inValue);
}
//--------------------------------------------------------------------------
@Override
public Textarea setOnDblClick(String inValue)
{
return (Textarea) super.setOnDblClick(inValue);
}
//--------------------------------------------------------------------------
@Override
public Textarea setOnMouseDown(String inValue)
{
return (Textarea) super.setOnMouseDown(inValue);
}
//--------------------------------------------------------------------------
@Override
public Textarea setOnMouseMove(String inValue)
{
return (Textarea) super.setOnMouseMove(inValue);
}
//--------------------------------------------------------------------------
@Override
public Textarea appendToOnMouseOut(String inValue)
{
return (Textarea) super.appendToOnMouseOut(inValue);
}
//--------------------------------------------------------------------------
@Override
public Textarea setOnMouseOut(String inValue)
{
return (Textarea) super.setOnMouseOut(inValue);
}
//--------------------------------------------------------------------------
@Override
public Textarea appendToOnMouseOver(String inValue)
{
return (Textarea) super.appendToOnMouseOver(inValue);
}
//--------------------------------------------------------------------------
@Override
public Textarea setOnMouseOver(String inValue)
{
return (Textarea) super.setOnMouseOver(inValue);
}
//--------------------------------------------------------------------------
@Override
public Textarea setOnMouseUp(String inValue)
{
return (Textarea) super.setOnMouseUp(inValue);
}
//--------------------------------------------------------------------------
@Override
public Textarea setOnKeyDown(String inValue)
{
return (Textarea) super.setOnKeyDown(inValue);
}
//--------------------------------------------------------------------------
@Override
public Textarea setOnKeyPress(String inValue)
{
return (Textarea) super.setOnKeyPress(inValue);
}
//--------------------------------------------------------------------------
@Override
public Textarea setOnKeyUp(String inValue)
{
return (Textarea) super.setOnKeyUp(inValue);
}
// Overrides for HTMLTagWithFormEvents setters to allow method chaining.
//--------------------------------------------------------------------------
@Override
public Textarea setOnBlur(String inValue)
{
return (Textarea) super.setOnBlur(inValue);
}
//--------------------------------------------------------------------------
@Override
public Textarea setOnChange(String inValue)
{
return (Textarea) super.setOnChange(inValue);
}
//--------------------------------------------------------------------------
@Override
public Textarea setOnFocus(String inValue)
{
return (Textarea) super.setOnFocus(inValue);
}
//--------------------------------------------------------------------------
@Override
public Textarea setAutofocus()
{
return (Textarea) super.setAutofocus();
}
}