| 2150 |
mathias |
1 |
if(!dojo._hasResource["dojox.dtl.widget"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
|
|
2 |
dojo._hasResource["dojox.dtl.widget"] = true;
|
|
|
3 |
dojo.provide("dojox.dtl.widget");
|
|
|
4 |
|
|
|
5 |
dojo.require("dijit._Widget");
|
|
|
6 |
dojo.require("dijit._Container")
|
|
|
7 |
dojo.require("dojox.dtl.html");
|
|
|
8 |
dojo.require("dojox.dtl.render.html");
|
|
|
9 |
|
|
|
10 |
dojo.declare("dojox.dtl._Widget", [dijit._Widget, dijit._Contained],
|
|
|
11 |
{
|
|
|
12 |
buffer: 0,
|
|
|
13 |
buildRendering: function(){
|
|
|
14 |
this.domNode = this.srcNodeRef;
|
|
|
15 |
|
|
|
16 |
if(this.domNode){
|
|
|
17 |
var parent = this.getParent();
|
|
|
18 |
if(parent){
|
|
|
19 |
this.setAttachPoint(parent);
|
|
|
20 |
}
|
|
|
21 |
}
|
|
|
22 |
},
|
|
|
23 |
setAttachPoint: function(/*dojox.dtl.AttachPoint*/ attach){
|
|
|
24 |
this._attach = attach;
|
|
|
25 |
},
|
|
|
26 |
render: function(/*dojox.dtl.HtmlTemplate*/ tpl, /*dojox.dtl.Context*/ context){
|
|
|
27 |
if(!this._attach){
|
|
|
28 |
throw new Error("You must use an attach point with dojox.dtl.TemplatedWidget");
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
context.setThis(this);
|
|
|
32 |
this._attach.render(tpl, context);
|
|
|
33 |
}
|
|
|
34 |
}
|
|
|
35 |
);
|
|
|
36 |
|
|
|
37 |
dojo.declare("dojox.dtl.AttachPoint", [dijit._Widget, dijit._Container],
|
|
|
38 |
{
|
|
|
39 |
constructor: function(props, node){
|
|
|
40 |
this._render = new dojox.dtl.render.html.Render(node);
|
|
|
41 |
},
|
|
|
42 |
render: function(/*dojox.dtl.HtmlTemplate*/ tpl, /*dojox.dtl.Context*/ context){
|
|
|
43 |
this._render.render(tpl, context);
|
|
|
44 |
}
|
|
|
45 |
}
|
|
|
46 |
);
|
|
|
47 |
|
|
|
48 |
}
|