Blame view

WebRoot/plugins/websocketInstantMsg/ext4/ux/portal/PortalPanel.js 1.76 KB
ad5081d3   孙向锦   初始化项目
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
  /**
   * @class Ext.app.PortalPanel
   * @extends Ext.Panel
   * A {@link Ext.Panel Panel} class used for providing drag-drop-enabled portal layouts.
   */
  Ext.define('Ext.ux.portal.PortalPanel', {
      extend: 'Ext.panel.Panel',
      alias: 'widget.portalpanel',
      cls: 'x-portal',
      bodyCls: 'x-portal-body',
      defaultType: 'portalcolumn',
      componentLayout: 'body',
      autoScroll: true,
  
      initComponent : function() {
          var me = this;
  
          // Implement a Container beforeLayout call from the layout to this Container
          this.layout = {
              type : 'column'
          };
          this.callParent();
  
          this.addEvents({
              validatedrop: true,
              beforedragover: true,
              dragover: true,
              beforedrop: true,
              drop: true
          });
          this.on('drop', this.doLayout, this);
      },
  
      // Set columnWidth, and set first and last column classes to allow exact CSS targeting.
      beforeLayout: function() {
          var items = this.layout.getLayoutItems(),
              len = items.length,
              i = 0,
              item;
  
          for (; i < len; i++) {
              item = items[i];
              item.columnWidth = 1 / len;
              item.removeCls(['x-portal-column-first', 'x-portal-column-last']);
          }
          items[0].addCls('x-portal-column-first');
          items[len - 1].addCls('x-portal-column-last');
          return this.callParent(arguments);
      },
  
      // private
      initEvents : function(){
          this.callParent();
          this.dd = Ext.create('Ext.ux.portal.PortalDropZone', this, this.dropConfig);
      },
  
      // private
      beforeDestroy : function() {
          if (this.dd) {
              this.dd.unreg();
          }
          Ext.app.PortalPanel.superclass.beforeDestroy.call(this);
      }
  });