root / trunk / web / dojo / dojox / editor / plugins / StatusBar.js
History | View | Annotate | Download (2.83 KB)
1 | 9 | andrej.cim | /*
|
---|---|---|---|
2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||
3 | Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
4 | see: http://dojotoolkit.org/license for details
|
||
5 | */
|
||
6 | |||
7 | |||
8 | if(!dojo._hasResource["dojox.editor.plugins.StatusBar"]){ |
||
9 | dojo._hasResource["dojox.editor.plugins.StatusBar"]=true; |
||
10 | dojo.provide("dojox.editor.plugins.StatusBar");
|
||
11 | dojo.require("dijit._editor._Plugin");
|
||
12 | dojo.require("dijit.Toolbar");
|
||
13 | dojo.require("dojox.layout.ResizeHandle");
|
||
14 | dojo.experimental("dojox.editor.plugins.StatusBar");
|
||
15 | dojo.declare("dojox.editor.plugins._StatusBar",[dijit._Widget,dijit._Templated],{templateString:"<div class=\"dojoxEditorStatusBar\">"+"<table><tbody><tr>"+"<td class=\"dojoxEditorStatusBarText\" tabindex=\"-1\" aria-role=\"presentation\" aria-live=\"aggressive\"><span dojoAttachPoint=\"barContent\"> </span></td>"+"<td><span dojoAttachPoint=\"handle\"></span></td>"+"</tr></tbody><table>"+"</div>",_getValueAttr:function(){ |
||
16 | return this.barContent.innerHTML; |
||
17 | },_setValueAttr:function(_1){ |
||
18 | if(_1){
|
||
19 | _1=dojo.trim(_1); |
||
20 | if(!_1){
|
||
21 | _1=" ";
|
||
22 | } |
||
23 | }else{
|
||
24 | _1=" ";
|
||
25 | } |
||
26 | this.barContent.innerHTML=_1;
|
||
27 | }}); |
||
28 | dojo.declare("dojox.editor.plugins.StatusBar",dijit._editor._Plugin,{statusBar:null,resizer:true,setEditor:function(_2){ |
||
29 | this.editor=_2;
|
||
30 | this.statusBar=new dojox.editor.plugins._StatusBar(); |
||
31 | if(this.resizer){ |
||
32 | this.resizeHandle=new dojox.layout.ResizeHandle({targetId:this.editor,activeResize:true},this.statusBar.handle); |
||
33 | this.resizeHandle.startup();
|
||
34 | }else{
|
||
35 | dojo.style(this.statusBar.handle.parentNode,"display","none"); |
||
36 | } |
||
37 | var _3=null; |
||
38 | if(_2.footer.lastChild){
|
||
39 | _3="after";
|
||
40 | } |
||
41 | dojo.place(this.statusBar.domNode,_2.footer.lastChild||_2.footer,_3);
|
||
42 | this.statusBar.startup();
|
||
43 | this.editor.statusBar=this; |
||
44 | this._msgListener=dojo.subscribe(this.editor.id+"_statusBar",dojo.hitch(this,this._setValueAttr)); |
||
45 | },_getValueAttr:function(){ |
||
46 | return this.statusBar.get("value"); |
||
47 | },_setValueAttr:function(_4){ |
||
48 | this.statusBar.set("value",_4); |
||
49 | },set:function(_5,_6){ |
||
50 | if(_5){
|
||
51 | var _7="_set"+_5.charAt(0).toUpperCase()+_5.substring(1,_5.length)+"Attr"; |
||
52 | if(dojo.isFunction(this[_7])){ |
||
53 | this[_7](_6);
|
||
54 | }else{
|
||
55 | this[_5]=_6;
|
||
56 | } |
||
57 | } |
||
58 | },get:function(_8){ |
||
59 | if(_8){
|
||
60 | var _9="_get"+_8.charAt(0).toUpperCase()+_8.substring(1,_8.length)+"Attr"; |
||
61 | var f=this[_9]; |
||
62 | if(dojo.isFunction(f)){
|
||
63 | return this[_9](); |
||
64 | }else{
|
||
65 | return this[_8]; |
||
66 | } |
||
67 | } |
||
68 | return null; |
||
69 | },destroy:function(){ |
||
70 | if(this.statusBar){ |
||
71 | this.statusBar.destroy();
|
||
72 | delete this.statusBar; |
||
73 | } |
||
74 | if(this.resizeHandle){ |
||
75 | this.resizeHandle.destroy();
|
||
76 | delete this.resizeHandle; |
||
77 | } |
||
78 | if(this._msgListener){ |
||
79 | dojo.unsubscribe(this._msgListener);
|
||
80 | delete this._msgListener; |
||
81 | } |
||
82 | delete this.editor.statusBar; |
||
83 | }}); |
||
84 | dojo.subscribe(dijit._scopeName+".Editor.getPlugin",null,function(o){ |
||
85 | if(o.plugin){
|
||
86 | return;
|
||
87 | } |
||
88 | var _a=o.args.name.toLowerCase();
|
||
89 | if(_a==="statusbar"){ |
||
90 | var _b=("resizer" in o.args)?o.args.resizer:true; |
||
91 | o.plugin=new dojox.editor.plugins.StatusBar({resizer:_b}); |
||
92 | } |
||
93 | }); |
||
94 | } |