org.apache.beehive.netui.tags.html
Class Button

Object
  extended by TagSupport
      extended by BodyTagSupport
          extended by AbstractClassicTag
              extended by HtmlBaseTag
                  extended by HtmlFocusBaseTag
                      extended by Button
All Implemented Interfaces:
Serializable, BodyTag, IterationTag, JspTag, Tag, HtmlConstants, IUrlParams, IAttributeConsumer, IHtmlAccessable, IHtmlAttrs, IHtmlCore, IHtmlEvents, IHtmlI18n, INetuiTag

public class Button
extends HtmlFocusBaseTag
implements IUrlParams, IHtmlAccessable

Generates a button on the page with the specified attributes. The <netui:button> tag must be enclosed in <netui:form...> ... </netui:form> tags. You can specify the action that the form will raise on the <netui:form> tag.

See Also:
Serialized Form
Example
In this sample, the <netui:button> submits data to the Controller file's processData action method (specified on the <netui:form>'s action attribute).
     <netui:form action="processData">
        <!--
        input elements here
        -->
        <netui:button value="Submit" type="submit"/>
     </netui:form>

Field Summary
static String ACTION_OVERRIDE
           
 
Fields inherited from class AbstractClassicTag
DefaultNamingChain, EMPTY_STRING, NETUI_UNIQUE_CNT
 
Fields inherited from class BodyTagSupport
bodyContent
 
Fields inherited from class TagSupport
id, pageContext
 
Fields inherited from interface HtmlConstants
ABBR, ACCEPT, ACCESSKEY, ACTION, ALIGN, ALINK, ALT, ANCHOR, AREA, AXIS, BACKGROUND, BASE, BGCOLOR, BODY, BORDER, BR, BUTTON, CAPTION, CELLPADDING, CELLSPACING, CHAR, CHAROFF, CHARSET, CHECKED, CLASS, COLS, COLSPAN, COORDS, DIR, DISABLED, DIV, ENCTYPE, FOR, FORM, FORM_GET, FORM_POST, FRAME, HEADERS, HEIGHT, HREF, HREFLANG, HSPACE, HTML, ID, IMAGE, INPUT, INPUT_BUTTON, INPUT_CHECKBOX, INPUT_FILE, INPUT_HIDDEN, INPUT_IMAGE, INPUT_PASSWORD, INPUT_RADIO, INPUT_RESET, INPUT_SUBMIT, INPUT_TEXT, ISMAP, LABEL, LANG, LANGUAGE, LINK, LONGDESC, MAXLENGTH, METHOD, NAME, ONBLUR, ONCHANGE, ONCLICK, ONDBLCLICK, ONFOCUS, ONKEYDOWN, ONKEYPRESS, ONKEYUP, ONLOAD, ONMOUSEDOWN, ONMOUSEMOVE, ONMOUSEOUT, ONMOUSEOVER, ONMOUSEUP, ONRESET, ONSELECT, ONSUBMIT, ONUNLOAD, OPTION, READONLY, REL, REV, ROWS, ROWSPAN, RULES, SCOPE, SCRIPT, SELECT, SHAPE, SIZE, SPAN, SRC, STYLE, SUMMARY, TABINDEX, TABLE, TARGET, TBODY, TD, TEXT, TEXTAREA, TFOOT, TH, THEAD, TITLE, TR, TYPE, USEMAP, VALIGN, VALUE, VLINK, VSPACE, WIDTH
 
Fields inherited from interface BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
Button()
           
 
Method Summary
 void addParameter(String name, Object value, String facet)
          Adds a URL parameter to the generated hyperlink.
 int doAfterBody()
          Save the associated button label from the body content (if any).
 int doEndTag()
          Render the button.
 int doStartTag()
          Process the start of the Button.
 PopupSupport getPopupSupport()
          Get a helper to provide popup support.
protected  AbstractHtmlState getState()
          This method will return the state associated with the tag.
 String getTagName()
          Return the name of the Tag.
protected  void localRelease()
          Release any acquired resources.
 void setAccessKey(char accessKey)
          Sets the accessKey attribute value.
 void setAction(String action)
          Set the name of the action for the Button.
 void setAlt(String alt)
          Sets the alt attribute value.
 void setAttribute(String name, String value, String facet)
          Base support for the attribute tag.
 void setDisableSecondClick(boolean disableSecondClick)
          When true, this button will disable itself before submitting.
 void setPopup(boolean popup)
          Sets the popup indicator.
 void setRenderAsButton(boolean renderAsButton)
          When set to true, this tag will render the <button> control in the HTML markup, rather than the <input type="
 void setTabindex(int tabindex)
          Sets the tabIndex of the rendered html tag.
 void setTargetScope(String targetScope)
          Set the target "scope" for the button's action.
 void setType(String type)
          Set the type of the Button (submit, button, or reset).
 void setValue(String value)
          Set the value of the Button's text.
 
Methods inherited from class HtmlFocusBaseTag
isDisabled, setDisabled, setOnBlur, setOnChange, setOnFocus, setOnSelect
 
Methods inherited from class HtmlBaseTag
getJavaScriptAttribute, getOnClick, getTagId, renderDefaultNameAndId, renderNameAndId, setDir, setLang, setOnClick, setOnDblClick, setOnKeyDown, setOnKeyPress, setOnKeyUp, setOnMouseDown, setOnMouseMove, setOnMouseOut, setOnMouseOver, setOnMouseUp, setStateAttribute, setStyle, setStyleClass, setTagId, setTitle
 
Methods inherited from class AbstractClassicTag
applyNamingChain, getErrorsReport, getIdForTagId, getNamingChain, getNearestForm, getNextId, getScriptReporter, getUserLocale, hasErrors, qualifyAttribute, registerTagError, registerTagError, reportAndExit, reportErrors, rewriteName, setNonEmptyValueAttribute, setRequiredValueAttribute, write
 
Methods inherited from class BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, release, setBodyContent
 
Methods inherited from class TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface IHtmlCore
setStyle, setStyleClass, setTagId, setTitle
 
Methods inherited from interface Tag
getParent, setPageContext, setParent
 

Field Detail

ACTION_OVERRIDE

public static final String ACTION_OVERRIDE
See Also:
Constant Field Values
Constructor Detail

Button

public Button()
Method Detail

getTagName

public String getTagName()
Return the name of the Tag.

Specified by:
getTagName in interface INetuiTag
Specified by:
getTagName in class AbstractClassicTag
Returns:
the name of the tag.

getState

protected AbstractHtmlState getState()
This method will return the state associated with the tag. This is used by this base class to access the individual state objects created by the tags.

Specified by:
getState in class HtmlBaseTag
Returns:
a subclass of the AbstractHtmlState class.

setAttribute

public void setAttribute(String name,
                         String value,
                         String facet)
                  throws JspException
Base support for the attribute tag. This is overridden to prevent setting the type and value attributes.

Specified by:
setAttribute in interface IAttributeConsumer
Overrides:
setAttribute in class HtmlBaseTag
Parameters:
name - The name of the attribute. This value may not be null or the empty string.
value - The value of the attribute.
facet - The name of a facet to which the attribute will be applied. This is optional.
Throws:
JspException - A JspException may be thrown if there is an error setting the attribute.

setAction

public void setAction(String action)
               throws JspException
Set the name of the action for the Button.

Parameters:
action - the name of the action to set for the Button.
Throws:
JspException

setTargetScope

public void setTargetScope(String targetScope)
Set the target "scope" for the button's action. Multiple active page flows may exist concurrently within named scopes. This attribute selects which named scope to use. If omitted, the default scope is assumed.

Parameters:
targetScope - the name of the target scope in which the associated action's page flow resides.

setType

public void setType(String type)
             throws JspException
Set the type of the Button (submit, button, or reset).

Parameters:
type - the type of the Button.
Throws:
JspException

setValue

public void setValue(String value)
              throws JspException
Set the value of the Button's text.

Parameters:
value - the value of the Button's text.
Throws:
JspException

setPopup

public void setPopup(boolean popup)
Sets the popup indicator.

Parameters:
popup - whether or not the button should open a popup window.

setDisableSecondClick

public void setDisableSecondClick(boolean disableSecondClick)
When true, this button will disable itself before submitting.

Parameters:
disableSecondClick - when true, this button will disable itself before submitting.

setRenderAsButton

public void setRenderAsButton(boolean renderAsButton)
When set to true, this tag will render the <button> control in the HTML markup, rather than the <input type="..."> element. The evaluated content between the start and end tags will be written out as the content between the rendered HTML <button> and </button>.

Please note that using an action override and rendering the markup with a <button> control will not work in Internet Explorer. Internet Explorer includes the name and value of every <button> control in the HTML form as parameters in the request query, regardless of whether the button has been clicked or not.

Parameters:
renderAsButton - whether or not to render a <button> rather than an <input> tag.

addParameter

public void addParameter(String name,
                         Object value,
                         String facet)
                  throws JspException
Adds a URL parameter to the generated hyperlink.

Specified by:
addParameter in interface IUrlParams
Parameters:
name - the name of the parameter to be added.
value - the value of the parameter to be added (a String or String[]).
facet -
Throws:
JspException

doStartTag

public int doStartTag()
               throws JspException
Process the start of the Button.

Specified by:
doStartTag in interface Tag
Overrides:
doStartTag in class BodyTagSupport
Throws:
JspException - if a JSP exception has occurred

doAfterBody

public int doAfterBody()
                throws JspException
Save the associated button label from the body content (if any). By default, we render the HTML markup with an <input> tag and if the value attribute is null then we will use the body content as the value attribute.

However, if the renderAsButton attribute is set to true, then we render the HTML markup with an HTML <button> tag, using the value attribute, and placing the evaluated body content as the content between the begin and end HTML button tags.

Specified by:
doAfterBody in interface IterationTag
Overrides:
doAfterBody in class BodyTagSupport
Throws:
JspException - if a JSP exception has occurred

doEndTag

public int doEndTag()
             throws JspException
Render the button.

Specified by:
doEndTag in interface Tag
Overrides:
doEndTag in class BodyTagSupport
Throws:
JspException - if a JSP exception has occurred

localRelease

protected void localRelease()
Release any acquired resources.

Overrides:
localRelease in class HtmlFocusBaseTag

setAccessKey

public void setAccessKey(char accessKey)
Sets the accessKey attribute value. This should key value of the keyboard navigation key. It is recommended not to use the following values because there are often used by browsers A, C, E, F, G, H, V, left arrow, and right arrow.

Specified by:
setAccessKey in interface IHtmlAccessable
Parameters:
accessKey - the accessKey value.

setAlt

public void setAlt(String alt)
Sets the alt attribute value.

Specified by:
setAlt in interface IHtmlAccessable
Parameters:
alt - the alt value.

setTabindex

public void setTabindex(int tabindex)
Sets the tabIndex of the rendered html tag.

Parameters:
tabindex - the tab index.

getPopupSupport

public PopupSupport getPopupSupport()
Get a helper to provide popup support.