nnnjjj123
2020-11-17 1b2c1edb61190eeb19f465ff031eaa3b2a1b8dbc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
define(['dojo/_base/declare',
  'dojo/_base/lang',
  'dojo/_base/html',
  'dijit/_WidgetBase'],
  function (declare, lang, html, _WidgetBase) {
  return declare([_WidgetBase], {
    widget: null,
    baseClass: 'jimu-widget-frame jimu-container',
 
    postCreate: function(){
      this.inherited(arguments);
      if(!this.containerNode){
        this.containerNode = this.domNode;
      }
      if(this.widget){
        this.setWidget(this.widget);
      }
    },
 
    startup: function(){
      this.inherited(arguments);
      if(this.widget){
        this.widget.startup();
      }
    },
 
    resize: function(){
      if(this.widget && this.widget.state !== 'closed' &&
        lang.isFunction(this.widget.resize)){
        this.widget.resize();
      }
    },
 
    setLoading: function(_loading){
      this.loading = _loading;
      this.loading.placeAt(this.containerNode);
    },
 
    getWidget: function(){
      return this.widget;
    },
 
    setWidget: function(w){
      this.widget = w;
      if(this.loading){
        this.loading.destroy();
      }
      html.place(w.domNode, this.containerNode);
      this.resize();
    },
 
    destroy: function(){
      if(this.widget && this.widget.domNode){
        try{
          this.widget.destroy();
        }catch(error){
          console.error('destroy widget error. widget: [' + this.widget.uri + '], ' + error.stack);
        }
      }
      if(this.loading && this.loading.domNode){
        this.loading.destroy();
      }
    }
 
  });
});