bogus-win-override.js
上传用户:snow1005
上传日期:2015-11-10
资源大小:3151k
文件大小:4k
源码类别:

Ajax

开发平台:

JavaScript

  1. Ext.override(QoDesk.BogusWindow, {
  2. detailModule : null,
  3. init : function(){
  4. this.detailModule = new BogusDetailModule();
  5. },
  6. createWindow : function(){
  7. var desktop = this.app.getDesktop();
  8. var win = desktop.getWindow('bogus-win');
  9. if(!win){
  10.             win = desktop.createWindow({
  11.                 autoScroll: true,
  12.                 id: 'bogus-win',
  13.                 title: 'Bogus Window',
  14.                 width:640,
  15.                 height:480,
  16.                 iconCls: 'bogus-icon',
  17.                 items: new QoDesk.BogusWindow.NavPanel({owner: this, id: 'nav-panel'}),
  18.                 shim:false,
  19.                 animCollapse:false,
  20.                 constrainHeader:true,
  21.                 maximizable: false,
  22.                 tbar: [{
  23.                  handler: this.showDialog,
  24.                  scope: this,
  25.                  text: 'Open Dialog'
  26.                 }],
  27.                 taskbuttonTooltip: '<b>Bogus Window</b><br />A bogus window'
  28.             });
  29.         }
  30.         
  31.         win.show();
  32.     },
  33.     
  34.     openDetail : function(id){
  35. this.detailModule.createWindow(this.app, id);
  36.     },
  37.     
  38.     showDialog : function(){
  39.      var winManager = this.app.getDesktop().getManager();
  40.     
  41.      if(!this.dialog){
  42.             this.dialog = new Ext.Window({
  43.              bodyStyle:'padding:10px',
  44.                 layout:'fit',
  45.                 width:500,
  46.                 height:300,
  47.                 closeAction:'hide',
  48.                 plain: true,
  49.                 html: 'Bogus dialog window',
  50.                 buttons: [{
  51.                     text:'Submit',
  52.                     disabled:true
  53.                 },{
  54.                     text: 'Close',
  55.                     handler: function(){
  56.                         this.dialog.hide();
  57.                     },
  58.                     scope: this
  59.                 }],
  60.                 manager: winManager,
  61.                 modal: true
  62.             });
  63.         }
  64.         this.dialog.show();
  65.     }
  66. });
  67. QoDesk.BogusWindow.NavPanel = function(config){
  68. this.owner = config.owner;
  69. QoDesk.BogusWindow.NavPanel.superclass.constructor.call(this, {
  70. autoScroll: true,
  71. bodyStyle: 'padding:15px',
  72. border: false,
  73. html: '<ul id="bogus-nav-panel"> 
  74. <li> 
  75. <a id="openDetailOne" href="#">Detail 1</a><br /> 
  76. <span>Open detail window one.</span> 
  77. </li> 
  78. <li> 
  79. <a id="openDetailTwo" href="#">Detail 2</a><br /> 
  80. <span>Open detail window two.</span> 
  81. </li> 
  82. <li> 
  83. <a id="openDetailThree" href="#">Detail 3</a><br /> 
  84. <span>Open detail window three.</span> 
  85. </li> 
  86. </ul>',
  87. id: config.id
  88. });
  89. this.actions = {
  90. 'openDetailOne' : function(owner){
  91. owner.openDetail(1);
  92. },
  93. 'openDetailTwo' : function(owner){
  94. owner.openDetail(2);
  95. },
  96. 'openDetailThree' : function(owner){
  97.     owner.openDetail(3);
  98.     }
  99. };
  100. };
  101. Ext.extend(QoDesk.BogusWindow.NavPanel, Ext.Panel, {
  102. afterRender : function(){
  103. this.body.on({
  104. 'mousedown': {
  105. fn: this.doAction,
  106. scope: this,
  107. delegate: 'a'
  108. },
  109. 'click': {
  110. fn: Ext.emptyFn,
  111. scope: null,
  112. delegate: 'a',
  113. preventDefault: true
  114. }
  115. });
  116. QoDesk.BogusWindow.NavPanel.superclass.afterRender.call(this); // do sizing calcs last
  117. },
  118. doAction : function(e, t){
  119.      e.stopEvent();
  120.      this.actions[t.id](this.owner);  // pass owner for scope
  121.     }
  122. });
  123. BogusDetailModule = Ext.extend(Ext.app.Module, {
  124. moduleType : 'demo',
  125. moduleId : 'demo-bogus-detail',
  126. init : function(){
  127. this.launcher = {
  128. handler: this.createWindow,
  129. iconCls: 'bogus-icon',
  130. scope: this,
  131. shortcutIconCls: 'demo-bogus-shortcut',
  132. text: 'Bogus Detail Window',
  133. tooltip: '<b>Bogus Detail Window</b><br />A bogus detail window'
  134. }
  135. },
  136. createWindow : function(app, id){
  137. this.moduleId = 'demo-bogus-detail-'+id;
  138. var desktop = app.getDesktop();
  139. var win = desktop.getWindow('bogus-detail'+id);
  140.         if(!win){
  141.             win = desktop.createWindow({
  142.                 id: 'bogus-detail'+id,
  143.                 title: 'Detail Window '+id,
  144.                 width: 540,
  145.                 height: 380,
  146.                 html : '<p>Something useful would be in here.</p>',
  147.                 iconCls: 'bogus-icon',
  148.                 shim:false,
  149.                 animCollapse:false,
  150.                 constrainHeader:true
  151.             });
  152.         }
  153.         win.show();
  154.     }
  155. });