home *** CD-ROM | disk | FTP | other *** search
- class com.techsmith.widgets.button.TSRadioButtonGroup implements com.techsmith.utils.events.IEventDispatcher
- {
- var m_dispatcher = null;
- var m_radioGroup = null;
- var m_selected = null;
- function TSRadioButtonGroup()
- {
- this.m_dispatcher = new com.techsmith.utils.events.EventDispatcher();
- this.m_radioGroup = new Array();
- }
- function addRadioButton(button)
- {
- var _loc4_ = this.m_radioGroup.length;
- var _loc2_ = 0;
- while(_loc2_ < _loc4_)
- {
- if(button == this.m_radioGroup[_loc2_])
- {
- return undefined;
- }
- _loc2_ = _loc2_ + 1;
- }
- this.m_radioGroup.push(button);
- button.addEventListener("click",this);
- }
- function removeRadioButton(button)
- {
- var _loc4_ = this.m_radioGroup.length;
- var _loc2_ = 0;
- while(_loc2_ < _loc4_)
- {
- if(button == this.m_radioGroup[_loc2_])
- {
- this.m_radioGroup.splice(_loc2_,1);
- button.removeEventListener("click",this);
- }
- _loc2_ = _loc2_ + 1;
- }
- }
- function onUnload()
- {
- var _loc3_ = this.m_radioGroup.length;
- var _loc2_ = 0;
- while(_loc2_ < _loc3_)
- {
- this.m_radioGroup[_loc2_].removeEventListener("click",this);
- _loc2_ = _loc2_ + 1;
- }
- this.m_dispatcher.removeAllListeners();
- }
- function enforceSelectionRules(e)
- {
- var _loc3_ = this.m_radioGroup.length;
- var _loc2_ = 0;
- while(_loc2_ < _loc3_)
- {
- if(this.m_radioGroup[_loc2_] != e)
- {
- this.m_radioGroup[_loc2_].setSelected(false);
- }
- else
- {
- this.m_selected = this.m_radioGroup[_loc2_];
- }
- _loc2_ = _loc2_ + 1;
- }
- }
- function setSelected(button)
- {
- this.m_selected = button;
- button.setSelected(true);
- this.enforceSelectionRules(button);
- }
- function setEnabled(enabled)
- {
- var _loc3_ = this.m_radioGroup.length;
- var _loc2_ = 0;
- while(_loc2_ < _loc3_)
- {
- this.m_radioGroup[_loc2_].setEnabled(enabled);
- _loc2_ = _loc2_ + 1;
- }
- }
- function getSelected()
- {
- return this.m_selected;
- }
- function getSelectedName()
- {
- return this.m_selected._name;
- }
- function getValue()
- {
- return this.m_selected.getValue();
- }
- function getLabel()
- {
- return this.m_selected.getLabel();
- }
- function getData()
- {
- return this.m_selected.getData();
- }
- function setData(data)
- {
- if(this.m_selected != null || this.m_selected != undefined)
- {
- this.m_selected.setData(data);
- return true;
- }
- return false;
- }
- function click(e)
- {
- this.dispatchEvent({target:this,type:"click",button:e.target});
- }
- function sendEvent(e)
- {
- this.dispatchEvent(e);
- }
- function addEventListener(event, scope)
- {
- this.m_dispatcher.addEventListener(event,scope);
- }
- function removeEventListener(event, scope)
- {
- this.m_dispatcher.removeEventListener(event,scope);
- }
- function dispatchEvent(eventObj)
- {
- this.m_dispatcher.dispatchEvent(eventObj);
- }
- }
-