Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / dtl / _DomTemplated.js @ 12

History | View | Annotate | Download (1.85 KB)

1
/*
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.dtl._DomTemplated"]){
9
dojo._hasResource["dojox.dtl._DomTemplated"]=true;
10
dojo.provide("dojox.dtl._DomTemplated");
11
dojo.require("dijit._Templated");
12
dojo.require("dojox.dtl.dom");
13
dojo.require("dojox.dtl.render.dom");
14
dojo.require("dojox.dtl.contrib.dijit");
15
dojox.dtl._DomTemplated=function(){
16
};
17
dojox.dtl._DomTemplated.prototype={_dijitTemplateCompat:false,buildRendering:function(){
18
this.domNode=this.srcNodeRef;
19
if(!this._render){
20
var _1=dojox.dtl.contrib.dijit;
21
var _2=_1.widgetsInTemplate;
22
_1.widgetsInTemplate=this.widgetsInTemplate;
23
this.template=this.template||this._getCachedTemplate(this.templatePath,this.templateString);
24
this._render=new dojox.dtl.render.dom.Render(this.domNode,this.template);
25
_1.widgetsInTemplate=_2;
26
}
27
var _3=this._getContext();
28
if(!this._created){
29
delete _3._getter;
30
}
31
this.render(_3);
32
this.domNode=this.template.getRootNode();
33
if(this.srcNodeRef&&this.srcNodeRef.parentNode){
34
dojo.destroy(this.srcNodeRef);
35
delete this.srcNodeRef;
36
}
37
},setTemplate:function(_4,_5){
38
if(dojox.dtl.text._isTemplate(_4)){
39
this.template=this._getCachedTemplate(null,_4);
40
}else{
41
this.template=this._getCachedTemplate(_4);
42
}
43
this.render(_5);
44
},render:function(_6,_7){
45
if(_7){
46
this.template=_7;
47
}
48
this._render.render(this._getContext(_6),this.template);
49
},_getContext:function(_8){
50
if(!(_8 instanceof dojox.dtl.Context)){
51
_8=false;
52
}
53
_8=_8||new dojox.dtl.Context(this);
54
_8.setThis(this);
55
return _8;
56
},_getCachedTemplate:function(_9,_a){
57
if(!this._templates){
58
this._templates={};
59
}
60
var _b=_a||_9.toString();
61
var _c=this._templates;
62
if(_c[_b]){
63
return _c[_b];
64
}
65
return (_c[_b]=new dojox.dtl.DomTemplate(dijit._Templated.getCachedTemplate(_9,_a,true)));
66
}};
67
}