Class CheckTag

All Implemented Interfaces:
Serializable, IterationTag, JspTag, Tag

public class CheckTag extends FormElementTag
A JSP tag to support the generation of HTML multi-option checkboxes and radio buttons.
Since:
1.0
Version:
11.0
Author:
Luke
See Also:
  • Field Details

    • _firstEntry

      protected Object _firstEntry
      An additional entry prepended to the list of options
  • Constructor Details

    • CheckTag

      public CheckTag()
      Creates a new checkbox/radio tag.
  • Method Details

    • setCols

      public void setCols(int columns)
      Sets the width of the field in columns; afterwards the separator will be outputted.
      Parameters:
      columns - the number of columns
    • setWidth

      public void setWidth(int width)
      Sets the width of each checkbox entry.
      Parameters:
      width - the width in pixels
    • setName

      public void setName(String name)
      Sets the check box name, saving for the CSS class.
      Overrides:
      setName in class FormElementTag
      Parameters:
      name - the field name
    • setFirstEntry

      public void setFirstEntry(Object entry)
      Allows an entry to be inserted before the rest of the options.
      Parameters:
      entry - the first entry to insert
    • setOnChange

      public void setOnChange(String jsEvent)
      Sets the JavaScript onChange event for these checkboxes/radio buttons.
      Parameters:
      jsEvent - the JavaScript event code
    • doEndTag

      public int doEndTag() throws JspException
      Renders the checkbox tags.
      Specified by:
      doEndTag in interface Tag
      Overrides:
      doEndTag in class TagSupport
      Returns:
      EVAL_PAGE always
      Throws:
      JspException - if an error occurs
    • release

      public void release()
      Releases the tag's state data.
      Specified by:
      release in interface Tag
      Overrides:
      release in class ElementTag
    • setClassName

      public final void setClassName(String cName)
      Sets the CSS class name for the checkbox/radio text .
      Overrides:
      setClassName in class ElementTag
      Parameters:
      cName - the CSS class name(s)
      See Also:
    • setType

      public void setType(String checkType)
      Sets the element type. Updats the default CSS class to "check" or "radio".
      Parameters:
      checkType - the element type, typically RADIO or CHECKBOX
    • setSeparator

      public void setSeparator(String sep)
      Sets the multiple element separator.
      Parameters:
      sep - the string to insert between multiple elements
      See Also:
    • setNewLine

      public void setNewLine(boolean doNewLine)
      Sets the multiple element separator to a DIV with a new line.
      Parameters:
      doNewLine - TRUE if the separator should be set, otherwise FALSE
      See Also:
    • setChecked

      public void setChecked(Collection<Object> values)
      Sets the selected value(s) of this element.
      Parameters:
      values - a List of selected values of this element
    • setOptions

      public void setOptions(Collection<?> choices)
      Sets the choices for this checkbox/radio button.
      Parameters:
      choices - a Collection of choices