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

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

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


import com.hfg.xml.XMLNode;

//------------------------------------------------------------------------------
/**
 * Represents a label (<label>) 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 Label extends HTMLTagWithCoreEvents
{

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

   //--------------------------------------------------------------------------
   public Label()
   {
      super(HTML.LABEL);
   }

   //--------------------------------------------------------------------------
   public Label(String inContent)
   {
      this();
      addContent(inContent);
   }

   //--------------------------------------------------------------------------
   public Label(HTMLTag inContent)
   {
      this();
      addSubtag(inContent);
   }

   //--------------------------------------------------------------------------
   public Label(XMLNode inXMLNode)
   {
      this();
      initFromXMLNode(inXMLNode);
   }

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


   //--------------------------------------------------------------------------
   public InputCheckbox addCheckbox(String inName)
   {
      return addCheckbox(inName, "true");
   }

   //--------------------------------------------------------------------------
   public InputCheckbox addCheckbox(String inName, String inValue)
   {
      return addCheckbox(inName, inValue, false);
   }

   //--------------------------------------------------------------------------
   public InputCheckbox addCheckbox(String inName, String inValue, boolean inChecked)
   {
      InputCheckbox chkbox = new InputCheckbox(inName, inValue, inChecked);
      addSubtag(chkbox);

      return chkbox;
   }


   //--------------------------------------------------------------------------
   public InputRadio addRadioBtn(String inName, String inValue)
   {
      InputRadio radio = new InputRadio(inName, inValue);
      addSubtag(radio);

      return radio;
   }

   //--------------------------------------------------------------------------
   public InputRadio addRadioBtn(String inName, String inValue, boolean checked)
   {
      InputRadio radio = new InputRadio(inName, inValue, checked);
      addSubtag(radio);

      return radio;
   }



   //--------------------------------------------------------------------------
   public Img addImage(String inSrc)
   {
      Img image = new Img(inSrc);
      addSubtag(image);

      return image;
   }

   //--------------------------------------------------------------------------
   public Link addLink()
   {
      Link link = new Link();
      addSubtag(link);

      return link;
   }

   //--------------------------------------------------------------------------
   public Link addLink(CharSequence inURL)
   {
      Link link = new Link(inURL);
      addSubtag(link);

      return link;
   }

   //--------------------------------------------------------------------------
   public Link addLink(CharSequence inURL, String inContent)
   {
      Link link = new Link(inURL, inContent);
      addSubtag(link);

      return link;
   }

   //--------------------------------------------------------------------------
   public Link addLink(CharSequence inURL, HTMLTag inContent)
   {
      Link link = new Link(inURL, inContent);
      addSubtag(link);

      return link;
   }

   //--------------------------------------------------------------------------
   public Nobr addNobr()
   {
      Nobr nobr = new Nobr();
      addSubtag(nobr);

      return nobr;
   }

   //--------------------------------------------------------------------------
   public Nobr addNobr(String inContent)
   {
      Nobr nobr = new Nobr(inContent);
      addSubtag(nobr);

      return nobr;
   }

   //--------------------------------------------------------------------------
   public Nobr addNobr(HTMLTag inContent)
   {
      Nobr nobr = new Nobr(inContent);
      addSubtag(nobr);

      return nobr;
   }


   //--------------------------------------------------------------------------
   public Span addSpan()
   {
      Span span = new Span();
      addSubtag(span);

      return span;
   }

   //--------------------------------------------------------------------------
   public Span addSpan(String inContent)
   {
      Span span = new Span(inContent);
      addSubtag(span);

      return span;
   }

   //--------------------------------------------------------------------------
   @Override
   public Span appendToOnMouseOut(String inValue)
   {
      return (Span) super.appendToOnMouseOut(inValue);
   }

   //--------------------------------------------------------------------------
   @Override
   public Span appendToOnMouseOver(String inValue)
   {
      return (Span) super.appendToOnMouseOver(inValue);
   }

   //--------------------------------------------------------------------------
   @Override
   public Span appendToOnClick(String inValue)
   {
      return (Span) super.appendToOnClick(inValue);
   }


   //--------------------------------------------------------------------------
   public Label setFor(String inValue)
   {
      setAttribute(HTML.FOR, inValue);
      return this;
   }

   //--------------------------------------------------------------------------
   public String getFor()
   {
      return getAttributeValue(HTML.FOR);
   }


   //--------------------------------------------------------------------------
   public Label setTitle(String inValue)
   {
      setAttribute(HTML.TITLE, inValue);
      return this;
   }

   //--------------------------------------------------------------------------
   public String getTitle()
   {
      return getAttributeValue(HTML.TITLE);
   }


   //--------------------------------------------------------------------------
   public Label br()
   {
      HTMLUtil.br(this);
      return this;
   }

   //--------------------------------------------------------------------------
   public Label br(int inNumber)
   {
      HTMLUtil.br(this, inNumber);
      return this;
   }

   //--------------------------------------------------------------------------
   public Label nbsp(int inNumber)
   {
      HTMLUtil.nbsp(this, inNumber);
      return this;
   }

   // Overrides for HTMLTag setters to allow method chaining.

   //--------------------------------------------------------------------------
   @Override
   public Label addClass(String inValue)
   {
      return (Label) super.addClass(inValue);
   }

   //--------------------------------------------------------------------------
   @Override
   public Label setClass(String inValue)
   {
      return (Label) super.setClass(inValue);
   }

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

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

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


   //--------------------------------------------------------------------------
   @Override
   public Label setDraggable(boolean inValue)
   {
      return (Label) super.setDraggable(inValue);
   }

   // Overrides for HTMLTagWithCoreEvents setters to allow method chaining.

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

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

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

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

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

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

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy