MPopupForm.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  1. MWF.xApplication.Template = MWF.xApplication.Template || {};
  2. MWF.xApplication.Template.MPopupForm = MPopupForm = new Class({
  3. Extends: MWF.widget.Common,
  4. Implements: [Options, Events],
  5. options: {
  6. "style": "default",
  7. "width": 500,
  8. "height": 450,
  9. "top": null,
  10. "left": null,
  11. "bottom" : null,
  12. "right" : null,
  13. "minWidth" : 300,
  14. "minHeight" : 220,
  15. "isLimitSize": true,
  16. "ifFade": true,
  17. "hasTop": false,
  18. "hasTopIcon" : false,
  19. "hasTopContent" : false,
  20. "hasIcon": true,
  21. "hasBottom": true,
  22. "hasMask" : true,
  23. "closeByClickMask" : false,
  24. "hasScroll" : true,
  25. "scrollType" : "",
  26. "title": "",
  27. "draggable": false,
  28. "resizeable" : false,
  29. "maxAction" : false,
  30. "closeAction": true,
  31. "relativeToApp" : true,
  32. "sizeRelateTo" : "app", //desktop
  33. "resultSeparator" : ","
  34. },
  35. initialize: function (explorer, data, options, para) {
  36. this.setOptions(options);
  37. this.explorer = explorer;
  38. if( para ){
  39. if( this.options.relativeToApp ){
  40. this.app = para.app || this.explorer.app;
  41. this.container = para.container || this.app.content;
  42. this.lp = para.lp || this.explorer.lp || this.app.lp;
  43. this.css = para.css || this.explorer.css || this.app.css;
  44. this.actions = para.actions || this.explorer.actions || this.app.actions || this.app.restActions;
  45. }else{
  46. this.container = para.container;
  47. this.lp = para.lp || this.explorer.lp;
  48. this.css = para.css || this.explorer.css;
  49. this.actions = para.actions || this.explorer.actions;
  50. }
  51. }else{
  52. if( this.options.relativeToApp ){
  53. this.app = this.explorer.app;
  54. this.container = this.app.content;
  55. this.lp = this.explorer.lp || this.app.lp;
  56. this.css = this.explorer.css || this.app.css;
  57. this.actions = this.explorer.actions || this.app.actions || this.app.restActions;
  58. }else{
  59. this.container = window.document.body;
  60. this.lp = this.explorer.lp;
  61. this.css = this.explorer.css;
  62. this.actions = this.explorer.actions;
  63. }
  64. }
  65. this.data = data || {};
  66. this.cssPath = "../x_component_Template/$MPopupForm/"+this.options.style+"/css.wcss";
  67. this.load();
  68. },
  69. load: function () {
  70. this._loadCss();
  71. },
  72. _loadCss: function(){
  73. var css = {};
  74. var r = new Request.JSON({
  75. url: this.cssPath,
  76. secure: false,
  77. async: false,
  78. method: "get",
  79. noCache: false,
  80. onSuccess: function(responseJSON, responseText){
  81. css = responseJSON;
  82. MWF.widget.css[key] = responseJSON;
  83. }.bind(this),
  84. onError: function(text, error){
  85. alert(error + text);
  86. }
  87. });
  88. r.send();
  89. var isEmptyObject = true;
  90. for( var key in css ){
  91. if(key){
  92. isEmptyObject = false;
  93. break;
  94. }
  95. }
  96. if( !isEmptyObject ){
  97. this.css = Object.merge( css, this.css );
  98. }
  99. },
  100. reload : function( keepData ){
  101. if( keepData ){
  102. this.data = this.form.getResult(false, this.options.resultSeparator, false, false, true);
  103. }
  104. this.formTopNode = null;
  105. if(this.setFormNodeSizeFun && this.app && this.app.removeEvent){
  106. this.app.removeEvent("resize",this.setFormNodeSizeFun);
  107. }
  108. if( this.formMaskNode )this.formMaskNode.destroy();
  109. if( this.formAreaNode )this.formAreaNode.destroy();
  110. if( this.isNew ){
  111. this.create();
  112. }else if( this.isEdited ){
  113. this.edit();
  114. }else{
  115. this.open();
  116. }
  117. },
  118. open: function (e) {
  119. this.fireEvent("queryOpen");
  120. this.isNew = false;
  121. this.isEdited = false;
  122. this._open();
  123. this.fireEvent("postOpen");
  124. },
  125. create: function () {
  126. this.fireEvent("queryCreate");
  127. this.isNew = true;
  128. this._open();
  129. this.fireEvent("postCreate");
  130. },
  131. edit: function () {
  132. this.fireEvent("queryEdit");
  133. this.isEdited = true;
  134. this._open();
  135. this.fireEvent("postEdit");
  136. },
  137. _open: function () {
  138. if( this.options.hasMask ){
  139. this.formMaskNode = new Element("div.formMaskNode", {
  140. "styles": this.css.formMaskNode,
  141. "events": {
  142. "mouseover": function (e) {
  143. e.stopPropagation();
  144. },
  145. "mouseout": function (e) {
  146. e.stopPropagation();
  147. },
  148. "click": function (e) {
  149. e.stopPropagation();
  150. },
  151. "mousewheel": function (e) {
  152. if (e.stopPropagation) e.stopPropagation();
  153. else e.cancelBubble = true;
  154. if (e.preventDefault) e.preventDefault();
  155. else e.returnValue = false;
  156. },
  157. "DOMMouseScroll": function (e) {
  158. if (e.stopPropagation) e.stopPropagation();
  159. else e.cancelBubble = true;
  160. if (e.preventDefault) e.preventDefault();
  161. else e.returnValue = false;
  162. }
  163. }
  164. }).inject( this.container || this.app.content);
  165. }
  166. this.formAreaNode = new Element("div.formAreaNode", {
  167. "styles": this.css.formAreaNode
  168. });
  169. this.createFormNode();
  170. if( this.formMaskNode ){
  171. this.formAreaNode.inject(this.formMaskNode , "after");
  172. }else{
  173. this.formAreaNode.inject( this.container || this.app.content );
  174. }
  175. if (this.options.ifFade){
  176. this.formAreaNode.fade("in");
  177. }else{
  178. this.formAreaNode.setStyle("opacity", 1);
  179. }
  180. this.setFormNodeSize();
  181. this.setFormNodeSizeFun = this.setFormNodeSize.bind(this);
  182. if( this.app && this.app.addEvent )this.app.addEvent("resize", this.setFormNodeSizeFun);
  183. if (this.options.draggable && this.formTopNode) {
  184. var size = (this.container || this.app.content).getSize();
  185. var nodeSize = this.formAreaNode.getSize();
  186. this.formAreaNode.makeDraggable({
  187. "handle": this.formTopNode,
  188. "limit": {
  189. "x": [0, size.x - nodeSize.x],
  190. "y": [0, size.y - nodeSize.y]
  191. },
  192. "onDrag": function(){
  193. this.fireEvent("drag");
  194. }.bind(this),
  195. "onComplete": function(){
  196. this.fireEvent("dragCompleted");
  197. }.bind(this)
  198. });
  199. }
  200. if( this.options.closeByClickMask && this.formMaskNode ){
  201. this.formMaskNode.addEvent("click", function(e){
  202. this.close(e)
  203. }.bind(this));
  204. }
  205. if (this.options.resizeable){
  206. this.resizeNode = new Element("div.resizeNode", {
  207. "styles": this.css.resizeNode
  208. }).inject(this.formNode);
  209. this.formAreaNode.makeResizable({
  210. "handle": this.resizeNode,
  211. "limit": {x:[ this.options.minWidth, null], y:[this.options.minHeight, null]},
  212. "onDrag": function(){
  213. var size = this.formAreaNode.getComputedSize();
  214. this.setNodesSize( size.width, size.height );
  215. this.fireEvent("resize");
  216. }.bind(this),
  217. "onComplete": function(){
  218. var size = this.formAreaNode.getComputedSize();
  219. this.options.width = size.width;
  220. this.options.height = size.height;
  221. if( this.oldCoordinate ){
  222. this.oldCoordinate.width = size.width;
  223. this.oldCoordinate.height = size.height;
  224. }
  225. this.fireEvent("resizeCompleted");
  226. }.bind(this)
  227. });
  228. }
  229. },
  230. createFormNode: function () {
  231. var _self = this;
  232. this.formNode = new Element("div.formNode", {
  233. "styles": this.css.formNode
  234. }).inject(this.formAreaNode);
  235. if (this.options.hasTop) {
  236. this.createTopNode();
  237. }
  238. if (this.options.hasIcon) {
  239. this.formIconNode = new Element("div.formIconNode", {
  240. "styles": this.isNew ? this.css.formNewNode : this.css.formIconNode
  241. }).inject(this.formNode);
  242. }
  243. this.createContent();
  244. //formContentNode.set("html", html);
  245. if (this.options.hasBottom) {
  246. this.createBottomNode();
  247. }
  248. this._setCustom();
  249. if( this.options.hasScroll ){
  250. //this.setScrollBar(this.formTableContainer)
  251. if( this.options.scrollType == "window" ){
  252. this.formContentNode.setStyle("overflow","auto");
  253. this.formTableContainer.setStyle("overflow","visible");
  254. }else{
  255. MWF.require("MWF.widget.ScrollBar", function () {
  256. new MWF.widget.ScrollBar(this.formTableContainer, {
  257. "indent": false,
  258. "style": "xApp_TaskList",
  259. "where": "before",
  260. "distance": 30,
  261. "friction": 4,
  262. "axis": {"x": false, "y": true},
  263. "onScroll": function (y) {
  264. //var scrollSize = _self.viewContainerNode.getScrollSize();
  265. //var clientSize = _self.viewContainerNode.getSize();
  266. //var scrollHeight = scrollSize.y - clientSize.y;
  267. //if (y + 200 > scrollHeight && _self.view && _self.view.loadElementList) {
  268. // if (!_self.view.isItemsLoaded) _self.view.loadElementList();
  269. //}
  270. }
  271. });
  272. }.bind(this));
  273. }
  274. }
  275. },
  276. _setCustom : function(){
  277. },
  278. createTopNode: function () {
  279. this.fireEvent("queryCreateTop");
  280. if (!this.formTopNode) {
  281. this.formTopNode = new Element("div.formTopNode", {
  282. "styles": this.css.formTopNode
  283. }).inject(this.formNode);
  284. if(this.options.hasTopIcon){
  285. this.formTopIconNode = new Element("div", {
  286. "styles": this.css.formTopIconNode
  287. }).inject(this.formTopNode)
  288. }
  289. this.formTopTextNode = new Element("div", {
  290. "styles": this.css.formTopTextNode,
  291. "text": this.options.title
  292. }).inject(this.formTopNode);
  293. if (this.options.closeAction) {
  294. this.formTopCloseActionNode = new Element("div", {
  295. "styles": this.css.formTopCloseActionNode,
  296. "title" : "关闭"
  297. }).inject(this.formTopNode);
  298. this.formTopCloseActionNode.addEvent("click", function ( ev ) {
  299. this.close();
  300. ev.stopPropagation();
  301. }.bind(this))
  302. }
  303. if( this.options.maxAction ){
  304. this.formTopMaxActionNode = new Element("div", {
  305. "styles": this.css.formTopMaxActionNode,
  306. "title" : "最大化"
  307. }).inject(this.formTopNode);
  308. this.formTopMaxActionNode.addEvent("click", function () {
  309. this.maxSize()
  310. }.bind(this));
  311. this.formTopRestoreActionNode = new Element("div", {
  312. "styles": this.css.formTopRestoreActionNode,
  313. "title" : "还原"
  314. }).inject(this.formTopNode);
  315. this.formTopRestoreActionNode.addEvent("click", function () {
  316. this.restoreSize()
  317. }.bind(this));
  318. this.formTopNode.addEvent("dblclick", function(){
  319. this.switchMax();
  320. }.bind(this));
  321. }
  322. if(this.options.hasTopContent){
  323. this.formTopContentNode = new Element("div.formTopContentNode", {
  324. "styles": this.css.formTopContentNode
  325. }).inject(this.formTopNode);
  326. this._createTopContent();
  327. }
  328. }
  329. this.fireEvent("postCreateTop");
  330. //if (!this.formTopNode) {
  331. // this.formTopNode = new Element("div.formTopNode", {
  332. // "styles": this.css.formTopNode,
  333. // "text": this.options.title
  334. // }).inject(this.formNode);
  335. //
  336. // this._createTopContent();
  337. //
  338. // if (this.options.closeAction) {
  339. // this.formTopCloseActionNode = new Element("div.formTopCloseActionNode", {"styles": this.css.formTopCloseActionNode}).inject(this.formTopNode);
  340. // this.formTopCloseActionNode.addEvent("click", function () {
  341. // this.close()
  342. // }.bind(this))
  343. // }
  344. //}
  345. },
  346. _createTopContent: function () {
  347. },
  348. createContent: function () {
  349. this.formContentNode = new Element("div.formContentNode", {
  350. "styles": this.css.formContentNode
  351. }).inject(this.formNode);
  352. this.formTableContainer = new Element("div.formTableContainer", {
  353. "styles": this.css.formTableContainer
  354. }).inject(this.formContentNode);
  355. this.formTableArea = new Element("div.formTableArea", {
  356. "styles": this.css.formTableArea
  357. }).inject(this.formTableContainer);
  358. this._createTableContent();
  359. },
  360. _createTableContent: function () {
  361. var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>" +
  362. //"<tr><td colspan='2' styles='formTableHead'>申诉处理单</td></tr>" +
  363. "<tr><td styles='formTableTitle' lable='empName'></td>" +
  364. " <td styles='formTableValue' item='empName'></td></tr>" +
  365. "<tr><td styles='formTableTitle' lable='departmentName'></td>" +
  366. " <td styles='formTableValue' item='departmentName'></td></tr>" +
  367. "<tr><td styles='formTableTitle' lable='recordDateString'></td>" +
  368. " <td styles='formTableValue' item='recordDateString'></td></tr>" +
  369. "<tr><td styles='formTableTitle' lable='status'></td>" +
  370. " <td styles='formTableValue' item='status'></td></tr>" +
  371. "<tr><td styles='formTableTitle' lable='appealReason'></td>" +
  372. " <td styles='formTableValue' item='appealReason'></td></tr>" +
  373. "<tr><td styles='formTableTitle' lable='appealDescription'></td>" +
  374. " <td styles='formTableValue' item='appealDescription'></td></tr>" +
  375. "<tr><td styles='formTableTitle' lable='opinion1'></td>" +
  376. " <td styles='formTableValue' item='opinion1'></td></tr>" +
  377. "</table>";
  378. this.formTableArea.set("html", html);
  379. MWF.xDesktop.requireApp("Template", "MForm", function () {
  380. this.form = new MForm(this.formTableArea, {empName: "xadmin"}, {
  381. isEdited: this.isEdited || this.isNew,
  382. itemTemplate: {
  383. empName: {text: "姓名", type: "innertext"},
  384. departmentName: {text: "部门", tType: "department", notEmpty: true},
  385. recordDateString: {text: "日期", tType: "date"},
  386. status: {text: "状态", tType: "number"},
  387. appealReason: {
  388. text: "下拉框",
  389. type: "select",
  390. selectValue: ["测试1", "测试2"]
  391. },
  392. appealDescription: {text: "描述", type: "textarea"},
  393. opinion1: {text: "测试", type: "button", "value": "测试"}
  394. }
  395. }, this.app);
  396. this.form.load();
  397. }.bind(this), true);
  398. },
  399. createBottomNode: function () {
  400. this.fireEvent("queryCreateBottom");
  401. this.formBottomNode = new Element("div.formBottomNode", {
  402. "styles": this.css.formBottomNode
  403. }).inject(this.formNode);
  404. this._createBottomContent();
  405. this.fireEvent("postCreateBottom");
  406. },
  407. _createBottomContent: function () {
  408. this.cancelActionNode = new Element("div.formCancelActionNode", {
  409. "styles": this.css.formCancelActionNode,
  410. "text": this.lp.cancel
  411. }).inject(this.formBottomNode);
  412. this.cancelActionNode.addEvent("click", function (e) {
  413. this.cancel(e);
  414. }.bind(this));
  415. if (this.isNew || this.isEdited) {
  416. this.okActionNode = new Element("div.formOkActionNode", {
  417. "styles": this.css.formOkActionNode,
  418. "text": this.lp.ok
  419. }).inject(this.formBottomNode);
  420. this.okActionNode.addEvent("click", function (e) {
  421. this.ok(e);
  422. }.bind(this));
  423. }
  424. },
  425. cancel: function (e) {
  426. this.fireEvent("queryCancel");
  427. this.close();
  428. this.fireEvent("postCancel");
  429. },
  430. close: function (e) {
  431. this.fireEvent("queryClose");
  432. this._close();
  433. //if( this.form ){
  434. // this.form.destroy();
  435. //}
  436. if(this.setFormNodeSizeFun && this.app && this.app.removeEvent ){
  437. this.app.removeEvent("resize",this.setFormNodeSizeFun);
  438. }
  439. if( this.formMaskNode )this.formMaskNode.destroy();
  440. if( this.formAreaNode )this.formAreaNode.destroy();
  441. this.fireEvent("postClose");
  442. delete this;
  443. },
  444. _close: function(){
  445. },
  446. ok: function (e) {
  447. this.fireEvent("queryOk");
  448. var data = this.form.getResult(true, this.options.resultSeparator, true, false, true);
  449. if (data) {
  450. this._ok(data, function (json) {
  451. if (json.type == "error") {
  452. if( this.app && this.app.notice )this.app.notice(json.message, "error");
  453. } else {
  454. if( this.formMaskNode )this.formMaskNode.destroy();
  455. if( this.formAreaNode )this.formAreaNode.destroy();
  456. if (this.explorer && this.explorer.view)this.explorer.view.reload();
  457. if( this.app && this.app.notice)this.app.notice(this.isNew ? this.lp.createSuccess : this.lp.updateSuccess, "success");
  458. this.fireEvent("postOk");
  459. }
  460. }.bind(this))
  461. }
  462. },
  463. _ok: function (data, callback) {
  464. //this.app.restActions.saveDocument( this.data.id, data, function(json){
  465. // if( callback )callback(json);
  466. //}.bind(this), function( errorObj ){
  467. // var error = JSON.parse( errorObj.responseText );
  468. // this.app.notice( error.message, error );
  469. //}.bind(this));
  470. },
  471. switchMax : function(){
  472. if( !this.isMax ){
  473. this.maxSize();
  474. }else{
  475. this.restoreSize();
  476. }
  477. },
  478. maxSize: function(){
  479. if(!this.oldCoordinate)this.oldCoordinate = {
  480. width : this.options.width,
  481. height : this.options.height,
  482. top : this.options.top,
  483. left : this.options.left,
  484. bottom : this.options.bottom,
  485. right : this.options.right
  486. };
  487. this.options.width = "100%";
  488. this.options.height = "100%";
  489. this.options.top = null;
  490. this.options.left = null;
  491. this.options.bottom = null;
  492. this.options.right = null;
  493. this.setFormNodeSize();
  494. this.formTopMaxActionNode.setStyle("display","none");
  495. this.formTopRestoreActionNode.setStyle("display","");
  496. this.isMax = true;
  497. this.fireEvent("max");
  498. },
  499. restoreSize : function(){
  500. if( this.oldCoordinate){
  501. this.options.width = this.oldCoordinate.width;
  502. this.options.height = this.oldCoordinate.height;
  503. this.options.top = this.oldCoordinate.top;
  504. this.options.left = this.oldCoordinate.left;
  505. this.options.bottom = this.oldCoordinate.bottom;
  506. this.options.right = this.oldCoordinate.right;
  507. }
  508. this.setFormNodeSize();
  509. this.formTopMaxActionNode.setStyle("display","");
  510. this.formTopRestoreActionNode.setStyle("display","none");
  511. this.isMax = false;
  512. this.fireEvent("restore");
  513. },
  514. setFormNodeSize: function (width, height, top, left, bottom, right) {
  515. this._beforeFormNodeSize();
  516. if (!width)width = this.options.width ? this.options.width : "50%";
  517. if (!height)height = this.options.height ? this.options.height : "50%";
  518. if (!top && top != 0 ) top = this.options.top; // ? this.options.top : 0;
  519. if (!left && left != 0) left = this.options.left; // ? this.options.left : 0;
  520. if (!bottom && bottom != 0) bottom = this.options.bottom; // ? this.options.bottom : 0;
  521. if (!right && right != 0) right = this.options.right; // ? this.options.right : 0;
  522. width = width.toString();
  523. height = height.toString();
  524. var allSize = ( this.container || this.app.content).getSize();
  525. var limitWidth = allSize.x; //window.screen.width
  526. var limitHeight = allSize.y; //window.screen.height
  527. if (this.options.isLimitSize){
  528. if( "%" != width.substr(width.length - 1, 1) ){
  529. if( allSize.x < parseInt(width) )width = allSize.x;
  530. }
  531. if( "%" != height.substr(height.length - 1, 1) ){
  532. if( allSize.y < parseInt(height) )height = allSize.y;
  533. }
  534. }
  535. //if( width != "auto" ){
  536. "string" == typeof width && (1 < width.length && "%" == width.substr(width.length - 1, 1)) && (width = parseInt(limitWidth * parseInt(width, 10) / 100, 10));
  537. this.options.minWidth > width && (width = this.options.minWidth);
  538. //}
  539. //if( height != "auto" ){
  540. "string" == typeof height && (1 < height.length && "%" == height.substr(height.length - 1, 1)) && (height = parseInt(limitHeight * parseInt(height, 10) / 100, 10));
  541. this.options.minHeight > height && (height = this.options.minHeight);
  542. //}
  543. var styles = {
  544. "width": "" + width + "px",
  545. "height": "" + height + "px"
  546. };
  547. if( top != null ){
  548. styles.top = "" + top + "px";
  549. styles.bottom = "auto";
  550. }else if( bottom != null ){
  551. styles.top = "auto";
  552. styles.bottom = "" + bottom + "px";
  553. }else{
  554. styles.top = "" + parseInt((limitHeight - height) / 2, 10) + "px";
  555. styles.bottom = "auto";
  556. }
  557. if( left != null ){
  558. styles.left = "" + left + "px";
  559. styles.right = "auto";
  560. }else if( right != null ){
  561. styles.left = "auto";
  562. styles.right = "" + right + "px";
  563. }else{
  564. styles.left = "" + parseInt((limitWidth - width) / 2, 10) + "px";
  565. styles.right = "auto";
  566. }
  567. if( this.formAreaNode )this.formAreaNode.setStyles(styles);
  568. this._setFormNodeSize(styles);
  569. this.setNodesSize( width, height );
  570. },
  571. _beforeFormNodeSize : function(){
  572. },
  573. _setFormNodeSize: function( styles ){
  574. },
  575. setNodesSize: function(width, height){
  576. //if( height == "auto" )return;
  577. this.options.minWidth > width && (width = this.options.minWidth);
  578. this.options.minHeight > height && (height = this.options.minHeight);
  579. this.formNode.setStyles({
  580. "width": "" + width + "px",
  581. "height": "" + height + "px"
  582. });
  583. var iconSize = this.formIconNode ? this.formIconNode.getSize() : {x: 0, y: 0};
  584. var topSize = this.formTopNode ? this.formTopNode.getSize() : {x: 0, y: 0};
  585. var bottomSize = this.formBottomNode ? this.formBottomNode.getSize() : {x: 0, y: 0};
  586. var contentHeight = height - iconSize.y - topSize.y - bottomSize.y;
  587. var marginTop = parseFloat(this.formContentNode.getStyle( "margin-top" )) || 0;
  588. var marginBottom = parseFloat(this.formContentNode.getStyle( "margin-bottom" )) || 0;
  589. var formContentHeight = contentHeight - marginTop - marginBottom;
  590. this.formContentNode.setStyles({
  591. "height": "" + formContentHeight + "px"
  592. });
  593. var paddingTop = parseFloat( this.formContentNode.getStyle( "padding-top" )) || 0;
  594. var paddingBottom = parseFloat( this.formContentNode.getStyle( "padding-bottom" )) || 0;
  595. marginTop = parseFloat( this.formTableContainer.getStyle( "margin-top" )) || 0;
  596. marginBottom = parseFloat( this.formTableContainer.getStyle( "margin-bottom" )) || 0;
  597. var tablePaddingTop = parseFloat( this.formTableContainer.getStyle( "padding-top" )) || 0;
  598. var tablePaddingTBottom = parseFloat( this.formTableContainer.getStyle( "padding-bottom" )) || 0;
  599. var formTableHeight = contentHeight - marginTop - marginBottom - paddingTop - paddingBottom - tablePaddingTop - tablePaddingTBottom;
  600. if( this.options.scrollType == "window" ){
  601. formTableHeight = formTableHeight - 10;
  602. }
  603. this.formTableContainer.setStyles({
  604. "height": "" + formTableHeight + "px"
  605. });
  606. this._setNodesSize( width, height, formContentHeight, formTableHeight );
  607. this.fireEvent("resizeForm");
  608. },
  609. _setNodesSize : function(width, height, formContentHeight, formTableHeight ){
  610. }
  611. });