$.widget("ui.tabNode",$.ui.sceneResource,{options:{data:null,parent:null,zoom:$.noop,onupdate:$.noop,ondelete:$.noop,addHistory:$.noop},category:"tabs",defaultValues:{type:"",id:"",rotation:0,opacity:1,zIndex:0,position:{x:0,y:0},size:{width:100,height:24},defaultText:"",emptyText:"",inputStyle:{backgroundColor:"#ffffff",borderWidth:0,borderColor:"#000000",borderRadius:0},textStyle:$.utils.defaultFont,isPassword:!1,lengthLimit:null,focus:!1,hiddenAtStart:!1},defaultInputStyle:{backgroundColor:"#ffffff",borderWidth:0,borderColor:"#000000",borderRadius:0},sourceProp:["size","defaultText","emptyText","inputStyle","textStyle","isPassword","lengthLimit","focus"],needToUpdateJson:!0,initElement:function(){var t=this,e=this.element.dblclick(function(t){$(".operate-object").hide();$(this).removeAttr("tabIndex");e.find(".cover").hide();$(this).find(".input-element").attr("disabled",!1).focus();t.stopPropagation()});this.$inner=$("<input class = 'input-element'/>").attr("disabled",!0).appendTo(e).mousedown(function(t){t&&t.stopPropagation()}).click(function(t){t&&t.stopPropagation()}).blur(function(){e.find(".cover").show();$(this).attr("disabled",!0);e.attr("tabIndex",1)}).keydown(function(e){e&&e.stopPropagation();var i=t.lengthLimit();null!==i&&$(this).val().length>=i&&[8,37,38,39,40,46,36,35].indexOf(e.keyCode)<0&&e&&e.preventDefault()}).keyup(function(e){var i=$(this).val();t.defaultText()!==i&&t.onchange("defaultText",{defaultText:i});e&&e.stopPropagation()});$("<div class = 'cover'></div>").appendTo(e).css({position:"absolute",width:"100%",height:"100%",top:0});this.initOrigin()},initData:function(){this.defaultValues.textStyle=$.utils.defaultFont;$.ui.sceneResource.prototype.initData.apply(this,arguments);this.updateDefaultText();this.updateEmptyText();this.updateInputStyle();this.updateIsPassword()},getCurrentData:function(){var t={id:this.id(),type:this.type(),position:this.position()},e=this.hiddenAtStart();e&&(t.hiddenAtStart=e);e=this.rotation();e&&(t.rotation=e);e=this.focus();e&&(t.focus=e);this.options.data.first&&(t.first=!0);!t.first;return t},getRate:function(){var t=this.defaultValues.size;return t.width/t.height},size:function(t){var e=this.elementData("size",t);if(void 0===t)return e;this.updatePreview();return void 0},defaultText:function(t){if(void 0===t)return this.elementData("defaultText");var e=this.lengthLimit();e&&t&&t.length>e&&(t=t.slice(0,e));this.elementData("defaultText",t);this.updateDefaultText()},emptyText:function(t){var e=this.elementData("emptyText",t);if(void 0===t)return e;this.updateEmptyText();return void 0},inputStyle:function(t){var e=this.elementData("inputStyle",t);if(void 0===t)return e;this.updateInputStyle();return void 0},textStyle:function(t){var e=this.elementData("textStyle",t);if(void 0===t)return e;this.updatePreview();return void 0},isPassword:function(t){var e=this.elementData("isPassword",t);if(void 0===t)return e;this.updateIsPassword();return void 0},lengthLimit:function(t){var e=this.elementData("lengthLimit",t);if(void 0===t)return e;this.updateDefaultText();return void 0},updatePreview:function(t){t||(t=this.zoomValue);var e=this.$inner,i=this.size();e.css({width:i.width*t,height:i.height*t});$.utils.setFont(e,this.textStyle(),t)},updateDefaultText:function(){var t=this.lengthLimit(),e=this.defaultText();t&&e&&e.length>t&&(e=e.slice(0,t));var i=this.$inner;i.val()!==e&&i.val(e)},updateEmptyText:function(){this.$inner.attr("placeHolder",this.emptyText())},updateIsPassword:function(){this.$inner.attr("type",this.isPassword()?"password":"text")},updateInputStyle:function(){var t=this.inputStyle();this.$inner.css({"background-color":t.backgroundColor||"transparent",border:(t.borderWidth||0)+"px solid "+(t.borderColor||"#000"),"border-radius":t.borderRadius||"0px"})}});