protected
void
_addListenersToForm
(
)
Adds event handlers to the button's form.
protected
HTMLElement
_createButtonElement
(
p_sType
)
Creates the button's element.
- Parameters:
-
p_sType <String>
String indicating the type of element to create.
- Returns:
HTMLElement
protected
void
_hideMenu
(
)
Hides the button's menu.
protected
Boolean
_isActivationKey
(
p_nKeyCode
)
Determines if the specified keycode is one that toggles the
button's "active" state.
- Parameters:
-
p_nKeyCode <Number>
Number representing the keycode to be evaluated.
- Returns:
Boolean
protected
Boolean
_isSplitButtonOptionKey
(
p_oEvent
)
Determines if the specified keycode is one that toggles the
display of the split button's menu.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
- Returns:
Boolean
protected
void
_onAppendTo
(
p_oEvent
)
"appendTo" event handler for the button.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
- Returns:
void
protected
void
_onBlur
(
p_oEvent
)
"blur" event handler for the button.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
- Returns:
void
protected
void
_onClick
(
p_oEvent
)
"click" event handler for the button.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
- Returns:
void
protected
void
_onDocumentKeyUp
(
p_oEvent
)
"keyup" event handler for the document.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
- Returns:
void
protected
void
_onDocumentMouseDown
(
p_oEvent
)
"mousedown" event handler for the document.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
- Returns:
void
protected
void
_onDocumentMouseUp
(
p_oEvent
)
"mouseup" event handler for the button.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
- Returns:
void
protected
void
_onFocus
(
p_oEvent
)
"focus" event handler for the button.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
- Returns:
void
protected
void
_onFormReset
(
p_oEvent
)
"reset" event handler for the button's form.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
- Returns:
void
protected
void
_onFormSubmit
(
p_oEvent
)
"submit" event handler for the button's form.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
- Returns:
void
protected
void
_onKeyDown
(
p_oEvent
)
"keydown" event handler for the button.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
- Returns:
void
protected
void
_onKeyUp
(
p_oEvent
)
"keyup" event handler for the button.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
- Returns:
void
private
void
_onMenuClick
(
p_sType
,
p_aArgs
)
"click" event handler for the button's menu.
- Parameters:
-
p_sType <String>
String representing the name of the event that
was fired.
-
p_aArgs <Array>
Array of arguments sent when the event was fired.
- Returns:
void
private
void
_onMenuHide
(
p_sType
,
p_aArgs
)
"hide" event handler for the button's menu.
- Parameters:
-
p_sType <String>
String representing the name of the event that
was fired.
-
p_aArgs <Array>
Array of arguments sent when the event was fired.
- Returns:
void
private
void
_onMenuItemAdded
(
p_sType
,
p_aArgs
,
p_oItem
)
"itemadded" event handler for the button's menu.
- Parameters:
-
p_sType <String>
String representing the name of the event that
was fired.
-
p_aArgs <Array>
Array of arguments sent when the event was fired.
-
p_oItem <YAHOO.widget.MenuItem>
Object representing the menu item that subscribed to the event.
- Returns:
void
private
void
_onMenuItemSelected
(
p_sType
,
p_aArgs
,
p_oItem
)
"selectedchange" event handler for each item in the
button's menu.
- Parameters:
-
p_sType <String>
String representing the name of the event that
was fired.
-
p_aArgs <Array>
Array of arguments sent when the event was fired.
-
p_oItem <YAHOO.widget.MenuItem>
Object representing the menu item that subscribed to the event.
- Returns:
void
private
void
_onMenuKeyDown
(
p_sType
,
p_aArgs
)
"keydown" event handler for the button's menu.
- Parameters:
-
p_sType <String>
String representing the name of the event that
was fired.
-
p_aArgs <Array>
Array of arguments sent when the event was fired.
- Returns:
void
private
void
_onMenuRender
(
p_sType
,
p_aArgs
)
"render" event handler for the button's menu.
- Parameters:
-
p_sType <String>
String representing the name of the event that
was fired.
-
p_aArgs <Array>
Array of arguments sent when the event was fired.
- Returns:
void
private
void
_onMenuShow
(
p_sType
,
p_aArgs
)
"show" event handler for the button's menu.
- Parameters:
-
p_sType <String>
String representing the name of the event that
was fired.
-
p_aArgs <Array>
Array of arguments sent when the event was fired.
- Returns:
void
protected
void
_onMouseDown
(
p_oEvent
)
"mousedown" event handler for the button.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
- Returns:
void
protected
void
_onMouseOut
(
p_oEvent
)
"mouseout" event handler for the button.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
- Returns:
void
protected
void
_onMouseOver
(
p_oEvent
)
"mouseover" event handler for the button.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
- Returns:
void
protected
void
_onMouseUp
(
p_oEvent
)
"mouseup" event handler for the button.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
- Returns:
void
protected
void
_onOption
(
p_oEvent
)
"option" event handler for the button.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
- Returns:
void
protected
void
_setAccessKey
(
p_sAccessKey
)
Sets the value of the button's "accesskey" attribute.
- Parameters:
-
p_sAccessKey <String>
String indicating the value for the button's
"accesskey" attribute.
- Returns:
void
protected
void
_setChecked
(
p_bChecked
)
Sets the value of the button's "target" attribute.
- Parameters:
-
p_bChecked <Boolean>
Boolean indicating the value for the button's
"checked" attribute.
- Returns:
void
protected
void
_setDisabled
(
p_bDisabled
)
Sets the value of the button's "disabled" attribute.
- Parameters:
-
p_bDisabled <Boolean>
Boolean indicating the value for the button's
"disabled" attribute.
- Returns:
void
protected
void
_setHref
(
p_sHref
)
Sets the value of the button's "href" attribute.
- Parameters:
-
p_sHref <String>
String indicating the value for the button's
"href" attribute.
- Returns:
void
protected
void
_setLabel
(
p_sLabel
)
Sets the value of the button's "label" attribute.
- Parameters:
-
p_sLabel <String>
String indicating the value for the button's
"label" attribute.
- Returns:
void
protected
void
_setMenu
(
p_oMenu
)
Sets the value of the button's "menu" attribute.
- Parameters:
-
p_oMenu <Object>
Object indicating the value for the button's
"menu" attribute.
- Returns:
void
protected
void
_setOnClick
(
p_oObject
)
Sets the value of the button's "onclick" attribute.
- Parameters:
-
p_oObject <Object>
Object indicating the value for the button's
"onclick" attribute.
- Returns:
void
protected
void
_setTabIndex
(
p_nTabIndex
)
Sets the value of the button's "tabindex" attribute.
- Parameters:
-
p_nTabIndex <Number>
Number indicating the value for the button's
"tabindex" attribute.
- Returns:
void
protected
void
_setTarget
(
p_sTarget
)
Sets the value of the button's "target" attribute.
- Parameters:
-
p_sTarget <String>
String indicating the value for the button's
"target" attribute.
- Returns:
void
protected
void
_setTitle
(
p_nTabIndex
)
Sets the value of the button's "title" attribute.
- Parameters:
-
p_nTabIndex <String>
Number indicating the value for the button's
"title" attribute.
- Returns:
void
protected
void
_setType
(
p_sType
)
Sets the value of the button's "type" attribute.
- Parameters:
-
p_sType <String>
String indicating the value for the button's
"type" attribute.
- Returns:
void
protected
void
_showMenu
(
p_oEvent
)
Shows the button's menu.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event) that triggered the display of
the menu.
- Returns:
void
void
addHiddenFieldsToForm
(
p_oForm
)
Searches the specified form and adds hidden fields for instances
of YAHOO.widget.Button that are of type "radio," "checkbox," "menubutton,"
and "splitbutton."
- Parameters:
-
p_oForm <HTMLFormElement>
Object reference
for the form to search.
- Returns:
void
void
blur
(
)
Causes the button to lose focus and fires the button's
"blur" event.
HTMLInputElement
createHiddenField
(
)
Creates the button's hidden form field and appends it to its
parent form.
private
HTMLInputElement
createInputElement
(
p_sType
,
p_sName
,
p_sValue
,
p_bChecked
)
Creates an <input>
element of the
specified type.
- Parameters:
-
p_sType <String>
String specifying the type of
<input>
element to create.
-
p_sName <String>
String specifying the name of
<input>
element to create.
-
p_sValue <String>
String specifying the value of
<input>
element to create.
-
p_bChecked <String>
Boolean specifying if the
<input>
element is to be checked.
- Returns:
HTMLInputElement
void
destroy
(
)
Removes the button's element from its parent element and
removes all event handlers.
void
focus
(
)
Causes the button to receive the focus and fires the button's
"focus" event.
private
HTMLElement
getFirstElement
(
p_oElement
)
Returns an HTML element's first HTML element node.
- Parameters:
-
p_oElement <HTMLElement>
Object
reference specifying the element to be evaluated.
- Returns:
HTMLElement
HTMLFormElement
getForm
(
)
Returns a reference to the button's parent form.
HTMLInputElement
getHiddenField
(
)
Returns a reference to the <input>
element
used when the button's parent form is submitted.
Boolean
hasFocus
(
)
Returns a boolean indicating whether or not the button has focus.
void
init
(
p_oElement
,
p_oAttributes
)
The Button class's initialization method.
- Parameters:
-
p_oElement <String>
String specifying the id attribute of the
<input>
, <a>
or
<span>
element to be used to create the button.
-
p_oElement <HTMLInputElement|HTMLElement>
Object reference for the
<input>
, <a>
or
<span>
element to be used to create the button.
-
p_oElement <Object>
Object literal specifying a set of configuration
attributes used to create the button.
-
p_oAttributes <Object>
Optional. Object literal specifying a set of
configuration attributes used to create the button.
- Returns:
void
void
initAttributes
(
p_oAttributes
)
Initializes all of the configuration attributes used to create
the button.
- Parameters:
-
p_oAttributes <Object>
Object literal specifying a set of
configuration attributes used to create the button.
- Returns:
void
private
void
initConfig
(
Object
)
Initializes the set of configuration attributes that are used to
instantiate the button.
- Parameters:
-
Object <Object>
representing the button's set of
configuration attributes.
- Returns:
void
Boolean
isActive
(
)
Returns a boolean indicating whether or not the button is active.
void
onFormKeyDown
(
p_oEvent
)
"keydown" event handler for the button's form.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
- Returns:
void
private
void
setAttributeFromDOMAttribute
(
p_sAttribute
)
Gets the value of the specified DOM attribute and sets it
into the collection of configuration attributes used to configure
the button.
- Parameters:
-
p_sAttribute <String>
String representing the name of the
attribute to retrieve from the DOM element.
- Returns:
void
private
void
setAttributesFromSrcElement
(
p_oElement
,
p_oAttributes
)
Gets the values for all the attributes of the source element
(either <input>
or <a>
) that map to
Button configuration attributes and sets them into a collection that is
passed to the Button constructor.
- Parameters:
-
p_oElement <HTMLInputElement|HTMLAnchorElement>
Object reference to the HTML
element (either <input>
or <span>
)
used to create the button.
-
p_oAttributes <Object>
Object reference for the collection of
configuration attributes used to create the button.
- Returns:
void
private
void
setFormElementProperties
(
)
Gets the value of the attributes from the form element and
sets them into the collection of configuration attributes used to
configure the button.
protected
void
submitForm
(
)
Submits the form to which the button belongs.
String
toString
(
)
Returns a string representing the button.