ButtonGroup.js

1 ) function: init
2 ) function: toString
3 ) function: addElement
4 ) function: select
5 ) function: deselect
6 ) function: radioButton
7 ) function: checkBox
8 ) function: close
9 ) function: index


Object: ButtonGroup

Object Description:
Example:
Inherits from: N/A - Might be a good idea to create a generic
Group class and have it inherit from there
Such a generic Group class might be useful


Notes:
Each ButtonPane has a ButtonGroup associated with it


Constructor: ButtonGroup
  • Parameter
    : type - one of:
ButtonGroup.NONE || 0
ButtonGroup.RADIO || 1
ButtonGroup.CHECKBOX || 2
  • Parameter
    : fire_event - Fire the event associated with the button


Method: init
Description: initialize this object
  • Parameter
    : type - type of button group
  • Parameter
    : fire_event - whether or not to fire the buttons
event when this button is selected


Method: toString
Description: Displays this ButtonGroup as a string
Lists the elements of the button group


Method: addElement
Description: Add an element to the button group
  • Parameter
    : button - the button to add to the group

Notes: Should probably ensure that it is a Button which has
been added


Method: select
Description: Select this button
Changes the appearance to the "selected" state


Method: deselect
Description: Deselect this button
Changes the appearance to the "deselect" state


Method: radioButton
Description: This function replaces the mousedown function of
all buttons controlled by a ButtonGroup of type
RADIOBUTTON
  • Parameter
    : evt - the event (mousedown)


Method: checkBox
Description: This function replaces the mousedown function of
all buttons controlled by a ButtonGroup of type
CHECKBOX
  • Parameter
    : evt - the event (mousedown)


Method: close
Description: close this ButtonGroup
- removes all the buttons in the group from their parent
- removes all the buttons from this ButtonGroup

Example:


Method: index
Description: return the index of desired item
return -1 if not found
  • Parameter
    : item - the desired item

Example: