fcf.module({
  name: "fcfControls:templates/checkbox.wrapper.js",
  dependencies: ["fcfControls:templates/view.wrapper.js"],
  module: function(Wrapper){
    return class WrapperEx extends Wrapper{
      
      constructor(a_initializeOptions){
        super(a_initializeOptions);
      }

      getActionDomElement(){
        return fcf.select(this.getDomElement(), "input")[0];
      }

      onClick(a_event){
        this.setArg("value", !!this.getActionDomElement().checked);
      }

      onArgValue(a_value){
        let checked = a_value === true || a_value === 1;
        this.getActionDomElement().checked = checked;
        if (checked)
          this.getActionDomElement().setAttribute("checked", "checked");
        else
          this.getActionDomElement().removeAttribute("checked");
      }

    };
  }
});
