Class Button

All Implemented Interfaces:
Serializable, DynamicAttributes, IterationTag, JspTag, Tag, DynamicActionAttributes
Direct Known Subclasses:
CalendarButton

public class Button
extends StylableTag
This tag is used to display a clickable button.

Example:

   <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
   <base:button onclick="alert('click')" title="Click here">
   </base:button>

Syntax:

   <base:button
      id=...
      clazz=...
      subclass=...
      style=...
      title=...
      tooltip=...
      image=...
      visible=true|false
      disabled=true|false
      tabindex=...
   >
Tag attributes
Attribute Default value Required Description
id - no The ID of the button. The value of this attribute goes directly into the standard id attribute. This means that if you need a reference to the button object in your own JavaScript code, you may for example use the following code:

note = document.getElementById('<id>');

clazz basicbutton no The value of this attribute goes directly into the standard HTML class attribute. This allows you to apply different styles to different buttons.
subclass - no Additional classes to put in the HTML class attribute. Doesn't replace the main class attribute.
style - no The value if this attribute goes directly into the standard HTML style attribute. This allows you to apply different styles to different buttons.
title no The title of the button.
tooltip no A short explanation that will show up as a tooltip.
image no An optional image to display. An image is automatically selected if the title is "Close", "Cancel", "Save", "Ok", "Yes" or "No".
visible true no If the button should be visible or not.
disabled false no If the button should be enabled or not.
tabindex 0 no Tab index value to control the focus order. Use -1 to disable tabbing to the button.
Version:
2.0
Author:
Nicklas
See Also:
Serialized Form
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
      Constant Field Values
    • defaultImages

      private static final Map<String,​String> defaultImages
    • defaultIds

      private static final Map<String,​String> defaultIds
    • buttonGroup

      private ButtonGroup buttonGroup
    • title

      private String title
      The title of the button.
    • tooltip

      private String tooltip
      An optional tooltip.
    • visible

      private boolean visible
      If the button should be visible or not.
    • disabled

      private boolean disabled
      If the button should be enabled or not.
    • image

      private String image
      The image to display.
    • tabIndex

      private int tabIndex
    • keepFirstWord

      private static final Pattern keepFirstWord
  • Constructor Details

    • Button

      public Button()
  • Method Details

    • getId

      public String getId()
      Overrides:
      getId in class TagSupport
    • setTitle

      public void setTitle​(String title)
    • getTitle

      public String getTitle()
    • setImage

      public void setImage​(String image)
    • getImage

      public String getImage()
    • setTooltip

      public void setTooltip​(String tooltip)
    • getTooltip

      public String getTooltip()
    • setVisible

      public void setVisible​(boolean visible)
    • isVisible

      public boolean isVisible()
    • setDisabled

      public void setDisabled​(boolean disabled)
    • isDisabled

      public boolean isDisabled()
    • setTabindex

      public void setTabindex​(int tabIndex)
      Since:
      3.2
    • getTabindex

      public int getTabindex()
      Since:
      3.2
    • doStartTag

      public int doStartTag() throws JspException
      Specified by:
      doStartTag in interface Tag
      Overrides:
      doStartTag in class TagSupport
      Throws:
      JspException
    • getDefaultImage

      private String getDefaultImage​(String theTitle)
    • getDefaultId

      private String getDefaultId​(String theTitle)