Yahoo! UI Library

Button  2.5.2

Yahoo! UI Library > button > YAHOO.widget.ButtonGroup

Show Private Show Protected

Class YAHOO.widget.ButtonGroup - extends YAHOO.util.Element

The ButtonGroup class creates a set of buttons that are mutually exclusive; checking one button in the set will uncheck all others in the button group.

Constructor

YAHOO.widget.ButtonGroup ( p_oElement , p_oAttributes )
Parameters:
p_oElement <String> String specifying the id attribute of the <div> element of the button group.
p_oElement <HTMLDivElement> Object specifying the <div> element of the button group.
p_oElement <Object> Object literal specifying a set of configuration attributes used to create the button group.
p_oAttributes <Object> Optional. Object literal specifying a set of configuration attributes used to create the button group.

Properties

_buttons - protected Array

Array of buttons in the button group.
Default Value: null

CSS_CLASS_NAME - final String

String representing the CSS class(es) to be applied to the button group's element.
Default Value: "yui-buttongroup"

NODE_NAME - final String

The name of the tag to be used for the button group's element.
Default Value: "DIV"

Properties inherited from YAHOO.util.Element:

Properties inherited from YAHOO.util.AttributeProvider:

Methods

_createGroupElement

protected HTMLDivElement _createGroupElement ( )
Creates the button group's element.
Returns: HTMLDivElement

_onAppendTo

protected void _onAppendTo ( p_oEvent )
"appendTo" event handler for the button group.
Parameters:
p_oEvent <Event> Object representing the event that was fired.
Returns: void

_onButtonCheckedChange

protected void _onButtonCheckedChange ( p_oEvent , p_oButton )
"checkedChange" event handler for each button in the button group.
Parameters:
p_oEvent <Event> Object representing the event that was fired.
p_oButton <YAHOO.widget.Button> Object representing the button that fired the event.
Returns: void

_onKeyDown

protected void _onKeyDown ( p_oEvent )
"keydown" event handler for the button group.
Parameters:
p_oEvent <Event> Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).
Returns: void

_setDisabled

protected void _setDisabled ( p_bDisabled )
Sets the value of the button groups's "disabled" attribute.
Parameters:
p_bDisabled <Boolean> Boolean indicating the value for the button group's "disabled" attribute.
Returns: void

addButton

YAHOO.widget.Button addButton ( p_oButton )
Adds the button to the button group.
Parameters:
p_oButton <YAHOO.widget.Button> Object reference for the YAHOO.widget.Button instance to be added to the button group.
p_oButton <String> String specifying the id attribute of the <input> or <span> element to be used to create the button to be added to the button group.
p_oButton <HTMLInputElement|HTMLElement> Object reference for the <input> or <span> element to be used to create the button to be added to the button group.
p_oButton <Object> Object literal specifying a set of YAHOO.widget.Button configuration attributes used to configure the button to be added to the button group.
Returns: YAHOO.widget.Button

addButtons

Array addButtons ( p_aButtons )
Adds the array of buttons to the button group.
Parameters:
p_aButtons <Array> Array of YAHOO.widget.Button instances to be added to the button group.
p_aButtons <Array> Array of strings specifying the id attribute of the <input> or <span> elements to be used to create the buttons to be added to the button group.
p_aButtons <Array> Array of object references for the <input> or <span> elements to be used to create the buttons to be added to the button group.
p_aButtons <Array> Array of object literals, each containing a set of YAHOO.widget.Button configuration attributes used to configure each button to be added to the button group.
Returns: Array

check

void check ( p_nIndex )
Checks the button at the specified index.
Parameters:
p_nIndex <Number> Number indicating the index of the button to check.
Returns: void

destroy

void destroy ( )
Removes the button group's element from its parent element and removes all event handlers.
Returns: void

focus

void focus ( p_nIndex )
Sets focus to the button at the specified index.
Parameters:
p_nIndex <Number> Number indicating the index of the button to focus.
Returns: void

getButton

YAHOO.widget.Button getButton ( p_nIndex )
Returns the button at the specified index.
Parameters:
p_nIndex <Number> The index of the button to retrieve from the button group.
Returns: YAHOO.widget.Button

getButtons

Array getButtons ( )
Returns an array of the buttons in the button group.
Returns: Array

getCount

Number getCount ( )
Returns the number of buttons in the button group.
Returns: Number

init

void init ( p_oElement , p_oAttributes )
The ButtonGroup class's initialization method.
Parameters:
p_oElement <String> String specifying the id attribute of the <div> element of the button group.
p_oElement <HTMLDivElement> Object specifying the <div> element of the button group.
p_oElement <Object> Object literal specifying a set of configuration attributes used to create the button group.
p_oAttributes <Object> Optional. Object literal specifying a set of configuration attributes used to create the button group.
Returns: void

initAttributes

void initAttributes ( p_oAttributes )
Initializes all of the configuration attributes used to create the button group.
Parameters:
p_oAttributes <Object> Object literal specifying a set of configuration attributes used to create the button group.
Returns: void

removeButton

void removeButton ( p_nIndex )
Removes the button at the specified index from the button group.
Parameters:
p_nIndex <Number> Number specifying the index of the button to be removed from the button group.
Returns: void

toString

String toString ( )
Returns a string representing the button group.
Returns: String

Events

beforeCheckedButtonChange

beforeCheckedButtonChange ( eventInfo )
Fires before the value for the configuration attribute 'checkedButton' changes. Return false to cancel the attribute change.
Parameters:
eventInfo <{oldValue: any, newValue: any}> An object containing the current attribute value and the new value.

beforeContainerChange

beforeContainerChange ( eventInfo )
Fires before the value for the configuration attribute 'container' changes. Return false to cancel the attribute change.
Parameters:
eventInfo <{oldValue: any, newValue: any}> An object containing the current attribute value and the new value.

beforeDisabledChange

beforeDisabledChange ( eventInfo )
Fires before the value for the configuration attribute 'disabled' changes. Return false to cancel the attribute change.
Parameters:
eventInfo <{oldValue: any, newValue: any}> An object containing the current attribute value and the new value.

beforeNameChange

beforeNameChange ( eventInfo )
Fires before the value for the configuration attribute 'name' changes. Return false to cancel the attribute change.
Parameters:
eventInfo <{oldValue: any, newValue: any}> An object containing the current attribute value and the new value.

beforeValueChange

beforeValueChange ( eventInfo )
Fires before the value for the configuration attribute 'value' changes. Return false to cancel the attribute change.
Parameters:
eventInfo <{oldValue: any, newValue: any}> An object containing the current attribute value and the new value.

checkedButtonChange

checkedButtonChange ( eventInfo )
Fires when the value for the configuration attribute 'checkedButton' changes.
Parameters:
eventInfo <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

containerChange

containerChange ( eventInfo )
Fires when the value for the configuration attribute 'container' changes.
Parameters:
eventInfo <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

disabledChange

disabledChange ( eventInfo )
Fires when the value for the configuration attribute 'disabled' changes.
Parameters:
eventInfo <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

nameChange

nameChange ( eventInfo )
Fires when the value for the configuration attribute 'name' changes.
Parameters:
eventInfo <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

valueChange

valueChange ( eventInfo )
Fires when the value for the configuration attribute 'value' changes.
Parameters:
eventInfo <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

Configuration Attributes

checkedButton - {YAHOO.widget.Button}

Reference for the button in the button group that is checked.
Default Value: null

container - HTMLElement|String

HTML element reference or string specifying the id attribute of the HTML element that the button group's markup should be rendered into.
Default Value: null

disabled - Boolean

Boolean indicating if the button group should be disabled. Disabling the button group will disable each button in the button group. Disabled buttons are dimmed and will not respond to user input or fire events.
Default Value: false

name - String

String specifying the name for the button group. This name will be applied to each button in the button group.
Default Value: null

value - Object

Object specifying the value for the button group.
Default Value: null

Configuration attributes inherited from YAHOO.util.Element:


Copyright © 2007 Yahoo! Inc. All rights reserved.