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

      onArg(a_argName, a_value, a_editor, a_ignoreRedrawing, a_isInnerCall) {
        this.recalculate();
      }

      onArgValue(a_value, a_editor, a_ignoreRedrawing, a_innerCall, a_suffix){
        if (this.isChild(a_editor) && this.getArg("defaultFlag")){
          this.setArg("defaultFlag", false);
        }
      }

      onArgDefaultValue(a_value, a_editor, a_ignoreRedrawing, a_innerCall, a_suffix){
        this._resetValue();
      }

      onArgDefaultFlag(a_value, a_editor, a_ignoreRedrawing, a_innerCall, a_suffix){
        this._resetValue();
        this.update();
      }

      onClear(){
        this.setArg("value", this.getArg("defaultValue"));
        this.setArg("defaultFlag", true);
      }

      _resetValue(){
        if (this.getArg("defaultFlag"))
          this.setArg("value", this.getArg("defaultValue"));
      }

    };
  }
});
