(function(){u8.Base.Widgets.FormDesignerEventInput=function(e,t){this.Widget(e,$.extend({},u8.Base.Widgets.FormDesignerEventInput.defaults,t));this.commandBindings={Edit:this._onCommandEdit.bind(this)};this._create();if(this.value){this.withoutEvents(function(){this.setValue(this.value)});delete this.value}};u8.Base.Widgets.FormDesignerEventInput.makeClass({name:"FormDesignerEventInput",deriveFrom:u8.Base.Widgets.Widget,events:["ValueChange"]});u8.Base.Widgets.FormDesignerEventInput.defaults={};$.extend(u8.Base.Widgets.FormDesignerEventInput.prototype,{setValue:function(e){this.value=e;$u(".TextInput",this).setValue(this._buildTextValue());this.raise("ValueChange",{value:e})},getValue:function(){return this.value},_create:function(){this.empty();this.$("<div/>").appendTo(this.element).widget("TextInput",{parent:this,readonly:true,autoDisableActions:false,value:this._buildTextValue(),actions:[{image:"u8-img-edit-s",command:"Edit",title:"Edit the event handler"}]})},_buildTextValue:function(){var e=this.getValue();if(!e){return""}if(e.handlerType=="Action"){return"Action '"+(e.handler||"")+"'"}return"Function '"+(e.handler||"").ellipses(20)+"'"},edit:function(e){var t=this;u8.Base.Widgets.FormDesignerEventEditor.showAsPopup({popup:e&&e.popup,parent:this,value:this.getValue(),onApply:function(e){t.setValue(e.getValue())}})},_onCommandEdit:function(e,t,i){var n=i.elEvent&&i.elEvent.target;this.edit({popup:{alignTo:n}})}})})();