MPopupForm.js 26 KB

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