(function() {

    var Ext = window.Ext4 || window.Ext;

    /**
     * The RadioField component provides an easy way to create a radio button field
     *
     *     @example
     *     Ext.create('Ext.Container', {
     *         items: [{
     *             xtype: 'rallyradiofield',
     *             fieldLabel: 'my radio field',
     *             name: 'size',
     *             inputValue: 'large',
     *             value: true
     *         }],
     *         renderTo: Ext.getBody().dom
     *     });
     */
    Ext.define('Rally.ui.RadioField', {
        requires: [],
        extend : 'Ext.form.field.Radio',
        alias: 'widget.rallyradiofield',

        stateEvents: ['change'],

        cls: 'rally-radiofield-component',

        getState: function() {
            return {
                checked: this.isChecked(this.getValue())
            };
        },

        applyState: function(state) {
            this.setValue(state.checked);
        }
    });
})();