content: /*
  jQWidgets v4.5.0 (2017-Jan)
  Copyright (c) 2011-2017 jQWidgets.
  License: http://jqwidgets.com/license/
  */
  import React from 'react';
  
  let jqxRating = React.createClass ({
    getInitialState: function () {
      return { value: '' };
    },
    componentDidMount: function () {
        let options = this.manageAttributes();
      this.createComponent(options);
    },
    manageAttributes: function () {
        let properties = ['count','disabled','height','itemHeight','itemWidth','precision','singleVote','value','width'];
        let options = {};
      for(let item in this.props) {
          if(item === 'settings') {
            for(let itemTwo in this.props[item]) {
              options[itemTwo] = this.props[item][itemTwo];
                }
            } else {
                if(properties.indexOf(item) !== -1) {
                options[item] = this.props[item];
                }
            }
        }
        return options;
      },
    createComponent : function (options) {
      if(!this.style) {
          for (let style in this.props.style) {
            $('#' +this.componentSelector).css(style, this.props.style[style]);
          }
      }
      if(this.props.className !== undefined) {
        let classes = this.props.className.split(' ');
        for (let i = 0; i < classes.length; i++ ) {
          $('#' +this.componentSelector).addClass(classes[i]);
        }
      }
      if(!this.template) {
          $('#' +this.componentSelector).html(this.props.template);
      }
      $('#' +this.componentSelector).jqxRating(options);
    },
    generateID : function () {    
      return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
    },
    setOptions: function (options) {
      $('#' +this.componentSelector).jqxRating('setOptions', options);
    },
    getOptions: function () {
      if(arguments.length === 0) {
        throw Error('At least one argument expected in getOptions()!');
      }
      let resultToReturn = {};
      for(let i = 0; i < arguments.length; i++) {
        resultToReturn[arguments[i]] = $('#' +this.componentSelector).jqxRating(arguments[i]);
      }
      return resultToReturn;
    },
    on: function (name,callbackFn) {
      $('#' +this.componentSelector).on(name,callbackFn);
    },
    off: function (name) {
      $('#' +this.componentSelector).off(name);
    },
    count: function (arg) {
      if (arg !== undefined) {
        $("#" +this.componentSelector).jqxRating("count", arg)
      } else {
        return $("#" +this.componentSelector).jqxRating("count");
      }
    },
    disabled: function (arg) {
      if (arg !== undefined) {
        $("#" +this.componentSelector).jqxRating("disabled", arg)
      } else {
        return $("#" +this.componentSelector).jqxRating("disabled");
      }
    },
    height: function (arg) {
      if (arg !== undefined) {
        $("#" +this.componentSelector).jqxRating("height", arg)
      } else {
        return $("#" +this.componentSelector).jqxRating("height");
      }
    },
    itemHeight: function (arg) {
      if (arg !== undefined) {
        $("#" +this.componentSelector).jqxRating("itemHeight", arg)
      } else {
        return $("#" +this.componentSelector).jqxRating("itemHeight");
      }
    },
    itemWidth: function (arg) {
      if (arg !== undefined) {
        $("#" +this.componentSelector).jqxRating("itemWidth", arg)
      } else {
        return $("#" +this.componentSelector).jqxRating("itemWidth");
      }
    },
    precision: function (arg) {
      if (arg !== undefined) {
        $("#" +this.componentSelector).jqxRating("precision", arg)
      } else {
        return $("#" +this.componentSelector).jqxRating("precision");
      }
    },
    singleVote: function (arg) {
      if (arg !== undefined) {
        $("#" +this.componentSelector).jqxRating("singleVote", arg)
      } else {
        return $("#" +this.componentSelector).jqxRating("singleVote");
      }
    },
    value: function (arg) {
      if (arg !== undefined) {
        $("#" +this.componentSelector).jqxRating("value", arg)
      } else {
        return $("#" +this.componentSelector).jqxRating("value");
      }
    },
    width: function (arg) {
      if (arg !== undefined) {
        $("#" +this.componentSelector).jqxRating("width", arg)
      } else {
        return $("#" +this.componentSelector).jqxRating("width");
      }
    },
    disable: function () {
      $("#" +this.componentSelector).jqxRating("disable");  
    },
    enable: function () {
      $("#" +this.componentSelector).jqxRating("enable");  
    },
    getValue: function () {
      return $("#" +this.componentSelector).jqxRating("getValue");  
    },
    setValue: function (value) {
      $("#" +this.componentSelector).jqxRating("setValue", value);  
    },
    val: function (value) {
      if (value !== undefined) {
        $("#" +this.componentSelector).jqxRating("val", value)
      } else {
        return $("#" +this.componentSelector).jqxRating("val");
      }
    },
  
    render: function () {
      let id = 'jqxRating' + this.generateID() + this.generateID();
      this.componentSelector = id;    return (
        <div id={id}>{this.value ? null : this.props.value}{this.props.children}</div>
      )
    }
  });
  
  module.exports = jqxRating;
  
  