Sha256: e76d814a9e99797a3342f79bfa7a2de5f88a798eeed57c1ffe94da3c1fe1f8a3

Contents?: true

Size: 1.55 KB

Versions: 12

Compression:

Stored size: 1.55 KB

Contents

// ========================================================================
// SproutCore
// copyright 2006-2008 Sprout Systems, Inc.
// ========================================================================

require('views/view') ;

// RadioGroupView manages a collection of buttons as a single value.  To 
// use this view, just assign your buttons as outlets. This will use the
// toggleOnValue you have already set.
SC.RadioGroupView = SC.View.extend({
   
   // this is the current value or values of the radio group view.  The
   // items in the radio group will be selected based on this value.
   value: null,
   
   // enable/disable the views in this group view.
   isEnabled: true,

   // PRIVATE METHODS
   init: function() {
     arguments.callee.base.apply(this, arguments) ;
     
     // find the list of buttons to update and set them up.
     var loc = this.outlets.length ;
     var ret = [] ;
     var valuePropertyPath = [this,'value'];
     while(--loc >= 0) {
       var key = this.outlets[loc] ;
       var button = this[key] ;
       if (button && (button.toggleOnValue !== undefined)) {
         button.bind('value', valuePropertyPath) ;
         ret.push(button);
       }
     }
     this._radioButtons = ret ;
   },

   // forward changes to the isEnabled property to children.
   _isEnabledObserver: function() {
     var newFlag = this.get('isEnabled') ;
     if (!this.didChangeFor('_isEnabled','isEnabled')) return ;
     if (this.radioButtons) {
       this.radioButtons.invoke('set','isEnabled',newFlag) ;
     }
   }.observes('isEnabled')   
   
}) ; 

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sproutcore-0.9.10 frameworks/sproutcore/views/radio_group.js
sproutcore-0.9.12 frameworks/sproutcore/views/radio_group.js
sproutcore-0.9.11 frameworks/sproutcore/views/radio_group.js
sproutcore-0.9.13 frameworks/sproutcore/views/radio_group.js
sproutcore-0.9.2 frameworks/sproutcore/views/radio_group.js
sproutcore-0.9.3 frameworks/sproutcore/views/radio_group.js
sproutcore-0.9.4 frameworks/sproutcore/views/radio_group.js
sproutcore-0.9.5 frameworks/sproutcore/views/radio_group.js
sproutcore-0.9.6 frameworks/sproutcore/views/radio_group.js
sproutcore-0.9.9 frameworks/sproutcore/views/radio_group.js
sproutcore-0.9.7 frameworks/sproutcore/views/radio_group.js
sproutcore-0.9.8 frameworks/sproutcore/views/radio_group.js