cn.js
上传用户:momo1981
上传日期:2016-03-11
资源大小:6001k
文件大小:813k
- },
- setProperties:{
- $desc:"设置当前模板的参数.",
- $rtn:"[self]",
- $paras:[
- "key [必需参数] : 模板空位名.",
- "value [可选参数] : Any. 模板空位的值"
- ],
- $snippet:[
- "var id='linb.temp.tt2'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "n// n"+
- "var t=new linb.Template(); t.setTemplate({'':'<div onclick=[$e]>{pre} {items} {next}</div>',items:'<p onclick=[$e] onmouseover=[$e]>{id} : {caption}</p>'}).setProperties({pre:'{{{',next:'}}}'}).setProperties('items',[{id:1,caption:'a1'},{id:2,caption:'a2'}]).setEvents({onClick:function(p){alert(p.domId)},items:{onClick:function(p,e,s){alert(p.domId);}}}); linb(id).append(t);"+
- "}"
- ]
- },
- setTemplate:{
- $desc:"设置模板的HTML串.",
- $rtn:"[self]",
- $paras:[
- "key [必需参数] : 模板键.",
- "value [可选参数] : String, 模板键值."
- ],
- $snippet:[
- "var id='linb.temp.tt3'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "n// n"+
- "var t=new linb.Template(); t.setTemplate('<div onclick=[$e]>{pre} {items} {next}</div>').setTemplate('items','<p onclick=[$e] onmouseover=[$e]>{id} : {caption}</p>').setProperties({pre:'{{{',next:'}}}',items:[{id:1,caption:'a1'},{id:2,caption:'a2'}]}).setEvents({onClick:function(p){alert(p.domId)},items:{onClick:function(p,e,s){alert(p.domId);}}}); linb(id).append(t);"+
- "}"
- ]
- }
- }
- });
- _.set(linb.Locale,["cn","doc","linb","Com"], {
- constructor:{
- $desc:"linb.Com的构造函数",
- $paras:[
- "properties [可选参数] : key/value(any) pairs. the Com properties object. 默认为 {}.",
- "events [可选参数] : key/value(Function) pairs. the Com event object. 默认为 {}.",
- "host [可选参数] : object. the Com's host object. 默认为 itself."
- ],
- $snippet:[
- "var order=[], com = new linb.Com({"+
- " $1:1"+
- " },"+
- " {"+
- " beforeCreated:function(){order.push('beforeCreated'); linb.log('beforeCreated');},"+
- " onCreated:function(){order.push('onCreated'); linb.log('onCreated');},"+
- " onLoadBaseClass:function(c,t,key){order.push('onLoadBaseClass: '+key); linb.log('onLoadBaseClass: '+key); },"+
- " onIniResource:function(){order.push('onIniResource'); linb.log('onIniResource');},"+
- " beforeIniComponents:function(){order.push('beforeIniComponents'); linb.log('beforeIniComponents');},"+
- " afterIniComponents:function(){order.push('afterIniComponents'); linb.log('afterIniComponents');},"+
- " onLoadReqiredClass:function(c,t,key){order.push('onLoadReqiredClass: '+key); linb.log('onLoadReqiredClass: '+key);},"+
- " onReady:function(){order.push('onReady'); linb.log('onReady');},"+
- " onRender:function(com){order.push('onRender'); linb.log('onRender'); com.dialog1.setHtml(order.join('<br />'));}"+
- " });"+
- "com.base=['linb.UI','linb.Date'];"+
- "com.required=['linb.UI.Dialog','linb.UI.Button'];"+
- "com.iniComponents=function(){order.push('iniComponents'); return (new linb.UI.Dialog()).host(this, 'dialog2').setWidth(150).setHeight(150).get() };"+
- "com.iniResource=function(){order.push('iniResource'); };"+
- "com.iniExComs=function(){order.push('iniExComs'); };"+
- "var abox=com.getComponents();"+
- "abox.merge((new linb.UI.Dialog()).host(com, 'dialog1'));"+
- "com.setComponents(abox);"+
- "com.show(function(com){"+
- " order.push('onEnd'); "+
- "});",
- "Class('App1','linb.Com',{" +
- " Instance:{" +
- " base : ['linb.UI', 'linb.Date']," +
- " required : ['linb.UI.Dialog', 'linb.UI.Button']," +
- " events:{" +
- " beforeCreated : function(com){" +
- " com._info=[];" +
- " com._info.push('beforeCreated');" +
- " linb.log('beforeCreated');" +
- " }," +
- " onCreated : function(com){" +
- " com._info.push('onCreated');" +
- " linb.log('onCreated');" +
- " }," +
- " onLoadBaseClass : function(com, t, key){" +
- " com._info.push('onLoadBaseClass: ' + key);" +
- " linb.log('onLoadBaseClass: ' + key);" +
- " }," +
- " onIniResource : function(com){" +
- " com._info.push('onIniResource');" +
- " linb.log('onIniResource');" +
- " }," +
- " beforeIniComponents : function(com){" +
- " com._info.push('beforeIniComponents');" +
- " linb.log('beforeIniComponents');" +
- " }," +
- " afterIniComponents : function(com){" +
- " com._info.push('afterIniComponents');" +
- " linb.log('afterIniComponents');" +
- " }," +
- " onLoadReqiredClass : function(com, t, key){" +
- " com._info.push('onLoadReqiredClass: ' + key);" +
- " linb.log('onLoadReqiredClass: ' + key);" +
- " }," +
- " onReady : function(com){" +
- " com._info.push('onReady');" +
- " linb.log('onReady');" +
- " }," +
- " onRender : function(com){" +
- " com._info.push('onRender');" +
- " linb.log('onRender');" +
- " com.dialog1.setHtml(com._info.join('<br />'));" +
- " }" +
- " }," +
- " customAppend:function(parent,showId,threadid){" +
- " this.dialog1.show(parent);" +
- " }," +
- " iniComponents : function(){" +
- " this._info.push('iniComponents');n" +
- " // [[code created by jsLinb UI Buildern" +
- " var host=this, children=[], append=function(child){children.push(child.get(0))};" +
- " append((new linb.UI.Dialog)" +
- " .host(host,'dialog1')" +
- " .setWidth(450)" +
- " .setHeight(450)" +
- " );" +
- " return children;n" +
- " // ]]code created by jsLinb UI Buildern" +
- " }," +
- " iniResource : function(){" +
- " this._info.push('iniResource');" +
- " }," +
- " iniExComs : function(){" +
- " this._info.push('iniExComs');" +
- " }" +
- " }" +
- "});" +
- "var com = new App1;" +
- "com.show();",
- "Class('App2','linb.Com',{" +
- " Instance:{" +
- " base : ['linb.UI']," +
- " required : ['linb.UI.Dialog']," +
- " events:{" +
- " beforeCreated : '_trace'," +
- " onCreated : '_trace'," +
- " onLoadBaseClass : '_trace'," +
- " onIniResource : '_trace'," +
- " beforeIniComponents : '_trace'," +
- " afterIniComponents : '_trace'," +
- " onLoadReqiredClass : '_trace'," +
- " onReady : '_trace'," +
- " onRender : '_trace'," +
- " }," +
- " customAppend:function(parent,showId,threadid){" +
- " this.dialog1.show(parent);" +
- " }," +
- " iniComponents : function(){" +
- " this._info.push('iniComponents');n" +
- " // [[code created by jsLinb UI Buildern" +
- " var host=this, children=[], append=function(child){children.push(child.get(0))};" +
- " append((new linb.UI.Dialog)" +
- " .host(host,'dialog1')" +
- " .setWidth(350)" +
- " .setHeight(450)" +
- " );" +
- " return children;n" +
- " // ]]code created by jsLinb UI Buildern" +
- " }," +
- " iniResource : function(){" +
- " this._info.push('iniResource');" +
- " }," +
- " iniExComs : function(){" +
- " this._info.push('iniExComs');" +
- " }, " +
- " _trace : function(com, threadid){" +
- " com._info.push(com.$lastEvent);" +
- " }" +
- " }" +
- "});" +
- "var com = new App2;" +
- "com._info=[];"+
- "com.show(function(com){com.dialog1.setHtml(com._info.join('<br />'));});"
- ]
- },
- 'load':{
- $desc:"从远程文件加载一个 linb.Com 的代码,然后新建它的 linb.Com 的实例,最后返回这个实例.",
- $paras:[
- "cls [必需参数] : String, the full class path name(e.g. 'linb.App').",
- "onEnd [可选参数]: Function, arguments : [the current linb.Com object]. This function will be called after the process is end.",
- "lang [可选参数] : String, language name.(e.g. 'en').",
- "showUI [可选参数] : Bool, indicates whether or not it shows the Com UI. 默认为 true;"
- ],
- $snippet:[
- "////Uses the beblow line to load a specified application, and append its UI to 'document.body' if its UI exits. n"+
- "//linb.Com.load('RootClassName',function(){alert('ok')},'en')n",
- "linb.Com.load('App.Test1',function(){alert('ok')});",
- "linb.Com.load('App.Test1',function(com){com.show(function(){alert('ok')},SPA.mainLayout,'main')},null,false)"
- ]
- },
- prototype:{
- render:{
- $desc:'To render the inner UI Components',
- $rtn:"[self]",
- $demo:"You have to call this function after the com was created. And linb.Com.show will trigger this function automatically."
- },
- setComponents:{
- $desc:"Sets the current Com's Components.",
- $rtn:"[self]",
- $paras:[
- "obj [Reqired] : linb.absObj object."
- ],
- $snippet:[
- "linb.SC('App.Test1',function(){var com=new this; com.create(function(com){com.setComponents((new linb.UI.Button()).host(window,'btn') ); alert(com.getComponents().get(0).alias); });},false);"
- ]
- },
- getComponents:{
- $desc:"Gets all Components in a specified linb.Com object.",
- $rtn:"linb.absObj object",
- $snippet:[
- "Class('App1','linb.Com',{" +
- " Instance:{"+
- " iniComponents : function(){" +
- " var host=this, children=[], append=function(child){children.push(child.get(0))};" +
- " append((new linb.DataBinder)" +
- " .host(host,'db1')" +
- " .setName('db1')" +
- " );" +
- " append((new linb.UI.Dialog)" +
- " .host(host,'dialog1')" +
- " .setWidth(350)" +
- " .setHeight(450)" +
- " );" +
- " return children;n" +
- " }" +
- " }" +
- "});"+
- "var com=new App1;"+
- "com.create(function(com){alert(com.getComponents().get(0).alias);});"
- ]
- },
- getUIComponents:{
- $desc:"获取指定linb.Com对象包含的所有UI组件.",
- $rtn:"linb.UI Object",
- $snippet:[
- "Class('App1','linb.Com',{" +
- " Instance:{"+
- " iniComponents : function(){" +
- " var host=this, children=[], append=function(child){children.push(child.get(0))};" +
- " append((new linb.DataBinder)" +
- " .host(host,'db1')" +
- " .setName('db1')" +
- " );" +
- " append((new linb.UI.Dialog)" +
- " .host(host,'dialog1')" +
- " .setWidth(350)" +
- " .setHeight(450)" +
- " );" +
- " return children;n" +
- " }" +
- " }" +
- "});"+
- "var com=new App1;"+
- "com.create(function(com){alert(com.getUIComponents().get(0).alias);});"
- ]
- },
- getEvents:{
- $desc:"获取Com对象上的所有事件处理函数.",
- $rtn:"Object , String or Function",
- $paras:[
- "key [可选参数] : String"
- ],
- $snippet:[
- "linb.SC('App.Test1',function(){var com=new this; com.create(function(com){alert(_.serialize(com.getEvents()))});},false);",
- "linb.SC('App.Test1',function(){var com=new this; com.create(function(com){alert(_.serialize(com.getEvents('onReady')))});},false);"
- ]
- },
- setEvents:{
- $desc:"将一系列的事件处理函数(或一个带有key的事件处理函数)附加到Com对象。",
- $rtn:"[self]",
- $paras:[
- "key [必需参数] : key/value(Function) pairs or String. 一系列的事件处理函数或key值.",
- "value [可选参数] : Function, event function."
- ],
- $snippet:[
- "linb.SC('App.Test1',function(){var com=new this; com.create(function(com){com.setEvents('onA',function(){}); alert(com.getEvents('onA'))});},false);"
- ]
- },
- create:{
- $desc:"使用异步方式生成Com对象.",
- $paras:[
- "onEnd [Optiona] : Function. 回调函数,在Com对象成功生成后执行。",
- "threadid [可选参数] : String, 内部线程id."
- ],
- $snippet:[
- "linb.SC('App.Test1',function(){var com=new this; com.create(function(com){alert('created!')});},false);"
- ]
- },
- show:{
- $desc:"显示Com对象.",
- $paras:[
- "onEnd [Optiona] : Function. 回调函数,在Com对象成功显示后执行。",
- "parent [可选参数] : 父DOM节点或linb.UI对象.",
- "subId [可选参数] : String, 该参数在parent为linb.UI对象时有效。该子id. The sub id that Determines the [target] will be added to which sub DOM node. 该参数也可以设置成[false], that means the [target] will be appended to DOM only, no link created between the [target] UIProfiles and the parent UIProfile.",
- "threadid [可选参数] : String, 内部线程id."
- ],
- $snippet:[
- "linb.SC('App.Test1',function(){var com=new this; com.show(function(){});},false);"
- ]
- },
- requestData:{
- $desc:"执行一组linb.absIO对象.",
- $paras:[
- "group [Require] : Array, linb.absIO 对象数组.",
- "threadid [可选参数] : String, the 内部线程id.",
- "onEnd [可选参数]: Function, 回调函数, 在linb.absIO对象数组全部完成后回调."
- ],
- $memo:"通常情况下, 该函数被函数'fillUI'调用,用来请求服务器数据并且填充UI."
- },
- composeUI:{
- $desc:"组成当前Com对象的UI.",
- $paras:[
- "threadid [可选参数] : String, 内部线程id.",
- "onEnd [可选参数]: Function, the 回调函数, it must be called in the current composeUI function.",
- "flag [可选参数] : Bool, a parameter for user to Determines whether or not the current UI will be forced to compose."
- ],
- $memo:"需被子类重载."
- },
- fillUI:{
- $desc:"Fills the current Com's UI.",
- $paras:[
- "threadid [可选参数] : String, the 内部线程id.",
- "onEnd [可选参数]: Function, 回调函数, 会被fillUI函数调用.",
- "flag [可选参数] : Bool, 使用该参数指定当前UI是否被强行填充."
- ],
- $memo:"需被子类重载."
- },
- destroy:{
- $desc:"销毁对象.",
- $memo:"通常情况下, 程序员不必直接调用该函数."
- },
- iniComponents:{
- $desc:"生成内部的组件并返回内部组件数组(linb.absObj object).",
- $rtn:"Array, linb.absObj对象数组.",
- $snippet:[
- "Class('App1','linb.Com',{" +
- " Instance:{"+
- " iniComponents : function(){" +
- " var host=this, children=[], append=function(child){children.push(child.get(0))};" +
- " append((new linb.DataBinder)" +
- " .host(host,'db1')" +
- " .setName('db1')" +
- " );" +
- " append((new linb.UI.Dialog)" +
- " .host(host,'dialog1')" +
- " .setWidth(350)" +
- " .setHeight(450)" +
- " );" +
- " return children;n" +
- " }" +
- " }" +
- "});"+
- "var com=new App1;"+
- "com.create(function(com){alert(com.getUIComponents().get(0).alias);});"
- ]
- },
- getProperties:{
- $desc:"取得Com对象所有的属性或某个指定的属性.",
- $rtn:"Any",
- $paras:[
- "key [可选参数] : String, 属性名称。"
- ],
- $snippet:[
- "linb.SC('App.Test1',function(){var com=new this; com.create(function(com){alert(_.serialize(com.getProperties()))});},false);",
- "linb.SC('App.Test1',function(){var com=new this; com.create(function(com){alert(com.getProperties('p1'))});},false);"
- ]
- },
- setProperties:{
- $desc:"设置Com对象的一系列的属性或某个指定的属性.",
- $rtn:"[self]",
- $paras:[
- "key [必需参数] : 键值对 or String. 属性或key数组.",
- "value [可选参数] : Any, a property value."
- ],
- $snippet:[
- "linb.SC('App.Test1',function(){var com=new this; com.create(function(com){com.setProperties('p3','p3 value'); alert(com.getProperties('p3'))});},false);"
- ]
- },
- setHost:{
- $desc:"设置host对象.",
- $rtn:"[self]",
- $paras:[
- "host [Requied] : Object, host对象.",
- "alias [可选参数] : String, 别名."
- ],
- $snippet:[
- "linb.SC('App.Test1',function(){var com=new this; com.create(function(com){com.setHost(window,'com_alias'); alert(com.getHost()===window); alert(window.com_alias)});},false);"
- ]
- },
- getHost:{
- $des:"获取host对象.",
- $rtn:"Object",
- $snippet:[
- "linb.SC('App.Test1',function(){var com=new this; com.create(function(com){com.setHost(window,'com_alias'); alert(com.getHost()===window); alert(window.com_alias)});},false);"
- ]
- },
- beforeCreated:{
- $desc:'Fired before com is created.',
- $paras:[
- 'com : linb.Com object.',
- 'threadid : String, thread id.'
- ],
- $memo:'See constructor.'
- },
- onCreated:{
- $desc:'Fired when com is created.',
- $paras:[
- 'com : linb.Com object.',
- 'threadid : String, thread id.'
- ],
- $memo:'See constructor.'
- },
- onLoadBaseClass:{
- $desc:'Fired when com loads base classes.',
- $paras:[
- 'com : linb.Com object.',
- 'threadid : String, thread id.',
- 'key: String, base class name.'
- ],
- $memo:'See constructor.'
- },
- onIniResource:{
- $desc:'Fired when com loads resources.',
- $paras:[
- 'com : linb.Com object.',
- 'threadid : String, thread id.',
- 'key: String, base class name.'
- ],
- $memo:'See constructor.'
- },
- beforeIniComponents:{
- $desc:'Fired beofre com object initializes inner components.',
- $paras:[
- 'com : linb.Com object.',
- 'threadid : String, thread id.'
- ],
- $memo:'See constructor.'
- },
- afterIniComponents:{
- $desc:'Fired after com object initializes inner components.',
- $paras:[
- 'com : linb.Com object.',
- 'threadid : String, thread id.'
- ],
- $memo:'See constructor.'
- },
- onLoadRequiredClass:{
- $desc:'Fired when com loads requried Classes.',
- $paras:[
- 'com : linb.Com object.',
- 'threadid : String, thread id.',
- 'key: String, class name.'
- ],
- $memo:'See constructor.'
- },
- onReady:{
- $desc:'Fired when com is ready.',
- $paras:[
- 'com : linb.Com object.',
- 'threadid : String, thread id.'
- ],
- $memo:'See constructor.'
- },
- onRender:{
- $desc:'Fired when com is added to DOM.',
- $paras:[
- 'com : linb.Com object.',
- 'threadid : String, thread id.'
- ],
- $memo:'See constructor.'
- }
- }
- });
- _.set(linb.Locale,["cn","doc","linb","ComFactory"], {
- setProfile:{
- $desc:"设置应用模块工厂(ComFatory)的profile.",
- $rtn:'[self]',
- $paras:[
- "key [必需参数] : String或键值对.",
- "value [可选参数] : String 或 键值对."
- ],
- $snippet:[
- "linb.ComFactory.setProfile({test1:'App.Test1',test2:'App.Test2'});"+
- "linb.ComFactory.setProfile('test1','App.Test1');"+
- "linb.ComFactory.setProfile({test1:{cls:'App.Test1'},test2:{cls:'App.Test2'}});"+
- "linb.ComFactory.setProfile('test1',{cls:'App.Test1',props:{dlgCaption:'dialog caption'}});"+
- "alert(_.serialize(linb.ComFactory.getProfile()));"+
- "alert(linb.ComFactory.getProfile('test1'));"
- ]
- },
- getProfile:{
- $desc:"获取应用模块工厂(ComFatory)的profile.",
- $rtn:'String 或 键值对',
- $paras:[
- "key [可选参数] : String."
- ],
- $snippet:[
- "linb.ComFactory.setProfile({test1:'App.Test1',test2:'App.Test2'});"+
- "alert(linb.ComFactory.getProfile());"+
- "alert(linb.ComFactory.getProfile('test1'));"
- ]
- },
- broadcast:{
- $desc:"广播一个消息(function)到所有的应用模块(linb.Com)中.",
- $paras:[
- "fun [必需参数] : Function, 要广播的函数."
- ],
- $snippet:[
- "linb.SC('App.Test1',function(){linb.ComFactory.setCom('test1', (new this));},false);"+
- "linb.SC('App.Test2',function(){linb.ComFactory.setCom('test2',(new this));},false);"+
- "linb.ComFactory.broadcast(function(i){alert(i + ' / ' + this.KEY)});"
- ]
- },
- destroyAll:{
- $desc:"销毁应用模块工厂(ComFatory)加载的所有模块.",
- $snippet:[
- "linb.SC('App.Test1',function(){linb.ComFactory.setCom('test1',(new this));},false);"+
- "linb.SC('App.Test2',function(){linb.ComFactory.setCom('test2',(new this));},false);"+
- "linb.ComFactory.destroyAll();"+
- "alert(linb.ComFactory.getComFromCache('test'));"
- ]
- },
- getComFromCache:{
- $desc:"获取一个缓存中已经存在的应用模块对象(Com object).",
- $rtn:"Com object or null. 应用模块对象(Com object),不存在则返回null",
- $paras:[
- "id [必需参数] : String, 应用模块对象id."
- ],
- $snippet:[
- "linb.SC('App.Test1',function(){linb.ComFactory.setCom('test1',(new this));},false);"+
- "linb.SC('App.Test2',function(){linb.ComFactory.setCom('test2',(new this));},false);"+
- "alert(linb.ComFactory.getComFromCache('test1').KEY);"
- ]
- },
- getCom :{
- $desc:"获取一个缓存中已经存在的应用模块对象(Com object), 如果不存在,则加载应用模块对应的js文件,再生成应用模块对象(Com object).",
- $rtn:"Com object or null. 应用模块对象(Com object),不存在并加载js文件失败时返回null",
- $paras:[
- "id [必需参数] : String, 应用模块对象id.",
- "onEnd [可选参数] : Function, the 回调函数, 生成应用模块对象(Com object)成功后被调用.",
- "threadid [可选参数] : String, 内部线程id",
- "singleton[Optional] : Bool, 默认为 true. If singleton is false, that indicates ComFactory won't get it from the cache, and won't cache the result."
- ],
- $snippet:[
- "linb.ComFactory.destroyAll();"+
- "linb.ComFactory.setProfile({test1:'App.Test1',test2:'App.Test2'});"+
- "linb.ComFactory.getCom('test1',function(){alert('The Com loaded successfully.')});"
- ]
- },
- setCom:{
- $desc:"设置一个应用模块对象(Com object),并和一个Com id关联.",
- $rtn:"[self]",
- $paras:[
- "id [必需参数] : String, Com id关联.",
- "obj [必需参数] : Object, 应用模块对象(Com object)."
- ],
- $snippet:[
- "linb.SC('App.Test1',function(){linb.ComFactory.setCom('test1',(new this));},false);"+
- "linb.SC('App.Test2',function(){linb.ComFactory.setCom('test2',(new this));},false);"+
- "alert(linb.ComFactory.getComFromCache('test1').KEY);"
- ]
- },
- newCom :{
- $desc:"生成一个新的应用模块类, 或加载一个应用模块类, 生成并返回它.",
- $paras:[
- "cls [必需参数] : String, 应用模块类的路径名字.",
- "onEnd [可选参数] : Function, the 回调函数,加载应用模块类成功后被调用.",
- "threadid [可选参数] : String, the inner threadid"
- ],
- $snippet:[
- "linb.ComFactory.destroyAll();"+
- "linb.ComFactory.newCom('App.Test1',function(){alert('The com loaded successfully.')});"
- ]
- },
- prepareWidgets:{
- $desc:"在后台加载并生成一些列的小器件, 这些小器件需要在当前的应用类中的[required]部分被定义.",
- $snippet:[
- "//linb.ComFactory.prepareWidgets();"
- ]
- },
- prepareComs:{
- $desc:"在后台加载并生成一些列的应用模块, 这些模块需要在profile中事先被定义.",
- $snippet:[
- "//linb.ComFactory.setProfile({test1:'App.Test1',test2:'App.Test2'});n"+
- "//linb.ComFactory.prepareWidgets(['test1','test2']);"
- ]
- },
- storeCom:{
- $desc:"存储一个应用模块. (切断和父DOM节点的关联, 并存放到一个隐藏的div.)",
- $paras:[
- "id [Require] : 应用模块id."
- ],
- $snippet:[
- "linb.ComFactory.destroyAll();"+
- "linb.ComFactory.setProfile('test1',{cls:'App.Test1',props:{dlgCaption:'dialog caption'}});"+
- "linb.ComFactory.getCom('test1',function(){ this.showDlg(); _.asyRun(function(){linb.ComFactory.storeCom('test1')},1000); });"
- ]
- }
- });
- _.set(linb.Locale,["cn","doc","linb","DomProfile"], {
- });
- _.set(linb.Locale,["cn","doc","linb","DataBinder"], {
- constructor:{
- $desc:"生成一个databinder对象."
- },
- destroyAll:{
- $desc:"销毁所有linb.DataBinder对象.",
- $snippet:[
- "//linb.DataBinder.destroyAll()"
- ]
- },
- getFromName:{
- $desc:"获取名字为指定值的linb.DataBinder对象.",
- $rtn:'linb.DataBinder object.',
- $paras:[
- "name [必需参数] : String, DataBinder名字."
- ],
- $snippet:[
- "var db=new linb.DataBinder();db.setName('abc');"+
- "alert(db=linb.DataBinder.getFromName('abc'));"+
- "db.destroy();"+
- "alert(linb.DataBinder.getFromName('abc'));"
- ]
- },
- prototype:{
- checkValid:{
- $desc:"检查所有绑定值是否有效. 例如: 用户输入了字符到数字框里面,而数字框又绑定了databinder, 这个函数就会返回[false].",
- $rtn:"Bool"
- },
- destroy:{
- $desc:"销毁该对象.",
- $memo:"Usually, we do not need to call this function manually."
- },
- setName:{
- $desc:"设置数据绑定器的名称.",
- $rtn:'[self]',
- $paras:[
- "value [必需参数] : String, 名字字符串"
- ],
- $memo:"参看'getValue'代码片段. "
- },
- getUI:{
- $desc:"获取绑定在本对象上的UI.",
- $rtn:'linb.UI object.',
- $memo:"To see the 'getValue' snippets. ",
- $snippet:[
- "var id='linb.temp.ui'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "linb(id).append(new linb.UI.Input({position:'relative',dataBinder:'abc'}));"+
- "alert(linb.DataBinder.getFromName('abc').getUI().serialize());"+
- "}"
- ]
- },
- getName:{
- $desc:"返回数据绑定器名字.",
- $rtn:'String',
- $memo:"参看'getValue'代码片段. "
- },
- getValue:{
- $desc:"获取键值对, that includes the values of all those bound linb.absValue profiles.",
- $rtn:"key/value pairs object.",
- $snippet:[
- "var id='linb.temp.cv'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var db1=new linb.DataBinder,i1=new linb.UI.Input({position:'relative'}), i2=new linb.UI.Input({position:'relative'}); db1.setName('db1'); i1.setValue('aaa').setDataBinder('db1').setDataField('i1'); i2.setValue('bbb').setDataBinder('db1').setDataField('i2');"+
- "linb(id).append(i1).append(i2);"+
- "alert(db1.getName());"+
- "alert(_.serialize(db1.getValue()));"+
- "_.asyRun(function(){"+
- " db1.resetValue({i1:'111',i2:'222'});"+
- " alert(_.serialize(db1.getValue()));"+
- "},3000);"+
- "}"
- ]
- },
- resetValue:{
- $desc:"设置或重设被绑定linb.absValue的值.",
- $rtn:"[self].",
- $paras:[
- "hash [可选参数] : a key/value pairs object. 如果参数没有被设定, 被绑定的linb.absValue profiles 将被重设为初始值."
- ],
- $memo:"参看'getValue'代码片段. "
- }
- }
- });
- _.set(linb.Locale,["cn","doc","linb","Tips"], {
- AUTOHIDETIME:{
- $desc:"指示多少毫秒后tip自动隐藏. 该参数在MOABLE设置为[true]时有效.",
- $snippet:["alert(linb.Tips.AUTOHIDETIME)"]
- },
- DELAYTIME:{
- $desc:"指示在function 'linb.Tips.show'调用后多少毫秒后显示tip.",
- $snippet:["alert(linb.Tips.DELAYTIME)"]
- },
- MAXWIDTH:{
- $desc:"tooltips的最大宽度.",
- $snippet:["alert(linb.Tips.MAXWIDTH)"]
- },
- MOVABLE:{
- $desc:"指示tip是否跟随鼠标移动.",
- $snippet:["alert(linb.Tips.MOVABLE)"]
- },
- TIPSKEY:{
- $desc:"tooltips的键. 默认为'tips'.",
- $snippet:["alert(linb.Tips.TIPSKEY)"]
- },
- getTips:{
- $desc:"获取tips显示的字符串.",
- $snippet:[
- "linb.Tips.show({left:100,top:100}, 'a string');"+
- "alert(linb.Tips.getTips());"+
- "linb.Tips.hide();"+
- "alert(linb.Tips.getTips());"
- ]
- },
- hide:{
- $desc:"隐藏tooltips.",
- $snippet:[
- "linb.Tips.show({left:100,top:100}, 'a string'); _.asyRun(function(){linb.Tips.hide()},1000); _.asyRun(function(){linb.Tips.show({left:100,top:100}, {tips:'an object with a \'tips\' key'})},2000); _.asyRun(function(){linb.Tips.hide()},3000); _.asyRun(function(){linb.Tips.show({left:100,top:100}, {any:'an object with a customizable key'},'any')},4000);_.asyRun(function(){linb.Tips.hide()},5000);"
- ]
- },
- show:{
- $desc:"显示tooltips.",
- $paras:[
- "pos [必需参数] : {left:Number,top:Number}, the position of the tooltips.",
- "item [必需参数] : String or Object, to provide the tooltips content.",
- "key [可选参数] : String, the tips key. 默认为 'tips'."
- ],
- $snippet:[
- "linb.Tips.show({left:100,top:100}, 'a string'); _.asyRun(function(){linb.Tips.hide()},1000); _.asyRun(function(){linb.Tips.show({left:100,top:100}, {tips:'an object with a \'tips\' key'})},2000); _.asyRun(function(){linb.Tips.hide()},3000); _.asyRun(function(){linb.Tips.show({left:100,top:100}, {any:'an object with a customizable key'},'any')},4000);_.asyRun(function(){linb.Tips.hide()},5000);"
- ]
- }
- });
- _.set(linb.Locale,["cn","doc","linb","Coder"], {
- formatText:{
- $desc:"将js/css/php/html代码片段格式化为更加可读的格式.",
- $rtn:"String",
- $paras:[
- "code [必需参数] : String, 代码片段.",
- "type [可选参数] : String, 代码片段类型. 默认是 'js'"
- ],
- $snippet:[
- "alert(linb.Coder.formatText('var a=function(){var a=1;var b=2;var c={a:1,b:2};};'))",
- "alert(linb.Coder.formatText('.cls{left:0;top:0}','css'))",
- "alert(linb.Coder.formatText('<div><p>1</p><p>2</p><p><span>3</span>4</p></div>','html'))",
- "alert(linb.Coder.formatText(' foreach ($d as $k => $v){print $k.$v;}','php'))"
- ]
- },
- formatHTML:{
- $desc:"将js/css/php/html代码片段转化为更可读的HTML.",
- $rtn:"String",
- $paras:[
- "code [必需参数] : String, code snippet.",
- "type [可选参数] : String, code type. Defalut is 'js'",
- "paras [可选参数] : Array of String. Commands, e.g. ['plain','run']",
- "id [可选参数] : String, the output HTML DOM id.",
- "height [可选参数] : Number, the output HTML height."
- ],
- $snippet:[
- "var str=linb.Coder.formatHTML('var a=function(){var a=1;var b=2;var c={a:1,b:2};};alert(1);','js',['plain','run'],'i-d'); linb.UI.Dialog.alert('linb.Coder', str)",
- "var str=linb.Coder.formatHTML('.cls{left:0;top:0}','css'); linb.UI.Dialog.alert('linb.Coder', str)",
- "var str=linb.Coder.formatHTML('<div><p>1</p><p>2</p><p><span>3</span>4</p></div>','html'); linb.UI.Dialog.alert('linb.Coder', str)",
- "var str=linb.Coder.formatHTML(' foreach ($d as $k => $v){print $k.$v;}','php',['plain']); linb.UI.Dialog.alert('linb.Coder', str)"
- ]
- },
- formatAll:{
- $desc:"将js/css/php/html代码片段转化为HTML. 相当于formatText + formatHTML.",
- $rtn:"String",
- $paras:[
- "code [必需参数] : String, 代码片段.",
- "type [可选参数] : String, 代码类型. 默认的 'js'",
- "paras [可选参数] : Array of String. 指令, 例如 ['plain','run']",
- "id [可选参数] : String, the output HTML DOM id.",
- "height [可选参数] : Number, 输出的HTML高度."
- ],
- $snippet:[
- "var str=linb.Coder.formatAll('var a=function(){var a=1;var b=2;var c={a:1,b:2};};alert(1);','js',['plain','run'],'i-d'); linb.UI.Dialog.alert('linb.Coder', str)",
- "var str=linb.Coder.formatAll('.cls{left:0;top:0}','css'); linb.UI.Dialog.alert('linb.Coder', str)",
- "var str=linb.Coder.formatAll('<div><p>1</p><p>2</p><p><span>3</span>4</p></div>','html'); linb.UI.Dialog.alert('linb.Coder', str)",
- "var str=linb.Coder.formatAll(' foreach ($d as $k => $v){print $k.$v;}','php',['plain']); linb.UI.Dialog.alert('linb.Coder', str)"
- ]
- },
- replace:{
- $desc:"高级字符串替换.",
- $rtn:"String",
- $paras:[
- "str [必需参数] : string, 目标串.",
- "reg [必需参数] : Array: [string, string] 或 [RegExp, string].",
- "replace [可选参数] : String, 替换串.",
- "ignore_case [可选参数] : Bool, 指示是否忽略大小写。."
- ],
- $snippet:[
- 'alert(linb.Coder.replace("aAa","a","*",true));'+
- 'alert(linb.Coder.replace("aAa","a","*",false));'+
- 'alert(linb.Coder.replace("aAa","a","*"));'+
- 'alert(linb.Coder.replace("aAa",/a/,"*"));'+
- 'alert(linb.Coder.replace("aAa",["a","*"]));'+
- 'alert(linb.Coder.replace("aAa",[["a","*"]]));',
- 'alert(linb.Coder.replace("aAa",[["a","*"],[/A/,"-"]]))',
- '//Use "$0" to protect "ab" in the string: n alert(linb.Coder.replace("aba",[["ab","$0"],["a","*"]]))',
- 'alert(linb.Coder.replace("aba ab a",[["ab","$0"],["a",function(s,i){return s[i].toUpperCase();}]]))'
- ]
- },
- applyById:{
- $desc:"将linb.Coder应用于给定id的所有元素.",
- $paras:[
- "id [必需参数] : String, DOM id.",
- "formatAll [可选参数] : Bool, 指示使用'formatAll'还是'formatHTML', 默认为'formatHTML'."
- ],
- $memo:"该函数仅用于突出显示."
- }
- });
- _.set(linb.Locale,["cn","doc","linb","absList"], {
- prototype:{
- fireItemClickEvent:{
- $desc:"当list中的某一项被选择时调用.",
- $paras:[
- "subId [必需参数] : String, 项的id."
- ],
- $snippet:[
- "var id='linb.temp.tabs6'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:200px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=(new linb.UI.Tabs({height:'auto',items:[{id:'a',caption:'a a'},{id:'b',caption:'b b'},{id:'c',caption:'c c'}]})));"+
- "_.asyRun(function(){o.fireItemClickEvent('b')},1000);"+
- "}"
- ]
- },
- updateItem:{
- $desc:"Updates the specified item(key or value) and the corresponding DOM Element.",
- $rtn:"String",
- $paras:[
- "id [Required] : String. The node id.",
- "options [Required] : object. a key/value pairs."
- ],
- $snippet:[
- "var id='linb.temp.absl0-1'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o=new linb.UI.TreeBar({width:'auto',iniFold:true,height:'auto',dock:'none',position:'relative',items:[{id:'a',caption:'a'},{id:'b',caption:'b'},{id:'c',caption:'c',sub:[{id:'cz',caption:'cz'}]}]});"+
- "linb(id).prepend(o);"+
- "_.asyRun(function(){o.updateItem('b',{caption:'bbb', image:'img/img.gif', imagePos:'left -16px'})},1000);" +
- "}"
- ]
- },
- getItems:{
- $desc:"获取所有项.",
- $rtn:"String",
- $snippet:[
- "var id='linb.temp.absl1'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.List({position:'relative',items:[{id:'a',caption:'a'},{id:'b',caption:'b'},{id:'c',caption:'c'}]}))"+
- "_.asyRun(function(){alert(_.serialize(o.getItems()))});"+
- "}"
- ]
- },
- setItems:{
- $desc:"设置项, 并刷新界面.",
- $rtn:"[self]",
- $paras:[
- "value [必需参数] : Array, 项数组.",
- "flag [可选参数] : Bool, 强制设置该属性值,即使属性已经设置为该值. 默认为 [false]."
- ],
- $snippet:[
- "var id='linb.temp.absl2'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.List({position:'relative',items:[{id:'a',caption:'a'},{id:'b',caption:'b'},{id:'c',caption:'c'}]}))"+
- "_.asyRun(function(){o.setItems([{id:'aaa',caption:'bbb'}])});"+
- "}"
- ]
- },
- insertItems:{
- $desc:"添加一些项.",
- $rtn:"[self]",
- $paras:[
- "arr [必需参数] : Array. 项数组.",
- "base [可选参数] : String. 基准项id.",
- "before [可选参数] : Bool. 指示在基准项前还是项后插入. 默认为项后;"
- ],
- $snippet:[
- "var id='linb.temp.absl3'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.List({position:'relative',items:[{id:'a',caption:'a'},{id:'b',caption:'b'},{id:'c',caption:'c'}]}));"+
- "_.asyRun(function(){o.insertItems([{id:'a1',caption:'a1'}],'b',true)},1000);"+
- "_.asyRun(function(){o.insertItems([{id:'c1',caption:'c1'}],'c',false)},2000);"+
- "_.asyRun(function(){o.insertItems([{id:'a0',caption:'a0'}],null,true)},3000);"+
- "_.asyRun(function(){o.insertItems([{id:'c2',caption:'c2'}],null,false)},4000);"+
- "_.asyRun(function(){o.insertItems([{id:'h',caption:'h'},{id:'i',caption:'i'}])},5000);"+
- "}"
- ]
- },
- removeItems:{
- $desc:"移除一系列项.",
- $rtn:"String",
- $paras:[
- "arr [必需参数] : Array. 要移除的项id数组."
- ],
- $snippet:[
- "var id='linb.temp.absl4'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.List({position:'relative',items:[{id:'a',caption:'a'},{id:'b',caption:'b'},{id:'c',caption:'c'}]}));"+
- "_.asyRun(function(){o.removeItems(['a','b'])},1000);"+
- "}"
- ]
- },
- clearItems:{
- $desc:"移除所有的项.",
- $rtn:"String",
- $paras:[
- "key [可选参数] : String. 包含所有项的临时键. 默认为 'ITEMS'."
- ],
- $snippet:[
- "var id='linb.temp.absl5'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.List({position:'relative',items:[{id:'a',caption:'a'},{id:'b',caption:'b'},{id:'c',caption:'c'}]}));"+
- "_.asyRun(function(){o.clearItems()},1000);"+
- "}"
- ]
- },
- getListKey:{
- $desc:"获取列表键.",
- $rtn:"String",
- $snippet:[
- "var id='linb.temp.abs6'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "linb.UI.cacheData('test',[{id:'a',caption:'a'},{id:'b',caption:'b'},{id:'c',caption:'c'}]);"+
- "linb.UI.cacheData('test2',[{id:'aa',caption:'aa'},{id:'bb',caption:'bb'},{id:'cc',caption:'cc'}]);"+
- "var o;linb(id).prepend(o=new linb.UI.List({position:'relative',listKey:'test'}));"+
- "_.asyRun(function(){alert(o.getListKey())});"+
- "}"
- ]
- },
- setListKey:{
- $desc:"设置列表键.",
- $rtn:"[self]",
- $paras:[
- "value [必需参数] : String, 列表键.",
- "flag [可选参数] : Bool, 强制设置该属性值,即使属性已经设置为该值. 默认为 [false]."
- ],
- $snippet:[
- "var id='linb.temp.abs7'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "linb.UI.cacheData('test',[{id:'a',caption:'a'},{id:'b',caption:'b'},{id:'c',caption:'c'}]);"+
- "linb.UI.cacheData('test2',[{id:'aa',caption:'aa'},{id:'bb',caption:'bb'},{id:'cc',caption:'cc'}]);"+
- "var o;linb(id).prepend(o=new linb.UI.List({position:'relative',listKey:'test'}));"+
- "_.asyRun(function(){o.setListKey('test2')},1000);"+
- "}"
- ]
- },
- getItemByItemId:{
- $desc:"获取id为指定值的项对象.",
- $rtn:"key/value pairs.",
- $paras:[
- "itemId [必需参数] :String, 项id."
- ],
- $snippet:[
- "var pro=linb.UIProfile.getFromDomId('linb.UI.TreeBar:a:').boxing();alert(_.serialize( pro.getItemByItemId('Namespace') ))"
- ]
- },
- getItemByDom:{
- $desc:"获取DOM节点或DOM id对应的项对象.",
- $rtn:"key/value pairs.",
- $paras:[
- "src [必需参数] : DOM节点或DOM id."
- ],
- $snippet:[
- "var pro=linb.UIProfile.getFromDomId('linb.UI.TreeBar:a:').boxing();alert(_.serialize( pro.getItemByDom('linb.UI.TreeBar-ITEM:a:a') ))"
- ]
- },
- getSubIdByItemId:{
- $desc:"获取项的子项id.",
- $rtn:"String",
- $paras:[
- "itemId [必需参数] :String, 项id."
- ],
- $snippet:[
- "var pro=linb.UIProfile.getFromDomId('linb.UI.TreeBar:a:').boxing();alert(pro.getSubIdByItemId('Namespace') )"
- ]
- },
- getSubNodeByItemId:{
- $desc:"获取子项对应的DOM元素.",
- $rtn:"String",
- $paras:[
- "itemId [必需参数] :String, 项id."
- ],
- $snippet:[
- "var pro=linb.UIProfile.getFromDomId('linb.UI.TreeBar:a:').boxing();alert(pro.getSubNodeByItemId('Namespace') )"
- ]
- }
- }
- });
- _.set(linb.Locale,["cn","doc","linb","absValue"], {
- prototype:{
- getDataBinder:{
- $desc:"获取绑定的数据绑定器名称",
- $rtn:"String",
- $snippet:[
- "var id='linb.temp.absv1'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.Input);"+
- "_.asyRun(function(){o.setDataBinder('db1'); alert(o.getDataBinder())},1000)"+
- "}"
- ]
- },
- setDataBinder:{
- $desc:"设置数据绑定器名称.",
- $rtn:"[self]",
- $paras:[
- "value [必需参数] : String.",
- "flag [可选参数] : Bool, 强制设置该属性值,即使属性已经设置为该值. 默认为 [false]."
- ],
- $snippet:[
- "var id='linb.temp.absv2'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.Input);"+
- "_.asyRun(function(){o.setDataBinder('db1'); alert(o.getDataBinder())},1000)"+
- "}"
- ]
- },
- getDataField:{
- $desc:"获取数据字段名称",
- $rtn:"String",
- $snippet:[
- "var id='linb.temp.absv3'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.Input);"+
- "_.asyRun(function(){o.setDataField('field1'); alert(o.getDataField())},1000)"+
- "}"
- ]
- },
- setDataField:{
- $desc:"设置数据字段名称.",
- $rtn:"[self]",
- $paras:[
- "value [必需参数] : String.",
- "flag [可选参数] : Bool, 强制设置该属性值,即使属性已经设置为该值. 默认为 [false]."
- ],
- $snippet:[
- "var id='linb.temp.absv4'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.Input);"+
- "_.asyRun(function(){o.setDataField('field1'); alert(o.getDataField())},1000)"+
- "}"
- ]
- },
- getUIValue:{
- $desc:"获取用户界面值",
- $rtn:"Any",
- $snippet:[
- "var id='linb.temp.absv7'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.Input({value:'ini'}));"+
- "_.asyRun(function(){alert(o.getUIValue())},1000)"+
- "}"
- ]
- },
- setUIValue:{
- $desc:"设置用户界面值和控件值",
- $rtn:"[self]",
- $paras:[
- "value [必需参数] : Any.",
- "force [可选参数] : Bool. 强行赋值,即使赋值和现有值已经相同. 默认为 [false]."
- ],
- $snippet:[
- "var id='linb.temp.absv81'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.Input({value:'ini'}));"+
- "_.asyRun(function(){o.setUIValue('ini2'); alert(o.getUIValue());},1000)"+
- "}"
- ],
- $memo:"调用该函数时,以下两个事件将被触发beforeUIValueSet and afterUIValueSet."
- },
- updateValue:{
- $desc:"将内部值更新为界面值",
- $rtn:"[self]",
- $snippet:[
- "var id='linb.temp.absv82'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.Input({value:'ini'}));"+
- "_.asyRun(function(){o.setUIValue('ini2').updateValue(); alert(o.getValue());},1000)"+
- "}"
- ]
- },
- getValue:{
- $desc:"获取内部值",
- $rtn:"Any",
- $snippet:[
- "var id='linb.temp.absv9'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.Input({value:'ini'}));"+
- "_.asyRun(function(){alert(o.getValue())},1000)"+
- "}"
- ]
- },
- setValue:{
- $desc:"设置内部值,界面值,和控件值",
- $rtn:"[self]",
- $paras:[
- "value [必需参数] : Any.",
- "flag [可选参数] : Bool, force to set the value even if the same value already exists. 默认为 [false]."
- ],
- $snippet:[
- "var id='linb.temp.absv10'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.Input({value:'ini'}));"+
- "_.asyRun(function(){o.setValue('ini2'); alert(o.getValue());},1000)"+
- "}"
- ],
- $memo:"调用该函数时,以下两个事件将被触发: beforeValueSet and afterValueSet."
- },
- checkValid:{
- $desc:"检查界面值是否有效",
- $rtn:"Bool",
- $snippet:[
- "var id='linb.temp.absv11'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.Input({value:'ini',valueFormat:'^-?\\d\\d*$'}));"+
- "_.asyRun(function(){alert(o.checkValid());},1000)"+
- "}"
- ]
- },
- isDirtied:{
- $desc:"判断界面值已经被修改.",
- $rtn:"Bool",
- $snippet:[
- "var id='linb.temp.absv13'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.Input({value:'ini'}));"+
- "_.asyRun(function(){o.setUIValue('ini2');alert(o.isDirtied());},1000)"+
- "}"
- ]
- },
- resetValue:{
- $desc:"重新设置内部值, 界面值和控件值。 该函数不会触发任何事件.",
- $rtn:'[self]',
- $paras:[
- "value [可选参数] : Any, 重设的新值. 默认为 ''."
- ],
- $snippet:[
- "var id='linb.temp.absv14'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.Input({value:'ini'}));"+
- "o.setUIValue('ini2');_.asyRun(function(){o.resetValue('ini2');},1000)"+
- "}"
- ]
- },
- beforeUIValueSet:{
- $desc:"在setUIValue调用之前被调用. 返回false会阻止setUIValue被调用.",
- $paras:[
- "profile : linb.UIProfile.",
- "oldValue : 旧的界面值.",
- "newValue : 新的界面值."
- ],
- $snippet:[
- "var id='linb.temp.absv15'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.Input({value:'ini'}));"+
- "var arr=[];"+
- "o.beforeUIValueSet(function(p,o,v){arr.push('beforeUIValueSet: '+o+'->'+v)}).afterUIValueSet(function(p,o,v){arr.push('afterUIValueSet: '+o+'->'+v)}).beforeValueSet(function(p,o,v){arr.push('beforeValueSet: '+o+'->'+v)}).afterValueSet(function(p,o,v){arr.push('afterValueSet: '+o+'->'+v)});"+
- "_.asyRun(function(){o.setUIValue('ini2');},100);"+
- "_.asyRun(function(){o.setValue('ini3');},200);"+
- "_.asyRun(function(){alert(arr.join('\n'));},220);"+
- "}"
- ]
- },
- afterUIValueSet:{
- $desc:"在setUIValue调用之后被调用.",
- $paras:[
- "profile : linb.UIProfile.",
- "oldValue : 旧的界面值.",
- "newValue : 新的界面值."
- ],
- $snippet:[
- "var id='linb.temp.absv16'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.Input({value:'ini'}));"+
- "var arr=[];"+
- "o.beforeUIValueSet(function(p,o,v){arr.push('beforeUIValueSet: '+o+'->'+v)}).afterUIValueSet(function(p,o,v){arr.push('afterUIValueSet: '+o+'->'+v)}).beforeValueSet(function(p,o,v){arr.push('beforeValueSet: '+o+'->'+v)}).afterValueSet(function(p,o,v){arr.push('afterValueSet: '+o+'->'+v)});"+
- "_.asyRun(function(){o.setUIValue('ini2');},100);"+
- "_.asyRun(function(){o.setValue('ini3');},200);"+
- "_.asyRun(function(){alert(arr.join('\n'));},220);"+
- "}"
- ]
- },
- beforeValueSet:{
- $desc:"在setValue调用之前被调用. 返回false会阻止setValue被调用.",
- $paras:[
- "profile : linb.UIProfile.",
- "oldValue : 旧的内部值.",
- "newValue : 新的内部值."
- ],
- $snippet:[
- "var id='linb.temp.absv17'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.Input({value:'ini'}));"+
- "var arr=[];"+
- "o.beforeUIValueSet(function(p,o,v){arr.push('beforeUIValueSet: '+o+'->'+v)}).afterUIValueSet(function(p,o,v){arr.push('afterUIValueSet: '+o+'->'+v)}).beforeValueSet(function(p,o,v){arr.push('beforeValueSet: '+o+'->'+v)}).afterValueSet(function(p,o,v){arr.push('afterValueSet: '+o+'->'+v)});"+
- "_.asyRun(function(){o.setUIValue('ini2');},100);"+
- "_.asyRun(function(){o.setValue('ini3');},200);"+
- "_.asyRun(function(){alert(arr.join('\n'));},220);"+
- "}"
- ]
- },
- afterValueSet:{
- $desc:"在setValue调用之后被调用.",
- $paras:[
- "profile : linb.UIProfile.",
- "oldValue : 旧的内部值.",
- "newValue : 新的内部值."
- ],
- $snippet:[
- "var id='linb.temp.absv18'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o;linb(id).prepend(o=new linb.UI.Input({value:'ini'}));"+
- "var arr=[];"+
- "o.beforeUIValueSet(function(p,o,v){arr.push('beforeUIValueSet: '+o+'->'+v)}).afterUIValueSet(function(p,o,v){arr.push('afterUIValueSet: '+o+'->'+v)}).beforeValueSet(function(p,o,v){arr.push('beforeValueSet: '+o+'->'+v)}).afterValueSet(function(p,o,v){arr.push('afterValueSet: '+o+'->'+v)});"+
- "_.asyRun(function(){o.setUIValue('ini2');},100);"+
- "_.asyRun(function(){o.setValue('ini3');},200);"+
- "_.asyRun(function(){alert(arr.join('\n'));},220);"+
- "}"
- ]
- },
- beforeDirtyMark:{
- $desc:"在_setDirtyMark调用之前被调用. 返回false将阻止设置脏标志.",
- $paras:[
- "profile : linb.UIProfile.",
- "dirty : 脏标志."
- ],
- $snippet:[
- "var id='linb.temp.absv19'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o1,o2;linb(id).prepend(o1=new linb.UI.Input({value:'111',position:'relative'})).prepend(o2=new linb.UI.Input({value:'111',position:'relative'}));"+
- "o1.beforeDirtyMark(function(p,dirty){p.getSubNode('INPUT').css('background',dirty?'#00ff00':'');return false;});"+
- "_.asyRun(function(){o1.setUIValue('ini');o2.setUIValue('ini');},1000);"+
- "_.asyRun(function(){o1.setUIValue('111');o2.setUIValue('111');},2000);"+
- "}"
- ]
- }
- }
- });
- _.set(linb.Locale,["cn","doc","linb","absPlus"], {
- prototype:{
- getDragKey:{
- $desc:"获取拖动时的标志键",
- $rtn:"String",
- $snippet:[
- "var id='linb.temp.d1'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var btn;linb(id).prepend(btn=new linb.UI.Button);"+
- "_.asyRun(function(){btn.setDragKey('a'); alert(btn.getDragKey())},1000)"+
- "}"
- ]
- },
- setDragKey:{
- $desc:"设置拖动时的标志键",
- $rtn:"[self]",
- $snippet:[
- "var id='linb.temp.d2'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var btn;linb(id).prepend(btn=new linb.UI.Button);"+
- "_.asyRun(function(){btn.setDragKey('a'); alert(btn.getDragKey())},1000)"+
- "}"
- ]
- },
- getDropKeys:{
- $desc:"获取鼠标丢下时的标志键",
- $rtn:"String",
- $snippet:[
- "var id='linb.temp.d3'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var btn;linb(id).prepend(btn=new linb.UI.Block({position:'relative',border:true}));"+
- "_.asyRun(function(){btn.setDropKeys('a:b'); alert(btn.getDropKeys())},1000)"+
- "}"
- ]
- },
- setDropKeys:{
- $desc:"设置鼠标丢下时的标志键",
- $rtn:"[self]",
- $snippet:[
- "var id='linb.temp.d4'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;height:100px;width:300px;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var btn;linb(id).prepend(btn=new linb.UI.Block({position:'relative',border:true}));"+
- "_.asyRun(function(){btn.setDropKeys('a:b'); alert(btn.getDropKeys())},1000)"+
- "}"
- ]
- },
- addPanel:{
- $desc:"添加一个面板.",
- $paras:[
- "para [必需参数] : 键值对.",
- "children [必需参数] : Array. 面板的子控件.",
- "item [可选参数] : Object"
- ],
- $snippet:[
- "var id='linb.temp.d5'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var panel, tabs;"+
- "linb(id).prepend(panel=new linb.UI.Panel({height:100,width:100,dock:'none',position:'relative'}));"+
- "panel.append(new linb.UI.Button);"+
- "linb(id).prepend(tabs=new linb.UI.Tabs({position:'relative',width:200, height:100, dock:'none',items:[{id:'a',caption:'a'},{id:'b',caption:'b'}]}));"+
- "_.asyRun(function(){tabs.addPanel(panel.getPanelPara(), panel.getPanelChildren()); panel.removePanel();},1000);"+
- "}"
- ]
- },
- removePanel:{
- $desc:"移除面板.",
- $snippet:[
- "var id='linb.temp.d6'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var panel, tabs;"+
- "linb(id).prepend(panel=new linb.UI.Panel({height:100,width:100,dock:'none',position:'relative'}));"+
- "panel.append(new linb.UI.Button);"+
- "linb(id).prepend(tabs=new linb.UI.Tabs({position:'relative',width:200, height:100, dock:'none',items:[{id:'a',caption:'a'},{id:'b',caption:'b'}]}));"+
- "_.asyRun(function(){tabs.addPanel(panel.getPanelPara(), panel.getPanelChildren()); panel.removePanel();},1000);"+
- "}"
- ]
- },
- getPanelPara:{
- $desc:"获取面板参数.",
- $snippet:[
- "var id='linb.temp.d8'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var panel, tabs;"+
- "linb(id).prepend(panel=new linb.UI.Panel({height:100,width:100,dock:'none',position:'relative'}));"+
- "panel.append(new linb.UI.Button);"+
- "linb(id).prepend(tabs=new linb.UI.Tabs({position:'relative',width:200, height:100, dock:'none',items:[{id:'a',caption:'a'},{id:'b',caption:'b'}]}));"+
- "_.asyRun(function(){tabs.addPanel(panel.getPanelPara(), panel.getPanelChildren()); panel.removePanel();},1000);"+
- "}"
- ]
- },
- getPanelChildren:{
- $desc:"获取面板的子控件.",
- $snippet:[
- "var id='linb.temp.d9'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var panel, tabs;"+
- "linb(id).prepend(panel=new linb.UI.Panel({height:100,width:100,dock:'none',position:'relative'}));"+
- "panel.append(new linb.UI.Button);"+
- "linb(id).prepend(tabs=new linb.UI.Tabs({position:'relative',width:200, height:100, dock:'none',items:[{id:'a',caption:'a'},{id:'b',caption:'b'}]}));"+
- "_.asyRun(function(){tabs.addPanel(panel.getPanelPara(), panel.getPanelChildren()); panel.removePanel();},1000);"+
- "}"
- ]
- },
- onHotKeydown:{
- $desc:"当热键按下时被调用.",
- $paras:[
- "profile : linb.UIProfile.",
- "key : String, 按下的字符.",
- "control: Number, 1 or 0, 标志'control'是否被按下.",
- "shift: Number, 1 or 0, 标志'shift'是否被按下.",
- "alt: Number, 1 or 0, 标志'alt'是否被按下.",
- "e : DOM 事件.",
- "src : 事件发生的DOM元素."
- ],
- $snippet:[
- "var id='linb.temp.c1'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var w, arr;linb(id).prepend(w=new linb.UI.Widget({position:'relative'}));"+
- "w.setCustomStyle('KEY','border:solid 1px').getSubNode('BORDER').append(linb.create('<input />'));"+
- "w.onHotKeydown(function( profile, key, control, shift, alt, e, src ){arr=[];arr.push(['onHotKeydown',key,control,shift,alt])});"+
- "w.onHotKeypress(function( profile, key, control, shift, alt, e, src ){arr.push(['onHotKeypress',key,control,shift,alt]); });"+
- "w.onHotKeyup(function( profile, key, control, shift, alt, e, src ){arr.push(['onHotKeyup',key,control,shift,alt]);alert(arr);});"+
- "}"
- ]
- },
- onHotKeyup:{
- $desc:"当热键弹起时被调用..",
- $paras:[
- "profile : linb.UIProfile.",
- "key : String, 按下的字符.",
- "control: Number, 1 or 0, 标志'control'是否被按下.",
- "shift: Number, 1 or 0, 标志'shift'是否被按下.",
- "alt: Number, 1 or 0, 标志'alt'是否被按下.",
- "e : DOM 事件.",
- "src : 事件发生的DOM元素."
- ],
- $snippet:[
- "var id='linb.temp.c2'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var w, arr;linb(id).prepend(w=new linb.UI.Widget({position:'relative'}));"+
- "w.setCustomStyle('KEY','border:solid 1px').getSubNode('BORDER').append(linb.create('<input />'));"+
- "w.onHotKeydown(function( profile, key, control, shift, alt, e, src ){arr=[];arr.push(['onHotKeydown',key,control,shift,alt])});"+
- "w.onHotKeypress(function( profile, key, control, shift, alt, e, src ){arr.push(['onHotKeypress',key,control,shift,alt]); });"+
- "w.onHotKeyup(function( profile, key, control, shift, alt, e, src ){arr.push(['onHotKeyup',key,control,shift,alt]);alert(arr);});"+
- "}"
- ]
- },
- onHotKeypress:{
- $desc:"当热键被按后调用.",
- $paras:[
- "profile : linb.UIProfile.",
- "key : String, 按下的字符.",
- "control: Number, 1 or 0, 标志'control'是否被按下.",
- "shift: Number, 1 or 0, 标志'shift'是否被按下.",
- "alt: Number, 1 or 0, 标志'alt'是否被按下.",
- "e : DOM 事件.",
- "src : 事件发生的DOM元素."
- ],
- $snippet:[
- "var id='linb.temp.c3'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var w, arr;linb(id).prepend(w=new linb.UI.Widget({position:'relative'}));"+
- "w.setCustomStyle('KEY','border:solid 1px').getSubNode('BORDER').append(linb.create('<input />'));"+
- "w.onHotKeydown(function( profile, key, control, shift, alt, e, src ){arr=[];arr.push(['onHotKeydown',key,control,shift,alt])});"+
- "w.onHotKeypress(function( profile, key, control, shift, alt, e, src ){arr.push(['onHotKeypress',key,control,shift,alt]); });"+
- "w.onHotKeyup(function( profile, key, control, shift, alt, e, src ){arr.push(['onHotKeyup',key,control,shift,alt]);alert(arr);});"+
- "}"
- ]
- },
- onDragEnter:{
- $desc:"当用户拖动某个对象到该对象上空时.",
- $paras:[
- "profile : linb.UIProfile.",
- "e : DOM事件元素.",
- "src : 事件发生的DOM元素.",
- "key : String, 被拖动物体的拖动标志串.",
- "data : Object, 拖动物体代表的数据.",
- "item : Object, 被拖动物体的项."
- ],
- $snippet:[
- "var id='linb.temp.ab1'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var block,btn1,btn2;linb(id).prepend(block=new linb.UI.Block({position:'relative',width:'200',border:true,dropKeys:['test']})).prepend(btn1=new linb.UI.Button({position:'relative'})).prepend(btn2=new linb.UI.Button({position:'relative'}));"+
- "btn2.get(0).$noDrop=true;"+
- "btn1.dragable('test',btn1.getDomId());"+
- "btn2.dragable('test','abc');"+
- "block.onDragEnter(function(p,e,n,k,d,i){block.setHtml(k+':'+d+' onDragEnter')});"+
- "block.onDragLeave(function(p,e,n,k,d,i){block.setHtml(k+':'+d+' onDragLeave')});"+
- "block.onDrop(function(p,e,n,k,d,i){block.setHtml(k+':'+d+' onDrop')});"+
- "block.onDropMarkClear(function(p,e,n,k,d,i){block.getSubNode('PANEL').css('background','#fff')});"+
- "block.onDropMarkShow(function(p,e,n,k,d,i){block.getSubNode('PANEL').css('background','#ccc')});"+
- "block.onDropTest(function(p,e,n,k,d,i){return d!='abc';});"+
- "}"
- ]
- },
- onDragLeave:{
- $desc:"当用户拖动某个对象离开该对象上空时.",
- $paras:[
- "profile : linb.UIProfile.",
- "e : DOM事件元素.",
- "src : 事件发生的DOM元素.",
- "key : String, 被拖动物体的拖动标志串.",
- "data : Object, 拖动物体代表的数据.",
- "item : Object, 被拖动物体的项."
- ],
- $snippet:[
- "var id='linb.temp.ab2'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var block,btn1,btn2;linb(id).prepend(block=new linb.UI.Block({position:'relative',width:'200',border:true,dropKeys:['test']})).prepend(btn1=new linb.UI.Button({position:'relative'})).prepend(btn2=new linb.UI.Button({position:'relative'}));"+
- "btn2.get(0).$noDrop=true;"+
- "btn1.dragable('test',btn1.getDomId());"+
- "btn2.dragable('test','abc');"+
- "block.onDragEnter(function(p,e,n,k,d,i){block.setHtml(k+':'+d+' onDragEnter')});"+
- "block.onDragLeave(function(p,e,n,k,d,i){block.setHtml(k+':'+d+' onDragLeave')});"+
- "block.onDrop(function(p,e,n,k,d,i){block.setHtml(k+':'+d+' onDrop')});"+
- "block.onDropMarkClear(function(p,e,n,k,d,i){block.getSubNode('PANEL').css('background','#fff')});"+
- "block.onDropMarkShow(function(p,e,n,k,d,i){block.getSubNode('PANEL').css('background','#ccc')});"+
- "block.onDropTest(function(p,e,n,k,d,i){return d!='abc';});"+
- "}"
- ]
- },
- onDrop:{
- $desc:"当用户拖动某个对象在该对象上空放下时.",
- $paras:[
- "profile : linb.UIProfile.",
- "e : DOM事件元素.",
- "src : 事件发生的DOM元素.",
- "node : 被拖动对象的DOM元素.",
- "key : String, 被拖动物体的拖动标志串.",
- "data : Object, 拖动物体代表的数据.",
- "item : Object, 被拖动物体的项."
- ],
- $snippet:[
- "var id='linb.temp.ab3'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var block,btn1,btn2;linb(id).prepend(block=new linb.UI.Block({position:'relative',width:'200',border:true,dropKeys:['test']})).prepend(btn1=new linb.UI.Button({position:'relative'})).prepend(btn2=new linb.UI.Button({position:'relative'}));"+
- "btn2.get(0).$noDrop=true;"+
- "btn1.dragable('test',btn1.getDomId());"+
- "btn2.dragable('test','abc');"+
- "block.onDragEnter(function(p,e,n,k,d,i){block.setHtml(k+':'+d+' onDragEnter')});"+
- "block.onDragLeave(function(p,e,n,k,d,i){block.setHtml(k+':'+d+' onDragLeave')});"+
- "block.onDrop(function(p,e,n,k,d,i){block.setHtml(k+':'+d+' onDrop')});"+
- "block.onDropMarkClear(function(p,e,n,k,d,i){block.getSubNode('PANEL').css('background','#fff')});"+
- "block.onDropMarkShow(function(p,e,n,k,d,i){block.getSubNode('PANEL').css('background','#ccc')});"+
- "block.onDropTest(function(p,e,n,k,d,i){return d!='abc';});"+
- "}"
- ]
- },
- onDropMarkClear:{
- $desc:"当丢放标志被清除时调用.",
- $paras:[
- "profile : linb.UIProfile.",
- "e : DOM事件元素.",
- "src : 事件发生的DOM元素.",
- "key : String, 被拖动物体的拖动标志串.",
- "data : Object, 拖动物体代表的数据.",
- "item : Object, 被拖动物体的项."
- ],
- $snippet:[
- "var id='linb.temp.ab4'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var block,btn1,btn2;linb(id).prepend(block=new linb.UI.Block({position:'relative',width:'200',border:true,dropKeys:['test']})).prepend(btn1=new linb.UI.Button({position:'relative'})).prepend(btn2=new linb.UI.Button({position:'relative'}));"+
- "btn2.get(0).$noDrop=true;"+
- "btn1.dragable('test',btn1.getDomId());"+
- "btn2.dragable('test','abc');"+
- "block.onDragEnter(function(p,e,n,k,d,i){block.setHtml(k+':'+d+' onDragEnter')});"+
- "block.onDragLeave(function(p,e,n,k,d,i){block.setHtml(k+':'+d+' onDragLeave')});"+
- "block.onDrop(function(p,e,n,k,d,i){block.setHtml(k+':'+d+' onDrop')});"+
- "block.onDropMarkClear(function(p,e,n,k,d,i){block.getSubNode('PANEL').css('background','#fff')});"+
- "block.onDropMarkShow(function(p,e,n,k,d,i){block.getSubNode('PANEL').css('background','#ccc')});"+
- "block.onDropTest(function(p,e,n,k,d,i){return d!='abc';});"+
- "}"
- ]
- },
- onDropMarkShow:{
- $desc:"当丢放标志被显示时调用.",
- $paras:[
- "profile : linb.UIProfile.",
- "e : DOM事件元素.",
- "src : 事件发生的DOM元素.",
- "key : String, 被拖动物体的拖动标志串.",
- "data : Object, 拖动物体代表的数据.",
- "item : Object, 被拖动物体的项."
- ],
- $snippet:[
- "var id='linb.temp.ab5'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var block,btn1,btn2;linb(id).prepend(block=new linb.UI.Block({position:'relative',width:'200',border:true,dropKeys:['test']})).prepend(btn1=new linb.UI.Button({position:'relative'})).prepend(btn2=new linb.UI.Button({position:'relative'}));"+
- "btn2.get(0).$noDrop=true;"+
- "btn1.dragable('test',btn1.getDomId());"+
- "btn2.dragable('test','abc');"+
- "block.onDragEnter(function(p,e,n,k,d,i){block.setHtml(k+':'+d+' onDragEnter')});"+
- "block.onDragLeave(function(p,e,n,k,d,i){block.setHtml(k+':'+d+' onDragLeave')});"+
- "block.onDrop(function(p,e,n,k,d,i){block.setHtml(k+':'+d+' onDrop')});"+
- "block.onDropMarkClear(function(p,e,n,k,d,i){block.getSubNode('PANEL').css('background','#fff')});"+
- "block.onDropMarkShow(function(p,e,n,k,d,i){block.getSubNode('PANEL').css('background','#ccc')});"+
- "block.onDropTest(function(p,e,n,k,d,i){return d!='abc';});"+
- "}"
- ]
- },
- onDropTest:{
- $desc:"当判断该对象是否接受拖动时被调用.",
- $paras:[
- "profile : linb.UIProfile.",
- "e : DOM事件元素.",
- "src : 事件发生的DOM元素.",
- "key : String, 被拖动物体的拖动标志串.",
- "data : Object, 拖动物体代表的数据.",
- "item : Object, 被拖动物体的项."
- ],
- $snippet:[
- "var id='linb.temp.ab61'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var block,btn1,btn2;linb(id).prepend(block=new linb.UI.Block({position:'relative',width:'200',border:true,dropKeys:['test']})).prepend(btn1=new linb.UI.Button({position:'relative'})).prepend(btn2=new linb.UI.Button({position:'relative'}));"+
- "btn2.get(0).$noDrop=true;"+
- "btn1.dragable('test',btn1.getDomId());"+
- "btn2.dragable('test','abc');"+
- "block.onDragEnter(function(p,e,n,k,d,i){block.setHtml(k+':'+d+' onDragEnter')});"+
- "block.onDragLeave(function(p,e,n,k,d,i){block.setHtml(k+':'+d+' onDragLeave')});"+
- "block.onDrop(function(p,e,n,k,d,i){block.setHtml(k+':'+d+' onDrop')});"+
- "block.onDropMarkClear(function(p,e,n,k,d,i){block.getSubNode('PANEL').css('background','#fff')});"+
- "block.onDropMarkShow(function(p,e,n,k,d,i){block.getSubNode('PANEL').css('background','#ccc')});"+
- "block.onDropTest(function(p,e,n,k,d,i){return d!='abc';});"+
- "}"
- ]
- },
- onStartDrag:{
- $desc:"当用户开始拖动该对象时调用.",
- $paras:[
- "profile : linb.UIProfile.",
- "e : DOM事件元素.",
- "src : 事件发生的DOM元素."
- ],
- $snippet:[
- "var id='linb.temp.ab661'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var list1,list2;linb(id).prepend(list1=new linb.UI.List({position:'relative',width:'200',border:true,dragKey:'test',items:['aa','bb','cc']})).prepend(list2=new linb.UI.List({position:'relative',width:'200',border:true,dragKey:'test',items:['aa','bb','cc']}));"+
- "list2.onStartDrag(function(p,e,n){return false;});"+
- "list1.onStartDrag(function(p,e,n){linb.message('onStartDrag');});"+
- "list1.onDragStop(function(p,e,n){linb.message('onDragStop');});"+
- "}"
- ]
- },
- onDragstop:{
- $desc:"当用户结束拖动该对象时调用.",
- $paras:[
- "profile : linb.UIProfile.",
- "e : DOM事件元素.",
- "src : 事件发生的DOM元素."
- ],
- $snippet:[
- "var id='linb.temp.ab662'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var list1,list2;linb(id).prepend(list1=new linb.UI.List({position:'relative',width:'200',border:true,dragKey:'test',items:['aa','bb','cc']})).prepend(list2=new linb.UI.List({position:'relative',width:'200',border:true,dragKey:'test',items:['aa','bb','cc']}));"+
- "list2.onStartDrag(function(p,e,n){return false;});"+
- "list1.onStartDrag(function(p,e,n){linb.message('onStartDrag');});"+
- "list1.onDragStop(function(p,e,n){linb.message('onDragStop');});"+
- "}"
- ]
- },
- beforeClickEffect:{
- $desc:"当用户单击控件的某一部分,控件响应该事件,要改变外观(例如反白等)时被调用. 返回false时, 默认的效果(如反白)将不会被显示.",
- $paras:[
- "profile : linb.UIProfile.",
- "item : Object, 数据项对象.",
- "e : DOM事件元素.",
- "src : 事件发生的DOM元素.",
- "type : String, 'mousedown'或'mouseup'."
- ],
- $snippet:[
- "var id='linb.temp.ab7'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var btn;linb(id).append(btn=new linb.UI.Button({position:'relative'}));"+
- "btn.beforeClickEffect(function(p,i,e,s,t){linb([s]).css('border',t=='mousedown'?'solid 1px;':'');return false;});"+
- "}"
- ]
- },
- beforeHoverEffect:{
- $desc:"当鼠标悬停在控件的某一部分上,控件响应该事件,要改变外观(例如反白等)时被调用. 返回false时, 默认的效果(如反白)将不会被显示.",
- $paras:[
- "profile : linb.UIProfile.",
- "item : Object, 数据项对象.",
- "e : DOM事件元素.",
- "src : 事件发生的DOM元素.",
- "type : String, 'mousedown'或'mouseup'."
- ],
- $snippet:[
- "var id='linb.temp.ab8'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var btn;linb(id).append(btn=new linb.UI.Button({position:'relative'}));"+
- "btn.beforeHoverEffect(function(p,i,e,s,t){linb([s]).css('border',t=='mouseover'?'solid 1px;':'');return false;});"+
- "}"
- ]
- },
- beforeNextFocus:{
- $desc:"在下一个控件获取焦点时调用. 返回false可以阻止下一个控件获取焦点.",
- $paras:[
- "profile : linb.UIProfile.",
- "e : DOM事件元素.",
- "shift: Bool, 指示用户是否按下了Shift键.",
- "src : 事件发生的DOM元素."
- ],
- $snippet:[
- "var id='linb.temp.ab9'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var btn;linb(id).append(new linb.UI.Button({position:'relative'})).append(new linb.UI.Button({position:'relative'})).append(btn=new linb.UI.Button({position:'relative'})).append(new linb.UI.Button({position:'relative'}));"+
- "btn.beforeNextFocus(function(){return false;});"+
- "}"
- ]
- }
- }
- });
- _.set(linb.Locale,["cn","doc","linb","UI"], {
- buildCSSText:{
- $desc:"由指定的键/值对生成CSS样式.",
- $rtn:"String. CSS样式",
- $paras:[
- "hash [必需参数] : 键/值对."
- ],
- $snippet:[
- "alert(linb.UI.Button.buildCSSText({KEY:{left:linb.browser.ie?0:null,overflow:linb.browser.gek?'auto':null,'font-size':'12px'},BORDER:{'_line-height':10,'-moz-display':'none'}}));"+
- "alert(linb.UI.Button.buildCSSText({KEY:{left:linb.browser.ie?0:null,overflow:linb.browser.gek?'auto':null,'font-size':'12px'},BORDER:{'_line-height':10,'-moz-display':'none'}},'mac'));"
- ]
- },
- getTheme:{
- $desc:"获取皮肤键字符串.",
- $rtn:"String",
- $snippet:[
- "alert(linb.UI.getTheme());"
- ]
- },
- setTheme:{
- $desc:"设置皮肤键字符串.",
- $rtn:"[self]",
- $paras:[
- "key [可选参数] : String, 皮肤键字符串."
- ],
- $snippet:[
- "//linb.UI.setTheme('xp')"
- ]
- },
- adjustData:{
- $desc:"调整输入的键/值对,输出合适的数据格式以便UI控件生成.",
- $rtn:"key/value pairs.",
- $paras:[
- "profile [必需参数] : 目标profile",
- "hashIn [必需参数] : 键/值对, 输入参数.",
- "hashOut [可选参数] : 键/值对, 输出参数."
- ],
- $snippet:[
- "alert(_.serialize(linb.UI.adjustData(null, {a:1,b:2,c:'$date.MS',d:'@linb.ini.path',renderer:function(){return 'cap';}})))"
- ]
- },
- addTemplateKeys:{
- $desc:"添加一系列模板键到当前的UI控件.",
- $rtn:'[self]',
- $paras:[
- "arr [必需参数] : Array, 模板键数组."
- ],
- $snippet:[
- "alert(_.serialize(linb.UI.Div.$Keys)); alert(_.serialize(linb.UI.Div.addTemplateKeys(['A','B']).$Keys))"
- ],
- $memo:"一般情况下,程序员无需直接调用该函数."
- },
- getAppearance:{
- $desc:"获取控件外表对象",
- $rtn:'object',
- $snippet:[
- "alert(_.serialize(linb.UI.Div.getAppearance()))"
- ],
- $memo:"一般情况下,程序员无需直接调用该函数."
- },
- getTemplate:{
- $desc:"从一个缓存id中设置获取模板对象.",
- $rtn:'object',
- $paras:[
- "cacheId [可选参数] : String."
- ],
- $snippet:[
- "alert(_.serialize(linb.UI.Div.getTemplate()))"
- ],
- $memo:"一般情况下,程序员无需直接调用该函数."
- },
- getBehavior:{
- $desc:"获取控件行为对象.",
- $rtn:'object',
- $snippet:[
- "alert(_.serialize(linb.UI.Link.getBehavior()))"
- ],
- $memo:"一般情况下,程序员无需直接调用该函数."
- },
- setAppearance:{
- $desc:"设置控件外表对象.",
- $rtn:'[self]',
- $paras:[
- "hash [必需参数] : key/value pairs."
- ],
- $memo:"一般情况下,程序员无需直接调用该函数."
- },
- setTemplate:{
- $desc:"设置一个模板对象到指定的缓存id中.",
- $rtn:'[self]',
- $paras:[
- "hash [必需参数] : key/value pairs.",
- "cacheId [可选参数] : String."
- ],
- $memo:"一般情况下,程序员无需直接调用该函数."
- },
- setBehavior:{
- $desc:"设置行为对象.",
- $rtn:'[self]',
- $memo:"一般情况下,程序员无需直接调用该函数."
- },
- cacheData:{
- $desc:"缓存数据或移除缓存数据。并为该缓存数据指定一个唯一标志.",
- $rtn:'[self]',
- $paras:[
- "key [必需参数] : String, 缓存数据的唯一标志.",
- "data [可选参数] : Any. 如果设置为undefined, 则移除标志为key的缓存数据."
- ],
- $snippet:[
- "linb.UI.cacheData('a',1); alert(linb.UI.getCachedData('a')); linb.UI.cacheData('a')"
- ]
- },
- getCachedData:{
- $desc:"获取指定标志的缓存数据.",
- $rtn:"Any",
- $paras:[
- "key [必需参数] : String, cache key."
- ],
- $snippet:[
- "linb.UI.cacheData('a',1); alert(linb.UI.getCachedData('a')); linb.UI.cacheData('a')"
- ]
- },
- getDragData:{
- $desc:"获取拖动数据.",
- $rtn:"Object",
- $paras:[
- "profile [必需参数] : 目标profile对象",
- "node [必需参数] : 相关的DOM元素."
- ],
- $memo:"一般情况下,程序员无需直接调用该函数. 该函数会被部分子类覆盖."
- },
- getDragKey:{
- $desc:"获取拖动时的键名字.",
- $rtn:"String",
- $paras:[
- "profile [必需参数] : 目标profile对象",
- "node [必需参数] : 相关的DOM元素."
- ],
- $memo:"一般情况下,程序员无需直接调用该函数. 该函数会被部分子类覆盖."
- },
- getDropKeys:{
- $desc:"设置拖动时的键名字.",
- $rtn:"Array",
- $paras:[
- "profile [必需参数] : the target profile",
- "node [必需参数] : the related DOM element."
- ],
- $memo:"一般情况下,程序员无需直接调用该函数. 该函数会被部分子类覆盖."
- },
- unserialize:{
- $desc:"将JSON字符串或数组反序列化为linb.UI对象.",
- $rtn:"linb.UI object",
- $paras:[
- "target [必需参数] : String or Array.",
- "keepSerialId [可选参数] : Bool. 指示是否保留序列号. 默认为 [false]."
- ],
- $snippet:[
- "var s=linb.UIProfile.getFromDomId('logo').boxing().serialize(false); alert(_.serialize(s)); alert(linb.UI.unserialize(s))"
- ]
- },
- prototype:{
- busy:{
- $desc:"将鼠标显示为沙漏(并将一个div覆盖在当前控件上). ",
- $rtn:"[self]",
- $paras:[
- "message [可选参数] : String, 说明文字.",
- "html [可选参数] : String, 说明html字符串.",
- "key [可选参数] : String, 覆盖div的父key. 默认为 'BORDER'."
- ],
- $snippet:[
- "var id='linb.temp.tl1'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o=new linb.UI.TimeLine({position:'relative'});"+
- "linb(id).prepend(o);"+
- "o.busy('Loading message');"+
- "_.asyRun(function(){o.free()},1000);"+
- "}"
- ]
- },
- free:{
- $desc:"将鼠标显示为正常(并将覆盖div移除).",
- $rtn:"[self]",
- $snippet:[
- "var id='linb.temp.tl2'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:20px;position:relative;">' + '<button style="position:absolute; bottom:0px; z-index:2;" onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var o=new linb.UI.TimeLine({position:'relative'});"+
- "linb(id).prepend(o);"+
- "o.busy('Loading message');"+
- "_.asyRun(function(){o.free()},1000);"+
- "}"
- ]
- },
- resize:{
- $desc:"触发onresize事件.",
- $rtn:"[self]"
- },
- getChildren:{
- $desc:"Gets the current widget's children.",
- $rtn:"linb.UI object",
- $paras:[
- "subId [Optional] : String, the sub id."
- ],
- $snippet:[
- "var id='linb.temp.ui-1e'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var tabs;linb(id).prepend(tabs=linb.create({key:'linb.UI.Tabs',properties:{dock:'none',width:200,height:100,position:'relative',items:['a','b','c'],value:'a'},children:[[{key:'linb.UI.Button'},'a'],[{key:'linb.UI.Button'},'b'],[{key:'linb.UI.Button'},'c']]}));"+
- "_.asyRun(function(){alert(tabs.getChildren().get().length);alert(tabs.getChildren('a').get().length);},1000);"+
- "}"
- ]
- },
- toHtml:{
- $desc:"To build HTML string from the current object, and returns it.",
- $rtn:"String",
- $snippet:[
- "alert(linb.UIProfile.getFromDomId('logo').boxing().toHtml())"
- ]
- },
- getRenderer:{
- $desc:"获取渲染函数.",
- $rtn:"Function",
- $snippet:[
- "var id='linb.temp.ui-1'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var link=new linb.UI.Link({position:'relative'});"+
- "link.setRenderer(function(item){return '['+item.caption+']'});"+
- "linb(id).prepend(link);"+
- "_.asyRun(function(){alert(link.getRenderer());},1000);"+
- "}"
- ]
- },
- setRenderer:{
- $desc:"设置渲染函数.",
- $rtn:"[self]",
- $paras:[
- "value [必需参数] : Function",
- "flag [可选参数] : Bool, force to set the property value even if the same property value already exists. 默认为 [false]."
- ],
- $snippet:[
- "var id='linb.temp.ui-2'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var link=new linb.UI.Link({position:'relative'});"+
- "link.setRenderer(function(item){return '<span style="width:15px;height:15px;background:url(img/img.gif)"></span> ['+item.caption+']'});"+
- "linb(id).prepend(link);"+
- "_.asyRun(function(){alert(link.getRenderer());},1000);"+
- "}"
- ]
- },
- getRoot:{
- $desc:"获取根(linb.Dom)对象.",
- $rtn:"linb.Dom element",
- $snippet:[
- "alert(linb.UIProfile.getFromDomId('logo').boxing().getRoot());"
- ]
- },
- getRootNode:{
- $desc:"获取根DOM元素.",
- $rtn:"DOM element",
- $snippet:[
- "alert(linb.UIProfile.getFromDomId('logo').boxing().getRootNode());"
- ]
- },
- append:{
- $desc:"添加一系列的linb.UIProfile到当前对象上.",
- $rtn:"[self]",
- $paras:[
- "target [必需参数] : a linb.UI ojbect(including a set of linb.UIProfile objects).",
- "subId [可选参数] : String, the sub id that Determines the [target] will be added to which sub DOM node. This parameter can be [false] too, that means the [target] will be appended to DOM only, no link created between the [target] UIProfiles and the parent UIProfile."
- ],
- $snippet:[
- "var id='linb.temp.ui2'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+
- "var block,btn1,btn2;linb(id).prepend(block=new linb.UI.Block({border:true}));"+
- "block.append(btn1=new linb.UI.Button({position:'relative'})).append(btn2=new linb.UI.Button({position:'relative'}), false);"+
- "alert(btn1.get(0).parent===block.get(0));alert(btn2.get(0).parent);"+
- "}"
- ]
- },
- removeChildren:{
- $desc:"移除内部所有的子控件.",
- $rtn:"[self]",
- $paras:[
- "subId [可选参数] : String, the sub id that Determines which profile will be removeed."
- ],
- $snippet:[
- "var id='linb.temp.ui2'; if(!linb.Dom.byId(id)){this.prepend(linb.create('<div id='+id+' style="border:solid 1px;padding:10px;">' + '<br /><button onclick="linb(this).parent().remove()">remove this example</button>' + '</div>'));"+