1//============================================================================== 2// 3// TOBESOFT Co., Ltd. 4// Copyright 2014 TOBESOFT Co., Ltd. 5// All Rights Reserved. 6// 7// NOTICE: TOBESOFT permits you to use, modify, and distribute this file 8// in accordance with the terms of the license agreement accompanying it. 9// 10// Readme URL: http://www.nexacro.co.kr/legal/nexacro-public-license-readme-1.1.html 11// 12//============================================================================== 13 14if (!nexacro.Form) { 15 nexacro.LayoutChangeEventInfo = function (obj, id, curlayout_name, newlayout_name, cur_width, new_width, cur_height, new_height) { 16 this.id = this.eventid = id || "onlayoutchanged"; 17 this.fromobject = this.fromreferenceobject = obj; 18 19 this.bubbles = true; 20 21 this.oldlayout = curlayout_name; 22 this.newlayout = newlayout_name; 23 this.oldlayoutwidth = cur_width; 24 this.newlayoutwidth = new_width; 25 this.oldlayoutheight = cur_height; 26 this.newlayoutheight = new_height; 27 }; 28 29 var _pLayoutChangeEventInfo = nexacro._createPrototype(nexacro.Event, nexacro.LayoutChangeEventInfo); 30 nexacro.LayoutChangeEventInfo.prototype = _pLayoutChangeEventInfo; 31 32 _pLayoutChangeEventInfo._type_name = "LayoutChangeEventInfo"; 33 34 delete _pLayoutChangeEventInfo; 35 36 37 nexacro.DeviceButtonEventInfo = function (obj, e) { 38 this.eventid = "ondevicebutton"; 39 this.fromobject = obj; 40 this.fromreferenceobject = obj; 41 this.button = e.button; 42 }; 43 var _pDeviceButtonEventInfo = nexacro._createPrototype(nexacro.Event, nexacro.DeviceButtonEventInfo); 44 nexacro.DeviceButtonEventInfo.prototype = _pDeviceButtonEventInfo; 45 46 _pDeviceButtonEventInfo._type_name = "DeviceButtonEventInfo"; 47 48 delete _pDeviceButtonEventInfo; 49 50 nexacro.BindItem = function (name, compid, propid, dsid, columnid) { 51 nexacro.Object.call(this); 52 this.name = name || ""; 53 this.compid = compid || ""; 54 this.propid = propid || ""; 55 this.datasetid = dsid || ""; 56 this.columnid = columnid || ""; 57 58 59 this._en_type = 1; 60 this._dataset = null; 61 this._comp = null; 62 }; 63 64 var _pBindItem = nexacro.BindItem.prototype = nexacro._createPrototype(nexacro.Object, nexacro.BindItem); 65 _pBindItem._type_name = "BindItem"; 66 67 _pBindItem.set_name = function (v) { 68 if (v && this.name != v) { 69 this.name = v; 70 } 71 }; 72 73 _pBindItem.set_compid = function (v) { 74 if (v && this.compid != v) { 75 this.compid = v; 76 } 77 }; 78 79 _pBindItem.set_propid = function (v) { 80 if (v && this.propid != v) { 81 this.propid = v; 82 } 83 }; 84 85 _pBindItem.set_datasetid = function (v) { 86 if (v && this.datasetid != v) { 87 this.datasetid = v; 88 } 89 }; 90 91 _pBindItem.set_columnid = function (v) { 92 if (v && this.columnid != v) { 93 this.columnid = v; 94 } 95 }; 96 97 _pBindItem.init = function (name, compid, propid, datasetid, columnid) { 98 this.set_name(name); 99 this.set_compid(compid); 100 this.set_propid(propid); 101 this.set_datasetid(datasetid); 102 this.set_columnid(columnid); 103 }; 104 105 _pBindItem.destroy = function () { 106 this._dataset = null; 107 this._comp = null; 108 109 nexacro.Object.prototype.destroy.call(this); 110 }; 111 112 _pBindItem.bind = function () { 113 if (this.parent && !this.parent._is_loading) { 114 if (this.compid == "" || this.propid == "" || this.datasetid == "" || this.columnid == "") { 115 return; 116 } 117 this.parent._bind_manager._setBinditem(this, false); 118 this.parent._bind_manager._notify(this); 119 } 120 }; 121 122 _pBindItem._checkType = function (propid) { 123 if (typeof propid == "string" && propid == this.propid) { 124 this._en_type = 2; 125 } 126 }; 127 delete _pBindItem; 128 129 nexacro.BindManager = function (form) { 130 nexacro.Object.call(this); 131 this.datasets = { 132 }; 133 this.exception = ""; 134 135 136 this._form = form; 137 }; 138 139 var _pBindManager = nexacro.BindManager.prototype = nexacro._createPrototype(nexacro.Object, nexacro.BindManager); 140 141 _pBindManager._type_name = "BindManager"; 142 143 144 _pBindManager.destroy = function () { 145 this.datasets = null; 146 this._form = null; 147 148 nexacro.Object.prototype.destroy.call(this); 149 }; 150 151 _pBindManager.on_changevalue = function (obj, e) { 152 var prop_id = e.propid; 153 var bind_item = this._FindBindItem(obj, prop_id); 154 var val = e.val; 155 if (bind_item && bind_item._en_type == 2) { 156 this.exception = obj;
157 158 var ds = bind_item._dataset; 159 var row_idx = ds.rowposition; 160 var col = ds._getDataColIndex(bind_item.columnid); 161 if (col !== undefined) { 162 var ret = ds.setColumn(row_idx, col, val); 163 if (ret == true) { 164 var real_value = ds.getColumn(row_idx, col); 165 if (real_value != val) { 166 val = real_value; 167 } 168 this.exception = null; 169 return true; 170 } 171 else { 172 this.exception = null; 173 return false; 174 } 175 } 176 } 177 this.exception = null; 178 return true; 179 }; 180 181 _pBindManager.on_valuechanged = function (obj, e) { 182 var ds = obj; 183 var row = e.row; 184 var col = e.col; 185 var col_id = e.columnid; 186 var val = e.newvalue; 187 if (ds.rowposition == row || row < 0) { 188 if (col < 0) { 189 return this._notifyAll(ds.name, null, -1, true, null); 190 } 191 else { 192 return this._notifyAll(ds.name, col_id, col, false, val); 193 } 194 } 195 return true; 196 }; 197 198 _pBindManager.on_load = function (obj, e) { 199 var ds = obj; 200 if (ds.rowcount == 0 && e.reason == 0) { 201 return this._notifyAll(ds.name, null, -1, true, null); 202 } 203 return true; 204 }; 205 206 207 _pBindManager._delayBinds = function () { 208 var len = this._form.binds.length; 209 for (var sx = 0; sx < len; sx++) { 210 var bind_item = this._form.binds[sx]; 211 if (bind_item._dataset) { 212 continue; 213 } 214 215 this._setBinditem(bind_item, false); 216 this._notify(bind_item); 217 } 218 }; 219 220 _pBindManager._forceBinds = function () { 221 var len = this._form.binds.length; 222 for (var sx = 0; sx < len; sx++) { 223 var bind_item = this._form.binds[sx]; 224 this._setBinditem(bind_item, false); 225 this._notify(bind_item); 226 } 227 }; 228 229 _pBindManager._setBinditem = function (bind_item, close_flag) { 230 if (!bind_item) { 231 return; 232 } 233 234 var binds = this._form.binds; 235 var ds_id = bind_item.datasetid; 236 237 var ds = bind_item._dataset; 238 var comp = bind_item._comp; 239 if (!bind_item._dataset) { 240 ds = this._form._getDatasetObject(bind_item.datasetid); 241 } 242 if (!bind_item._comp) { 243 comp = this._form._findChildObject(bind_item.compid); 244 } 245 246 if (!ds || !comp) { 247 return; 248 } 249 250 if (!close_flag) { 251 bind_item._dataset = ds; 252 bind_item._comp = comp; 253 bind_item._checkType(comp.on_getBindableProperties()); 254 255 if (this.datasets[ds_id]) { 256 var cidx = nexacro._indexOf(this.datasets[ds_id], bind_item); 257 if (cidx > -1) { 258 this.datasets[ds_id].splice(cidx, 1); 259 260 if (comp._bind_event) { 261 comp._bind_event._removeHandler(this, this.on_changevalue); 262 delete comp._bind_event; 263 comp._bind_event = null; 264 } 265 } 266 this.datasets[ds_id].push(bind_item); 267 } 268 else { 269 this.datasets[ds_id] = []; 270 this.datasets[ds_id].push(bind_item); 271 ds.setEventHandler("onload", this.on_load, this); 272 ds.setEventHandler("onvaluechanged", this.on_valuechanged, this); 273 } 274 275 if (!comp._bind_event) { 276 comp._bind_event = new nexacro.EventListener("onbinditem"); 277 comp._bind_event._setHandler(this, this.on_changevalue); 278 } 279 } 280 else { 281 if (this.datasets[ds_id]) { 282 var cidx = nexacro._indexOf(this.datasets[ds_id], bind_item); 283 if (cidx > -1) { 284 this.datasets[ds_id].splice(cidx, 1); 285 if (this.datasets[ds_id].length == 0) { 286 ds.removeEventHandler("onload", this.on_load, this); 287 ds.removeEventHandler("onvaluechanged", this.on_valuechanged, this); 288 delete this.datasets[ds_id]; 289 } 290 } 291 } 292 if (comp._bind_event) { 293 comp._bind_event._removeHandler(this, this.on_changevalue); 294 delete comp._bind_event; 295 } 296 } 297 }; 298 299 _pBindManager._FindBindItem = function (comp, propid) { 300 var binds = this._form.binds; 301 for (var sx = 0, n = binds.length; sx < n; sx++) { 302 var bind_item = binds[sx]; 303 if (bind_item._comp == comp && bind_item.propid == propid && bind_item.datasetid && bind_item.columnid) { 304 return bind_item; 305 } 306 } 307 return null; 308 }; 309 310 _pBindManager._dettachSBindItem = function (comp) { 311 if (!comp._bind_event) { 312 return; 313 } 314 315 comp._bind_event._removeHandler(this); 316 var binds = this._form.binds; 317 var cnt = binds.length; 318 for (var i = 0; i < cnt; i++) { 319 if (binds[i]._comp == comp) { 320 var datasetid = binds[i].datasetid; 321 if (this.datasets[datasetid]) { 322 var cidx = nexacro._indexOf(this.datasets[datasetid], binds[i]); 323 if (cidx > -1) { 324 var parent = this.datasets[datasetid][cidx].parent; 325 this.datasets[datasetid][cidx].destroy(); 326 this.datasets[datasetid].splice(cidx, 1); 327 binds[i].parent = parent; 328 } 329 binds[i]._comp = null; 330 } 331 } 332 } 333 }; 334 335 336 _pBindManager._notify = function (bindItem) { 337 var ds = bindItem._dataset; 338 var comp = bindItem._comp; 339 340 if (ds && comp) { 341 var row_idx = ds.rowposition; 342 343 if (bindItem._en_type == 2) { 344 if (comp.enable) { 345 if (row_idx < 0) { 346 comp._setEnable(false); 347 } 348 else { 349 if (comp._real_enable) { 350 comp._setEnable(true); 351 } 352 } 353 } 354 var col = ds._getDataColIndex(bindItem.columnid); 355 if (col >= 0 && comp.on_change_bindSource) { 356 comp.on_change_bindSource(bindItem.propid, bindItem._dataset, row_idx, col, -1); 357 } 358 } 359 else { 360 if (bindItem.columnid && bindItem.columnid != "") { 361 var col = ds._getDataColIndex(bindItem.columnid); 362 363 if (col == undefined) { 364 col = -1; 365 } 366 367 var val = ds.getColumn(row_idx, col); 368 if (bindItem.propid) { 369 if (comp["set_" + bindItem.propid]) { 370 comp["set_" + bindItem.propid](val); 371 } 372 else if (comp.style && comp.style["set_" + bindItem.propid]) { 373 comp.style["set_" + bindItem.propid](val); 374 } 375 } 376 } 377 } 378 } 379 }; 380 381 _pBindManager._notifyAll = function (ds_id, col_id, col, all_flag, val) { 382 var arr_bind = this.datasets[ds_id]; 383 var bind_item = null; 384 var row_idx = -1; 385 386 if (!arr_bind) { 387 return true; 388 } 389 390 for (var sx = 0, n = arr_bind.length; sx < n; sx++) { 391 bind_item = arr_bind[sx]; 392 if (!bind_item._dataset) { 393 continue; 394 } 395 396 if (bind_item.columnid == "") { 397 continue; 398 } 399 400 var ds = bind_item._dataset; 401 row_idx = ds.rowposition; 402 var comp = bind_item._comp; 403 404 if (comp) { 405 if (bind_item._en_type == 2) { 406 if (all_flag) { 407 if (comp.enable && comp._isPropEnable()) { 408 if (row_idx < 0) { 409 comp._setEnable(false); 410 } 411 else { 412 comp._setEnable(true); 413 } 414 } 415 else if (!comp.enable) { 416 if (row_idx >= 0) { 417 comp._setEnable(true); 418 } 419 } 420 col = ds._getDataColIndex(bind_item.columnid); 421 422 if (col >= 0) { 423 if (comp.on_change_bindSource) { 424 comp.on_change_bindSource(bind_item.propid, bind_item._dataset, row_idx, col, -1); 425 } 426 } 427 else { 428 if (comp.on_init_bindSource) { 429 comp.on_init_bindSource(bind_item.columnid, bind_item.propid, bind_item._dataset); 430 } 431 } 432 } 433 else { 434 if (col >= 0) { 435 if (bind_item.columnid == col_id && comp.on_change_bindSource) { 436 comp.on_change_bindSource(bind_item.propid, bind_item._dataset, row_idx, col, -1); 437 } 438 } 439 else { 440 if (bind_item.columnid == col_id && comp.on_init_bindSource) { 441 comp.on_init_bindSource(bind_item.columnid, bind_item.propid, bind_item._dataset); 442 } 443 } 444 } 445 } 446 else { 447 var val0; 448 if (all_flag) { 449 val0 = ds.getConstColumn(bind_item.columnid); 450 451 if (val0 == undefined) { 452 col = ds._getDataColIndex(bind_item.columnid); 453 454 if (col == undefined) { 455 col = -1; 456 } 457 458 val0 = ds.getColumn(row_idx, col); 459 } 460 } 461 else { 462 if (col_id == bind_item.columnid) { 463 val0 = val; 464 } 465 else { 466 continue; 467 } 468 } 469 if (bind_item.propid) { 470 if (comp["set_" + bind_item.propid]) { 471 comp["set_" + bind_item.propid](val0); 472 } 473 else if (comp.style && comp.style["set_" + bind_item.propid]) { 474 comp.style["set_" + bind_item.propid](val0); 475 } 476 } 477 } 478 } 479 } 480 return true; 481 }; 482 483 delete _pBindManager; 484 485 nexacro.FormBase = function (id, position, left, top, width, height, right, bottom, parent) { 486 nexacro.Component.call(this, id, position, left, top, width, height, right, bottom, parent); 487 488 this.all = new nexacro.Collection(); 489 this.components = new nexacro.Collection(); 490 this.objects = new nexacro.Collection(); 491 this.binds = new nexacro.Collection(); 492 this._bind_manager = new nexacro.BindManager(this); 493 this._layout_list = new nexacro.Collection(); 494 495 this.scrollbars = "autoboth"; 496 this.dragscrolltype = "all"; 497 498 499 this._css_selectors = { 500 _has_items : false, 501 _has_attr_items : false 502 }; 503 this._cssfinder_cache = { 504 }; 505 506 507 this._child_list = []; 508 509 this._refform = this; 510 this._scrollbars = 3; 511 512 this._load_manager = new nexacro.LoadManager(this); 513 this._timerManager = new nexacro.TimerManager(this); 514 515 this._includescriptlist = []; 516 517 this._apply_client_padding = false; 518 519 this._hotkey_list = []; 520 this._load_callbacklist = []; 521 this._is_loadcallback = false; 522 523 this._is_form = true; 524 this._is_loaded = false; 525 this._is_completed = false; 526 this._is_async = false; 527 this._is_scrollable = true; 528 529 this._url = ""; 530 this._base_url = ""; 531 532 this._last_focused = null; 533 this._hittest_type = ""; 534 535 this._default_layout = null; 536 this._current_layout_name = "default"; 537 this._cur_real_layout = "default"; 538 539 this._obj_mousemove = null; 540 541 this._locale = ""; 542 }; 543 544 var _pFormBase = nexacro.FormBase.prototype = nexacro._createPrototype(nexacro.Component, nexacro.FormBase); 545 546 _pFormBase._type_name = "FormBase"; 547 548 _pFormBase.on_create = nexacro._emptyFn; 549 550 _pFormBase.on_create_control_element = function (parent_elem) { 551 if (!parent_elem) { 552 return null; 553 } 554 555 var control_elem; 556 if (this._is_scrollable) {
557 control_elem = this.on_create_scrollable_control_element(parent_elem); 558 } 559 else { 560 control_elem = this.on_create_normal_control_element(parent_elem); 561 } 562 563 return control_elem; 564 }; 565 566 _pFormBase.createComponent = function (bCreateOnly) { 567 if (this._is_loading) { 568 return; 569 } 570 571 var parent_elem = null; 572 if (!this._is_window) { 573 parent_elem = this.parent ? this.parent._control_element : null; 574 if (!parent_elem) { 575 return false; 576 } 577 } 578 579 var control_elem = this._control_element; 580 if (!control_elem) { 581 control_elem = this.on_create_control_element(parent_elem); 582 if (this._is_nc_control) { 583 control_elem._is_nc_element = true; 584 } 585 586 587 var pseudo = this._getResultPseudo(this._status, this._pseudo); 588 this._initControl(control_elem, pseudo); 589 590 if (this._layout_list.length > 0) { 591 this._initLayoutManager(); 592 } 593 594 this._initStepContents(); 595 596 this._initContents(control_elem, pseudo); 597 if (this.tooltiptext) { 598 this.on_apply_prop_tooltip(); 599 } 600 601 if (this.positionstep != null) { 602 this.on_apply_positionstep(this.positionstep); 603 } 604 605 if (this._hittest_type) { 606 control_elem.setElementHittestType(this._hittest_type); 607 } 608 609 if (!bCreateOnly && (this._is_window || parent_elem._handle)) { 610 var _window = this._getWindow(); 611 this.on_created(_window); 612 } 613 } 614 else { 615 if (parent_elem && parent_elem._handle) { 616 parent_elem.appendChildElement(control_elem); 617 control_elem.parent = this; 618 619 if (this._layout_list.length > 0) { 620 this._initLayoutManager(); 621 } 622 623 this._initStepContents(); 624 625 var pseudo = this._getResultPseudo(this._status, this._pseudo); 626 this._initControl(control_elem, pseudo); 627 this._initContents(control_elem, pseudo); 628 629 if (this.tooltiptext) { 630 this.on_apply_prop_tooltip(); 631 } 632 633 if (!bCreateOnly) { 634 var window = this._getWindow(); 635 this.on_created(window); 636 } 637 } 638 else { 639 var pseudo = this._getResultPseudo(this._status, this._pseudo); 640 this._initControl(control_elem, pseudo); 641 this._initContents(control_elem, pseudo); 642 if (this.tooltiptext) { 643 this.on_apply_prop_tooltip(); 644 } 645 } 646 } 647 return true; 648 }; 649 650 _pFormBase.on_create_contents = function () { 651 var comps = this.components; 652 var len = comps.length; 653 654 for (var i = 0; i < len; i++) { 655 comps[i].createComponent(true); 656 } 657 }; 658 659 _pFormBase.on_created_contents = function () { 660 var len = this.objects.length; 661 var i = 0; 662 for (i = 0; i < len; i++) { 663 this.objects[i].on_created(); 664 } 665 666 var comps = this.components; 667 len = comps.length; 668 for (i = 0; i < len; i++) { 669 var is_form = false; 670 if (comps[i] instanceof nexacro.FormBase) { 671 is_form = true; 672 comps[i]._is_loadcallback = this._load_callbacklist; 673 } 674 675 comps[i].on_created(); 676 677 if (is_form) { 678 comps[i]._is_loadcallback = false; 679 } 680 } 681 682 if (this.stepcontrol) { 683 this.stepcontrol.on_created(); 684 } 685 686 if (this._is_scrollable) { 687 this.resetScroll(); 688 var control_elem = this._control_element; 689 if (control_elem && this.stepcontrol) { 690 control_elem.setElementHScrollPos(control_elem.client_width * control_elem._step_index); 691 } 692 } 693 694 this.on_apply_prop_rtldirection(); 695 var rtlimagemirroring = this.on_find_CurrentStyle_rtlimagemirroring(this._pseudo); 696 this.on_apply_style_rtlimagemirroring(rtlimagemirroring); 697 698 control_elem = null; 699 comps = null; 700 701 var win = this._getWindow(); 702 if (win) { 703 nexacro._refreshWindow(win._handle); 704 } 705 }; 706 707 _pFormBase.on_destroy_contents = function () { 708 if (this._timerManager) { 709 this._timerManager.destroy(); 710 this._timerManager = null; 711 } 712 713 if (this._load_manager) { 714 var load_manager = this._load_manager; 715 var tr_list = load_manager.transactionList; 716 if (tr_list) { 717 this._stopTransaction(true); 718 719 for (var i = tr_list.length - 1; i >= 0; i--) { 720 var tr_item = tr_list[i]; 721 if (tr_item._usewaitcursor) { 722 tr_item._hideWaitCursor(this); 723 } 724 725 tr_item = null; 726 } 727 728 tr_list = null; 729 } 730 this._load_manager.destroy(); 731 this._load_manager = null; 732 } 733 734 var binds = this.binds; 735 var len = binds.length; 736 for (var i = 0; i < len; i++) { 737 var bindname = binds.get_id(i); 738 this._bind_manager._setBinditem(binds.get_item(bindname), true); 739 this[bindname] = null; 740 } 741 742 var components = this.components; 743 len = components.length; 744 745 for (var i = 0; i < len; i++) { 746 var compname = components.get_id(0); 747 if (this[compname]) { 748 if (this[compname]._destroy) { 749 this[compname]._destroy(); 750 this[compname] = null; 751 } 752 } 753 } 754 755 var objects = this.objects; 756 len = objects.length; 757 for (var i = 0; i < len; i++) { 758 var objname = objects.get_id(0); 759 if (this[objname]) { 760 if (this[objname].destroy) { 761 this[objname].destroy(); 762 } 763 764 objects.delete_item(objname); 765 delete this[objname]; 766 this[objname] = null; 767 } 768 } 769 770 var layouts = this._layout_list; 771 len = layouts.length; 772 for (var i = 0; i < len; i++) { 773 var layout = layouts.get_id(0); 774 if (layout) { 775 if (layouts[layout].destroy) { 776 layouts[layout].destroy(); 777 } 778 layouts.delete_item(layout); 779 } 780 } 781 782 if (this._bind_manager) { 783 this._bind_manager.destroy(); 784 this._bind_manager = null; 785 } 786 787 this.all.clear(); 788 this.all = null; 789 this.components.clear(); 790 this.components = null; 791 this.objects.clear(); 792 this.objects = null; 793 this.binds.clear(); 794 this.binds = null; 795 this._layout_list.clear(); 796 this._layout_list = null; 797 798 this._css_selectors = null; 799 this._cssfinder_cache = null; 800 this._child_list = null; 801 802 this._includescriptlist = null; 803 this._hotkey_list = null; 804 this._load_callbacklist = null; 805 this._css_finder = null; 806 this._ref_css_finder = null; 807 this._find_csslist = null; 808 if (this._default_layout) { 809 if (this._default_layout.destroy) { 810 this._default_layout.destroy(); 811 } 812 this._default_layout = null; 813 } 814 815 this._obj_mousemove = null; 816 }; 817 818 _pFormBase._clearUserFunctions = function () { 819 var objPrototype = null; 820 if (this._type_name == "Div") { 821 objPrototype = nexacro.Div.prototype; 822 } 823 else if (this._type_name == "Tab") { 824 objPrototype = nexacro.Tab.prototype; 825 } 826 else if (this._type_name == "Tabpage") { 827 objPrototype = nexacro.Tabpage.prototype; 828 } 829 else if (this._type_name == "PopupDiv") { 830 objPrototype = nexacro.PopupDiv.prototype; 831 } 832 else if (this instanceof nexacro.Tab) { 833 objPrototype = nexacro.Tab.prototype; 834 } 835 else if (this instanceof nexacro.Tabpage) { 836 objPrototype = nexacro.Tabpage.prototype; 837 } 838 else if (this instanceof nexacro.PopupDiv) { 839 objPrototype = nexacro.PopupDiv.prototype; 840 } 841 else if (this instanceof nexacro.Div) { 842 objPrototype = nexacro.Div.prototype; 843 } 844 else if (this instanceof nexacro.Form) { 845 objPrototype = nexacro.Form.prototype; 846 } 847 else if (this instanceof nexacro.Frame) { 848 objPrototype = nexacro.Frame.prototype; 849 } 850 851 for (var func in this) { 852 if (typeof this[func] === "function" && objPrototype && !objPrototype[func]) { 853 this[func] = null; 854 } 855 } 856 }; 857 858 _pFormBase._clear = function () { 859 var control_elem = this.getElement(); 860 if (control_elem) { 861 this._is_init = true; 862 this._pseudo = "normal"; 863 this.currentstyle._empty(); 864 this._control_pseudo = ""; 865 this._contents_pseudo = ""; 866 867 this._clearEventListeners(); 868 869 if (this._timerManager && this._timerManager.timerList.length > 0) { 870 this._timerManager.clearAll(); 871 } 872 873 control_elem.clearContents(); 874 875 if (this.stepcontrol) { 876 this._destroyStepControl(); 877 delete this.stepcontrol; 878 } 879 880 var binds = this.binds; 881 var len = binds.length; 882 for (var i = 0; i < len; i++) { 883 var bindname = binds.get_id(i); 884 this._bind_manager._setBinditem(binds.get_item(bindname), true); 885 delete this[bindname]; 886 } 887 888 889 var components = this.components; 890 var objects = this.objects; 891 892 this.all = new nexacro.Collection(); 893 this.components = new nexacro.Collection(); 894 this.objects = new nexacro.Collection(); 895 896 len = components.length; 897 for (var i = 0; i < len; i++) { 898 var compname = components.get_id(i); 899 if (this[compname]) { 900 if (this[compname]._destroy) { 901 this[compname]._destroy(); 902 } 903 } 904 } 905 components.clear(); 906 907 len = objects.length; 908 for (var i = 0; i < len; i++) { 909 var objname = objects.get_id(i); 910 if (this[objname]) { 911 if (this[objname].destroy) { 912 this[objname].destroy(); 913 } 914 delete this[objname]; 915 } 916 } 917 objects.clear(); 918 this.all.clear(); 919 this.components.clear(); 920 this.objects.clear(); 921 this.binds.clear(); 922 923 this._hotkey_list = []; 924 925 if (this._is_scrollable) { 926 this.resetScroll(); 927 } 928 } 929 this._is_created = false; 930 931 this._is_loadcallback = false; 932 }; 933 934 935 _pFormBase._initStepContents = function () { 936 if (this._layout_list.length == 0 && this._default_layout) { 937 var old_stepindex = -1, old_stepcount = 0; 938 var new_stepindex = -1, new_stepcount = 0; 939 940 new_stepindex = this._default_layout.stepindex; 941 new_stepcount = this._default_layout.stepcount; 942 this._on_prepare_stepcontents(old_stepcount, old_stepindex, new_stepcount, new_stepindex); 943 this._on_refresh_stepcontents(old_stepcount, old_stepindex, new_stepcount, new_stepindex); 944 } 945 }; 946 947 _pFormBase.on_initEvent = nexacro._emptyFn; 948 _pFormBase._init = nexacro._emptyFn; 949 _pFormBase.loadIncludeScript = nexacro._emptyFn; 950 _pFormBase.loadPreloadList = nexacro._emptyFn; 951 952 _pFormBase._loadInclude = function (mainurl, url, asyncmode) { 953 var service = nexacro._getServiceObject(url); 954 var suburl = nexacro._makeurl(url); 955 this._load_manager.loadIncludeModule(suburl, null, asyncmode, service); 956 }; 957
958 _pFormBase.executeScript = function (url, scriptstr, exports) { 959 var suburl = nexacro._makeurl(url); 960 961 if (scriptstr) { 962 var module = nexacro._executeScript(scriptstr); 963 964 if (module) { 965 var async = this._async; 966 this._async = false; 967 module.call(this, suburl, exports); 968 this._executeScript(this); 969 this._async = async; 970 } 971 } 972 else { 973 var scriptlist = this._includescriptlist; 974 var item, dep, _url; 975 976 for (var i = 0, len = scriptlist.length; i < len; i++) { 977 item = scriptlist[i]; 978 _url = nexacro._makeurl(item.url); 979 980 if (_url == suburl && !item.isexecute) { 981 if (!item.isloadonly) { 982 for (var j = 0, deplen = item.deps.length; j < deplen; j++) { 983 dep = item.deps[j]; 984 this.executeScript(dep, scriptstr, exports); 985 } 986 } 987 item.isexecute = true; 988 item.fn.call(this); 989 break; 990 } 991 } 992 } 993 }; 994 995 _pFormBase.executeIncludeScript = _pFormBase.executeScript; 996 997 _pFormBase._executeScript = function (context) { 998 if (context && context._registerscriptfn) { 999 context._registerscriptfn.call(context); 1000 } 1001 context._registerscriptfn = null; 1002 context._includescriptlist.length = 0; 1003 }; 1004 1005 1006 _pFormBase.registerScript = function (filename, fn) { 1007 var scriptlist = this._includescriptlist; 1008 var len = scriptlist.length, _url; 1009 1010 for (var i = 0; i < len; i++) { 1011 _url = nexacro._makeurl(scriptlist[i].url); 1012 if (_url == filename) { 1013 scriptlist[i].fn = fn; 1014 return; 1015 } 1016 } 1017 1018 this._registerscriptfn = fn; 1019 }; 1020 1021 1022 _pFormBase.addIncludeScript = function (mainurl, url) { 1023 if (url && this._is_loading) { 1024 var deps = [], depslen; 1025 var includescript; 1026 var list = this._includescriptlist; 1027 1028 for (var i = 0, len = list.length; i < len; i++) { 1029 includescript = list[i]; 1030 if (!includescript.isloadonly) { 1031 if (includescript.url.match(mainurl)) { 1032 depslen = includescript.deps.length; 1033 for (var j = 0; j < depslen; j++) { 1034 if (includescript.deps[j] == url) { 1035 continue; 1036 } 1037 } 1038 includescript.deps.push(url); 1039 } 1040 } 1041 1042 if (includescript.url == url) { 1043 return; 1044 } 1045 } 1046 1047 this._includescriptlist.push({ 1048 url : url, 1049 deps : deps, 1050 isloadonly : false, 1051 fn : nexacro._emptyFn, 1052 isload : false, 1053 isexecute : false 1054 }); 1055 } 1056 }; 1057 1058 _pFormBase.loadIncludeScript = function (mainurl, isloadonly) { 1059 var includescript; 1060 var list = this._includescriptlist; 1061 1062 for (var i = 0, len = list.length; i < len; i++) { 1063 includescript = list[i]; 1064 includescript.isloadonly = isloadonly; 1065 1066 if (includescript.isload == false) { 1067 includescript.isload = true; 1068 1069 1070 this._loadInclude.call(this, mainurl, includescript.url, this._async); 1071 } 1072 } 1073 }; 1074 1075 _pFormBase._make_find_csslist = function () { 1076 var css_list = this._find_csslist; 1077 if (!css_list) { 1078 css_list = []; 1079 var pThis = this; 1080 var css; 1081 while (pThis) { 1082 css = pThis._css_selectors; 1083 if (css && css._has_items) { 1084 css_list.push(css); 1085 } 1086 1087 if (pThis._is_frame && pThis._is_popup_frame && pThis._window_type != 5) { 1088 break; 1089 } 1090 else if (pThis.parent == null && !pThis._is_application) { 1091 pThis = application; 1092 } 1093 else { 1094 pThis = pThis.parent; 1095 } 1096 } 1097 this._find_csslist = css_list; 1098 } 1099 return css_list; 1100 }; 1101 1102 _pFormBase._addCss = function (objtype, styleProp, styleobj, pseudoarr) { 1103 var type_arr = objtype.split(">"); 1104 var cnt = type_arr.length; 1105 1106 var css = this._css_selectors; 1107 css._has_items = true; 1108 var type_id = ""; 1109 var ref_id = ""; 1110 var cls_name = ""; 1111 1112 for (var i = 0; i < cnt; i++) { 1113 var type_name = type_arr[i]; 1114 1115 if (type_name == "*") { 1116 continue; 1117 } 1118 if (type_name.substr(0, 1) == "#") { 1119 ref_id += type_name; 1120 } 1121 else if (type_name.substr(0, 1) == ".") { 1122 if (ref_id == "") { 1123 cls_name = type_name; 1124 } 1125 } 1126 else { 1127 if (type_name.substr(0, 2) == "*.") { 1128 type_name = type_name.substring(1); 1129 } 1130 1131 if (ref_id == "") { 1132 type_id = type_name; 1133 } 1134 } 1135 } 1136 if (type_id != "") { 1137 var css2 = css[type_id]; 1138 if (!css2) { 1139 css[type_id] = css2 = { 1140 _is_selector : true 1141 }; 1142 } 1143 css = css2; 1144 } 1145 else if (cls_name != "") { 1146 var css2 = css[cls_name]; 1147 if (!css2) { 1148 css[cls_name] = css2 = { 1149 _is_selector : true 1150 }; 1151 } 1152 css = css2; 1153 } 1154 1155 if (ref_id != "") { 1156 var css2 = css[ref_id]; 1157 if (!css2) { 1158 css[ref_id] = css2 = { 1159 _is_selector : true 1160 }; 1161 } 1162 css = css2; 1163 } 1164 1165 css._has_attr_items = true; 1166 var css_item = css[styleProp]; 1167 if (!css_item) { 1168 css[styleProp] = css_item = { 1169 }; 1170 } 1171 var i = 0; 1172 var pseudo_cnt = pseudoarr.length; 1173 var cur_pseudo; 1174 if (i >= pseudo_cnt) { 1175 return; 1176 } 1177 cur_pseudo = pseudoarr[i++]; 1178 css_item[cur_pseudo] = styleobj; 1179 if (i >= pseudo_cnt) { 1180 return; 1181 } 1182 cur_pseudo = pseudoarr[i++]; 1183 css_item[cur_pseudo] = styleobj; 1184 if (i >= pseudo_cnt) { 1185 return; 1186 } 1187 cur_pseudo = pseudoarr[i++]; 1188 css_item[cur_pseudo] = styleobj; 1189 if (i >= pseudo_cnt) { 1190 return; 1191 } 1192 cur_pseudo = pseudoarr[i++]; 1193 css_item[cur_pseudo] = styleobj; 1194 if (i >= pseudo_cnt) { 1195 return; 1196 } 1197 cur_pseudo = pseudoarr[i++]; 1198 css_item[cur_pseudo] = styleobj; 1199 if (i >= pseudo_cnt) { 1200 return; 1201 } 1202 cur_pseudo = pseudoarr[i++]; 1203 css_item[cur_pseudo] = styleobj; 1204 if (i >= pseudo_cnt) { 1205 return; 1206 } 1207 cur_pseudo = pseudoarr[i++]; 1208 css_item[cur_pseudo] = styleobj; 1209 }; 1210 1211 _pFormBase.create = function () { 1212 this.on_create(); 1213 }; 1214 1215 _pFormBase.initEvent = function () { 1216 this.on_initEvent(); 1217 }; 1218 1219 _pFormBase._on_init = function () { 1220 if (this._is_created) { 1221 this._clear(); 1222 } 1223 else { 1224 if (this._clear_obj) { 1225 this._clear_obj();
1226 } 1227 } 1228 1229 if (this._is_loading) { 1230 this._clearEventListeners(); 1231 } 1232 1233 this._init(); 1234 this.create(); 1235 1236 this._is_loading = false; 1237 1238 if (this.parent && this.parent.form == this) { 1239 this.parent._loadedForm(); 1240 } 1241 1242 var url = this._url, item = null; 1243 1244 var scriptlist = this._includescriptlist; 1245 1246 for (var i = 0, len = scriptlist.length; i < len; i++) { 1247 item = scriptlist[i]; 1248 if (item && !item.isloadonly) { 1249 this.executeScript(item.url, null, this); 1250 } 1251 } 1252 1253 this._executeScript(this); 1254 1255 this.initEvent(); 1256 1257 this._is_loaded = true; 1258 }; 1259 1260 _pFormBase._addPreloadList = function (type, url, id, args) { 1261 if (!url) { 1262 return; 1263 } 1264 1265 var fullurl, service; 1266 if (type == "data") { 1267 service = nexacro._getServiceObject(url, true); 1268 fullurl = nexacro._getServiceLocation(url, this._base_url); 1269 this._load_manager.addPreloadItem(type, fullurl, id, args, service); 1270 } 1271 else { 1272 service = nexacro._getServiceObject(url); 1273 fullurl = nexacro._getFDLLocation(url, this._base_url); 1274 this._load_manager.addPreloadItem(type, fullurl, this, null, service); 1275 } 1276 }; 1277 1278 1279 1280 _pFormBase._findForm = function (comp) { 1281 return this; 1282 }; 1283 1284 _pFormBase._getReferenceContext = function () { 1285 return this; 1286 }; 1287 1288 _pFormBase._getDlgCode = function (keycode, altKey, ctrlKey, shiftKey) { 1289 var last_focused_comp = this._getLastFocused(); 1290 if (last_focused_comp && last_focused_comp != this) { 1291 return last_focused_comp._getDlgCode(keycode, altKey, ctrlKey, shiftKey); 1292 } 1293 return { 1294 want_tab : false, 1295 want_return : false, 1296 want_escape : false, 1297 want_chars : false, 1298 want_arrows : false 1299 }; 1300 }; 1301 1302 1303 _pFormBase.setSize = function (width, height) { 1304 if (this._adjust_width != width || this._adjust_height != height) { 1305 this._adjustPosition(this.left, this.top, null, null, width, height, this.parent._client_width, this.parent._client_height); 1306 var control_elem = this._control_element; 1307 if (control_elem) { 1308 control_elem.setElementSize(width, height); 1309 this._updateClientSize(control_elem); 1310 } 1311 } 1312 }; 1313 1314 _pFormBase._waitCursor = function (wait_flag, context) { 1315 var ownerframe = this.getOwnerFrame(); 1316 if (ownerframe) { 1317 ownerframe._waitCursor(wait_flag, context); 1318 } 1319 }; 1320 1321 _pFormBase._destroy = function () { 1322 if (!this._is_alive || this._is_destroying) { 1323 return; 1324 } 1325 1326 return this.destroyComponent(); 1327 }; 1328 1329 _pFormBase.destroy = function () { 1330 if (!this._is_alive) { 1331 return; 1332 } 1333 1334 var confirm_message = this._on_beforeclose(); 1335 if (this._checkAndConfirmClose(confirm_message) == false) { 1336 return false; 1337 } 1338 1339 if (this._window) { 1340 this._window._ignore_close_confirm = true; 1341 } 1342 1343 this._on_close(); 1344 1345 return this.destroyComponent(); 1346 }; 1347 1348 _pFormBase.loadCss = function (url, base_url, async) { 1349 if (url) { 1350 if (!base_url) { 1351 base_url = this._base_url; 1352 } 1353 var cssurl = []; 1354 cssurl.push(nexacro._getServiceLocation(url, base_url)); 1355 if (!application.checkversion) { 1356 cssurl.push(".js"); 1357 } 1358 1359 var service = nexacro._getServiceObject(url); 1360 this._load_manager.loadCssModule(cssurl.join(""), null, async, service); 1361 } 1362 }; 1363 1364 _pFormBase.move = function (left, top, width, height, right, bottom, noneUpdate) { 1365 var control_elem = this.getElement(); 1366 1367 var old_left = this._adjust_left; 1368 var old_top = this._adjust_top; 1369 var old_width = this._adjust_width; 1370 var old_height = this._adjust_height; 1371 var bsize = false, bmove = false; 1372 var update = false; 1373 1374 var parent = this.parent; 1375 if (parent) { 1376 this._adjustPosition(left, top, right, bottom, width, height, parent._client_width, parent._client_height); 1377 } 1378 else { 1379 this._adjustPosition(left, top, right, bottom, width, height, null, null); 1380 } 1381 1382 if (this._adjust_width != old_width || this._adjust_height != old_height) { 1383 bsize = true; 1384 if (old_width == 0 || old_height == 0) { 1385 update = true; 1386 } 1387 } 1388 if (this._adjust_left != old_left || this._adjust_top != old_top) { 1389 bmove = true; 1390 } 1391 this.on_update_position(bsize, bmove); 1392 1393 if (this._layout_list && this._layout_list.length > 0) { 1394 this._checkValidLayout(); 1395 } 1396 1397 if (update) { 1398 this.currentstyle._empty(); 1399 this._control_pseudo = ""; 1400 } 1401 1402 this._updateControl(control_elem); 1403 this._updateContents(control_elem); 1404 }; 1405 1406 _pFormBase.resize = function (w, h) { 1407 if (w < 0 || h < 0) { 1408 return; 1409 } 1410 1411 if (w == this._adjust_width && h == this._adjust_height) { 1412 var control_elem = this.getElement(); 1413 if (control_elem && control_elem._handle && control_elem._vml_elem) { 1414 control_elem._refreshVMLContainerElement(control_elem, control_elem._vml_elem); 1415 } 1416 return; 1417 } 1418 var old_width = this._adjust_width; 1419 var old_height = this._adjust_height; 1420 1421 var bsize = false; 1422 if (old_width != this._adjust_left + w || old_height != this._adjust_top + h) { 1423 this.width = w; 1424 this.height = h; 1425 bsize = true; 1426 } 1427 1428 this._update_position(bsize, false); 1429 1430 if (this._layout_list && this._layout_list.length > 0) { 1431 this._checkValidLayout(); 1432 } 1433 }; 1434 1435 _pFormBase.confirm = function (strText, strCaption, strType) { 1436 var win = this._getWindow(); 1437 if (!win) { 1438 return; 1439 } 1440 1441 nexacro._skipDragEventAfterMsgBox = true; 1442
1443 return nexacro._confirm(win.frame, strText, strCaption, strType); 1444 }; 1445 1446 _pFormBase.alert = function (strText, strCaption, strType) { 1447 var win = this._getWindow(); 1448 if (!win) { 1449 return; 1450 } 1451 1452 nexacro._skipDragEventAfterMsgBox = true; 1453 application._is_on_alert = true; 1454 nexacro._alert(win.frame, strText, strCaption, strType); 1455 application._is_on_alert = false; 1456 }; 1457 1458 _pFormBase.getOwnerFrame = function () { 1459 var frame = null; 1460 if (this.parent && !(this.parent instanceof nexacro.Frame)) { 1461 frame = this.parent.getOwnerFrame(); 1462 } 1463 else { 1464 frame = this.parent; 1465 } 1466 return frame; 1467 }; 1468 1469 _pFormBase.lookup = function (name) { 1470 for (var f = this; (f != null); f = (f.opener || f.parent)) { 1471 if (name in f) { 1472 return f[name]; 1473 } 1474 } 1475 }; 1476 1477 _pFormBase.lookupSetter = function (name, fnname) { 1478 if (!fnname) { 1479 fnname = "set_" + name; 1480 } 1481 for (var f = this; (f != null); f = (f.opener || f.parent)) { 1482 var fn = f[fnname]; 1483 if (fn) { 1484 return new nexacro.SetterBinder(f, name, fn); 1485 } 1486 if (name in f) { 1487 return new nexacro.PropBinder(f, name); 1488 } 1489 } 1490 return null; 1491 }; 1492 1493 _pFormBase.lookupFunc = function (name) { 1494 for (var f = this; (f != null); f = (f.opener || f.parent)) { 1495 var fn = f[name]; 1496 if (fn) { 1497 return new nexacro.FuncBinder(f, fn); 1498 } 1499 } 1500 return null; 1501 }; 1502 1503 _pFormBase.getLayoutInfo = function (name, key) { 1504 var layout = this._layout_list[name]; 1505 if (layout) { 1506 return layout[key]; 1507 } 1508 return; 1509 }; 1510 1511 _pFormBase._on_activate = function () { 1512 if (this.visible && this._isEnable() && this.enableevent) { 1513 this.on_fire_onactivate(); 1514 } 1515 }; 1516 1517 _pFormBase._on_deactivate = function () { 1518 if (this.visible && this._isEnable() && this.enableevent) { 1519 this.on_fire_ondeactivate(); 1520 } 1521 }; 1522 1523 _pFormBase.on_fire_onactivate = function () { 1524 if (this.onactivate && this.onactivate._has_handlers) { 1525 var evt = new nexacro.ActivateEventInfo(this, "onactivate", true, this, this); 1526 this.onactivate._fireEvent(this, evt); 1527 } 1528 }; 1529 1530 _pFormBase.on_fire_ondeactivate = function () { 1531 if (this.ondeactivate && this.ondeactivate._has_handlers) { 1532 var evt = new nexacro.ActivateEventInfo(this, "ondeactivate", false, this, this); 1533 this.ondeactivate._fireEvent(this, evt); 1534 } 1535 }; 1536 1537 _pFormBase._on_beforeclose = function (root_closing_comp) { 1538 if (!this._is_alive || (this._is_form && !this._is_loaded)) { 1539 return; 1540 } 1541 1542 if (!root_closing_comp) { 1543 root_closing_comp = this; 1544 } 1545 var msg = ""; 1546 1547 var components = this.components; 1548 var len = components.length; 1549 for (var i = 0; i < len; i++) { 1550 var comp = components[i]; 1551 if (!(comp instanceof nexacro.FormBase)) { 1552 continue; 1553 } 1554 1555 var comp_msg = comp._on_beforeclose(root_closing_comp); 1556 msg = this._appendBeforeCloseMsg(msg, comp_msg); 1557 } 1558 1559 var self_msg = this._on_bubble_beforeclose(root_closing_comp); 1560 msg = this._appendBeforeCloseMsg(msg, self_msg); 1561 1562 return msg; 1563 }; 1564 1565 _pFormBase._on_bubble_beforeclose = function (root_closing_comp, event_bubbles, fire_comp, refer_comp) { 1566 var first_call = false; 1567 if (event_bubbles === undefined) { 1568 first_call = true; 1569 fire_comp = this; 1570 if (!refer_comp) { 1571 refer_comp = this; 1572 } 1573 } 1574 1575 var msg = ""; 1576 if (this.visible && this._isEnable()) { 1577 if (this.enableevent) { 1578 if (first_call) { 1579 event_bubbles = false; 1580 } 1581 1582 msg = this.on_fire_onbeforeclose(this, fire_comp, refer_comp, root_closing_comp); 1583 } 1584 } 1585 1586 var bubbled_msg = ""; 1587 if ((!this.onbeforeclose || (this.onbeforeclose && !this.onbeforeclose.stoppropagation)) && event_bubbles !== true && this.parent && !this.parent._is_application) { 1588 bubbled_msg = this.parent._on_bubble_beforeclose(root_closing_comp, event_bubbles, fire_comp, refer_comp); 1589 } 1590 1591 return this._appendBeforeCloseMsg(msg, bubbled_msg); 1592 }; 1593 1594 _pFormBase._on_close = function () { 1595 if (!this._is_alive || (this._is_form && !this._is_loaded)) { 1596 return true; 1597 } 1598 1599 var components = this.components; 1600 var len = components.length; 1601 for (var i = 0; i < len; i++) { 1602 var comp = components[i]; 1603 if (!(comp instanceof nexacro.FormBase)) { 1604 continue; 1605 } 1606 1607 comp._on_close(); 1608 } 1609 1610 this._on_bubble_close(); 1611 }; 1612 1613 _pFormBase._on_bubble_close = function (event_bubbles, fire_comp, refer_comp) { 1614 var first_call = false; 1615 if (event_bubbles === undefined) { 1616 first_call = true; 1617 fire_comp = this; 1618 if (!refer_comp) { 1619 refer_comp = this; 1620 } 1621 } 1622 1623 if (this.visible && this._isEnable()) { 1624 if (this.enableevent) { 1625 if (first_call) { 1626 event_bubbles = false; 1627 } 1628 1629 this.on_fire_onclose(this, fire_comp, refer_comp); 1630 } 1631 } 1632 1633 var parent = this.parent; 1634 if (parent) { 1635 if ((!this.onclose || (this.onclose && !this.onclose.stoppropagation)) && event_bubbles !== true && !parent._is_application) { 1636 return parent._on_bubble_close(event_bubbles, fire_comp, refer_comp); 1637 } 1638 } 1639 }; 1640 1641 _pFormBase.on_fire_onbeforeclose = function (obj, from_comp, refer_comp, root_closing_comp) { 1642 if (this.onbeforeclose && this.onbeforeclose._has_handlers) { 1643 var evt = new nexacro.CloseEventInfo(obj, "onbeforeclose", from_comp, refer_comp, root_closing_comp); 1644 return this.onbeforeclose._fireEvent(this, evt); 1645 } 1646 }; 1647 1648 _pFormBase.on_fire_onclose = function (obj, from_comp, refer_comp) { 1649 if (this.onclose && this.onclose._has_handlers) { 1650 var evt = new nexacro.CloseEventInfo(obj, "onclose", from_comp, refer_comp); 1651 return this.onclose._fireEvent(this, evt); 1652 } 1653 return true; 1654 }; 1655 1656 1657 _pFormBase.loadForm = function (formurl, async, reload, baseurl) { 1658 if (this._load_manager) { 1659 var url = nexacro._getFDLLocation(formurl, baseurl); 1660 this._url = url; 1661 this._base_url = nexacro._getBaseUrl(url); 1662 1663 if (this._load_manager) { 1664 this._load_manager.clearAllLoad(); 1665 } 1666 1667 this._clearUserFunctions(); 1668 1669 this._is_loading = true; 1670 if (this.parent._is_frame && this.parent.form == this) { 1671 application._registerLoadforms(this); 1672 } 1673 1674 this._clearCssInfo(); 1675 1676 var service = nexacro._getServiceObject(formurl); 1677 var ret = this._load_manager.loadMainModule(url, undefined, async, reload, service); 1678 } 1679 }; 1680 1681 _pFormBase.getParentContext = function () { 1682 }; 1683 1684 _pFormBase._getFormBaseUrl = function () { 1685 return this._base_url; 1686 }; 1687 1688 _pFormBase._clearCssInfo = function (exceptcssselector) { 1689 this._css_finder = null; 1690 this._ref_css_finder = null; 1691 this._cssfinder_cache = { 1692 }; 1693 this._find_csslist = null; 1694 1695 var comps = this.components; 1696 var comp_len = comps.length; 1697 1698 for (var i = 0; i < comp_len; i++) { 1699 if (comps[i]._is_form) { 1700 comps[i]._clearCssInfo(exceptcssselector); 1701 } 1702 } 1703 1704 if (!exceptcssselector) { 1705 this._css_selectors = null; 1706 this._css_selectors = { 1707 _has_items : false, 1708 _has_attr_items : false 1709 }; 1710 } 1711 }; 1712 1713 _pFormBase._findChildObject = function (queryid) { 1714 var npos = queryid.indexOf("."); 1715 if (npos > 0) { 1716 var querythis = queryid.substring(0, npos).trim(); 1717 querythis = this[querythis]; 1718 if (querythis) {
1719 return querythis._findChildObject(queryid.substring(npos + 1, queryid.length).trim()); 1720 } 1721 } 1722 else { 1723 return this[queryid]; 1724 } 1725 }; 1726 1727 _pFormBase._getDatasetObject = function (queryid) { 1728 var _ds = this[queryid]; 1729 var p = (this.opener || this.parent); 1730 if (_ds == null && p && p != application) { 1731 _ds = p._getDatasetObject(queryid); 1732 } 1733 1734 if (_ds == null) { 1735 _ds = application[queryid]; 1736 } 1737 1738 return _ds; 1739 }; 1740 1741 _pFormBase._checkContainerTabFocus = function () { 1742 if (this._is_form && nexacro._enableaccessibility && this._isAccessibilityEnable() == true) { 1743 return true; 1744 } 1745 1746 return false; 1747 }; 1748 1749 _pFormBase._checkContainerHeadingFocus = function () { 1750 if (this._is_form && nexacro._enableaccessibility && this._isAccessibilityEnable() == true && this._isAccessibilityRoleHeading()) { 1751 return true; 1752 } 1753 1754 return false; 1755 }; 1756 1757 1758 _pFormBase._getTabOrderLast = function (bAccessibility, bEditable, edittype, bComposite) { 1759 var ar = this._getSortedDecendants(this, true, bAccessibility); 1760 var child; 1761 for (var i = ar.length - 1; i >= 0; i--) { 1762 child = ar[i]; 1763 if (bEditable) { 1764 if (child._isEditableComponent(edittype)) { 1765 return child; 1766 } 1767 else if (bComposite && child._is_form) { 1768 var comp = child._getTabOrderLast(bAccessibility, bEditable, edittype, bComposite); 1769 if (comp) { 1770 return comp; 1771 } 1772 } 1773 } 1774 else if (bAccessibility) { 1775 if (child._isAccessibilityEnable()) { 1776 return child; 1777 } 1778 else if (child._is_form && child._child_list.length) { 1779 var comp = child._getTabOrderLast(true); 1780 if (comp) { 1781 return comp; 1782 } 1783 } 1784 } 1785 else if (child.on_get_prop_tabstop()) { 1786 return child; 1787 } 1788 } 1789 return null; 1790 }; 1791 1792 _pFormBase._getHeadingOrderLast = function () { 1793 var ar = this._getSortedDecendants(this, true, true); 1794 var child; 1795 for (var i = ar.length - 1; i >= 0; i--) { 1796 child = ar[i]; 1797 1798 if (child._isAccessibilityRoleHeading()) { 1799 return child; 1800 } 1801 else if (child._is_form) { 1802 var comp = child._getHeadingOrderLast(); 1803 if (comp) { 1804 return comp; 1805 } 1806 } 1807 } 1808 return null; 1809 }; 1810 1811 1812 _pFormBase._getTabOrderFirst = function (bAccessibility, bEditable, edittype, bComposite) { 1813 var ar = this._getSortedDecendants(this, true, bAccessibility); 1814 var child; 1815 for (var i = 0, n = ar.length; i < n; i++) { 1816 child = ar[i]; 1817 if (bEditable) { 1818 if (child._isEditableComponent(edittype)) { 1819 return child; 1820 } 1821 else if (bComposite && child._is_form) { 1822 var comp = child._getTabOrderFirst(bAccessibility, bEditable, edittype, bComposite); 1823 if (comp) { 1824 return comp; 1825 } 1826 } 1827 } 1828 else if (bAccessibility) { 1829 if (child._isAccessibilityEnable()) { 1830 return child; 1831 } 1832 else if (child._is_form && child._child_list.length) { 1833 var comp = child._getTabOrderFirst(true); 1834 if (comp) { 1835 return comp; 1836 } 1837 } 1838 } 1839 else if (child.on_get_prop_tabstop()) { 1840 return child; 1841 } 1842 } 1843 return null; 1844 }; 1845 1846 _pFormBase._getHeadingOrderFirst = function () { 1847 var ar = this._getSortedDecendants(this, true, true); 1848 var child; 1849 for (var i = 0, n = ar.length; i < n; i++) { 1850 child = ar[i]; 1851 1852 if (child._isAccessibilityRoleHeading()) { 1853 return child; 1854 } 1855 else if (child._is_form) { 1856 var comp = child._getHeadingOrderFirst(); 1857 if (comp) { 1858 return comp; 1859 } 1860 } 1861 } 1862 return null; 1863 }; 1864 1865 _pFormBase._getTabOrderNext = function (current, direction, bAccessibility, bEditable, edittype, bhotkey, bComposite, bfocus, bNoComposite) { 1866 if (current && current._is_form && direction > 0 && !bhotkey && (bNoComposite == undefined || bNoComposite)) { 1867 var current_first_child = current._getTabOrderFirst(bAccessibility, bEditable, edittype); 1868 1869 if (nexacro._enableaccessibility && nexacro._accessibilitytype == 5) { 1870 var _window = this._getWindow(); 1871 if ((current_first_child != null) && (!current._contains(_window._accessibility_last_focused_comp) || current == _window._accessibility_last_focused_comp)) { 1872 return current_first_child; 1873 } 1874 } 1875 else if (!bfocus && current._last_focused == null && current_first_child != null) { 1876 return current_first_child; 1877 } 1878 } 1879 1880 var ar = this._getSortedDecendants(this, true, bAccessibility); 1881 var cur_idx = nexacro._indexOf(ar, current._getRootComponent(current)); 1882 1883 if (cur_idx < 0) { 1884 return null; 1885 } 1886 1887 var child; 1888 if (direction > 0) { 1889 for (var i = cur_idx + direction, ar_len = ar.length; i < ar_len; i++) { 1890 child = ar[i]; 1891 if (bEditable) { 1892 if (child._isEditableComponent(edittype)) { 1893 return child; 1894 } 1895 else if (bComposite && child._is_form) { 1896 var comp = child._getTabOrderFirst(bAccessibility, bEditable, edittype, bComposite); 1897 if (comp) { 1898 return comp; 1899 } 1900 } 1901 } 1902 else if (bAccessibility) { 1903 if (child._isAccessibilityEnable()) { 1904 return child; 1905 } 1906 else if (child._is_form && child._child_list.length) { 1907 var comp = child._getTabOrderFirst(true); 1908 if (comp) { 1909 return comp; 1910 } 1911 } 1912 else if (child._isItemAccessibilityEnable()) { 1913 return child; 1914 } 1915 } 1916 else if (child.on_get_prop_tabstop()) { 1917 return child; 1918 } 1919 } 1920 } 1921 else if (direction < 0) { 1922 for (var i = cur_idx + direction; i >= 0; i--) { 1923 child = ar[i]; 1924 if (bEditable) { 1925 if (child._isEditableComponent(edittype)) { 1926 return child; 1927 } 1928 else if (bComposite && child._is_form) { 1929 var comp = child._getTabOrderLast(bAccessibility, bEditable, edittype, bComposite); 1930 if (comp) { 1931 return comp; 1932 } 1933 } 1934 } 1935 else if (bAccessibility) { 1936 if (child._isAccessibilityEnable()) { 1937 return child; 1938 } 1939 else if (child._is_form && child._child_list.length) { 1940 var comp = child._getTabOrderLast(true); 1941 if (comp) { 1942 return comp; 1943 } 1944 } 1945 else if (child._isItemAccessibilityEnable()) { 1946 return child; 1947 } 1948 } 1949 else if (child.on_get_prop_tabstop()) { 1950 return child; 1951 } 1952 } 1953 } 1954 if (bEditable) { 1955 if (direction > 0) { 1956 for (var i = 0; i < cur_idx - direction; i++) { 1957 child = ar[i]; 1958 if (bEditable) { 1959 if (child._isEditableComponent(edittype)) { 1960 return child; 1961 } 1962 else if (bComposite && child._is_form) { 1963 var comp = child._getTabOrderFirst(bAccessibility, bEditable, edittype, bComposite); 1964 if (comp) { 1965 return comp; 1966 } 1967 } 1968 } 1969 } 1970 } 1971 else if (direction < 0) { 1972 for (var i = ar.length - 1; i > cur_idx; i--) { 1973 child = ar[i]; 1974 if (bEditable) { 1975 if (child._isEditableComponent(edittype)) { 1976 return child; 1977 } 1978 else if (bComposite && child._is_form) { 1979 var comp = child._getTabOrderLast(bAccessibility, bEditable, edittype, bComposite); 1980 if (comp) { 1981 return comp; 1982 } 1983 } 1984 } 1985 } 1986 } 1987 } 1988 return null; 1989 }; 1990 1991 _pFormBase._getHeadingOrderNext = function (current, direction) { 1992 if (current && current._is_form) { 1993 if (current._last_focused) { 1994 var comp = current._getHeadingOrderNext(current._last_focused, direction); 1995 if (comp) { 1996 return comp; 1997 } 1998 else { 1999 current._last_focused = null; 2000 } 2001 } 2002 else if (current._last_focused == null) { 2003 if (direction == 1) { 2004 var comp = current._getHeadingOrderFirst(true); 2005 } 2006 else { 2007 var comp = current._getHeadingOrderLast(true); 2008 } 2009 if (comp) { 2010 return comp; 2011 } 2012 } 2013 } 2014 2015 var ar = this._getSortedDecendants(this, true, true, null); 2016 var cur_idx = nexacro._indexOf(ar, current._getRootComponent(current)); 2017 if (cur_idx < 0) { 2018 return null; 2019 } 2020 2021 var child; 2022 if (direction > 0) { 2023 for (var i = cur_idx + direction, n = ar.length; i < n; i++) { 2024 child = ar[i]; 2025 2026 if (child._isAccessibilityRoleHeading()) { 2027 return child; 2028 } 2029 else if (child && child._is_form) { 2030 var current_first_child = child._getHeadingOrderFirst(true); 2031 if (current_first_child) { 2032 return current_first_child; 2033 } 2034 } 2035 } 2036 } 2037 else if (direction < 0) { 2038 for (var i = cur_idx + direction; i >= 0; i--) { 2039 child = ar[i]; 2040 if (child._isAccessibilityRoleHeading()) { 2041 return child; 2042 } 2043 else if (child && child._is_form) { 2044 var current_first_child = child._getHeadingOrderLast(true); 2045 if (current_first_child) { 2046 return current_first_child; 2047 } 2048 } 2049 } 2050 } 2051 return null; 2052 }; 2053 2054 _pFormBase._getSortedDecendants = function (p, include_not_tabstop, bAccessibility) { 2055 if (include_not_tabstop === undefined) { 2056 include_not_tabstop = false; 2057 } 2058 2059 var ar = []; 2060 var comps = p.components; 2061 if (comps) { 2062 var comp_len = comps.length; 2063 for (var i = 0; i < comp_len; i++) { 2064 var comp = comps[i]; 2065 2066 if (!comp || !comp._is_created || !comp.visible || ((comp._isEnable && !comp._isEnable() || !comp.enable) && (!nexacro._enableaccessibility || nexacro._accessibilitytype != 5)) || comp._popup) { 2067 continue; 2068 } 2069 2070 if (!bAccessibility && !include_not_tabstop && !comp.on_get_prop_tabstop()) { 2071 continue; 2072 } 2073 2074 var tabidx = comp._taborder; 2075 if (tabidx < 0) { 2076 tabidx = 0; 2077 } 2078 var j = ar.length; 2079 while (j > 0 && ar[j - 1]._taborder > tabidx) { 2080 ar[j] = ar[j - 1]; 2081 j--; 2082 } 2083 ar[j] = comp; 2084 } 2085 } 2086 return ar; 2087 }; 2088 2089 _pFormBase.addLayout = function (name, obj) { 2090 if (!obj) { 2091 return; 2092 } 2093 2094 if (name == "default") { 2095 this._default_layout = obj; 2096 } 2097 else if (application._screeninfo == null || (obj.screenid == "")) { 2098 this._layout_list.add_item(name, obj); 2099 } 2100 else if (application._curscreen) { 2101 if (!obj.screenid || obj.screenid == "") { 2102 this._layout_list.add_item(name, obj); 2103 return; 2104 } 2105 2106 var screenid_list = obj.screenid.split(','); 2107 var cnt = screenid_list.length; 2108 for (var i = 0; i < cnt; i++) { 2109 if (application._curscreen.name == screenid_list[i]) { 2110 this._layout_list.add_item(name, obj); 2111 break; 2112 } 2113 } 2114 } 2115 }; 2116 2117 2118 _pFormBase._setPos = function (left, top) { 2119 if (this._adjust_left != left || this._adjust_top != top) { 2120 this._adjust_left = this.left = left; 2121 this._adjust_top = this.top = top; 2122 2123 if (this.parent) { 2124 this._adjustPosition(this.left, this.top, this.right, this.bottom, this.width, this.height, this.parent._client_width, this.parent._client_height); 2125 } 2126 else { 2127 this._adjustPosition(this.left, this.top, this.right, this.bottom, this.width, this.height, 0, 0
2127); 2128 } 2129 2130 this.on_update_position(false, true); 2131 } 2132 }; 2133 2134 _pFormBase._setSize = function (width, height) { 2135 if (this._adjust_width != width || this._adjust_height != height) { 2136 this._adjust_width = this.width = width; 2137 this._adjust_height = this.height = height; 2138 2139 if (this.parent) { 2140 this._adjustPosition(this.left, this.top, this.right, this.bottom, this.width, this.height, this.parent._client_width, this.parent._client_height); 2141 } 2142 else { 2143 this._adjustPosition(this.left, this.top, this.right, this.bottom, this.width, this.height, 0, 0); 2144 } 2145 2146 this.on_update_position(true, false); 2147 } 2148 }; 2149 2150 _pFormBase._initLayoutManager = function () { 2151 var layout_name = "default"; 2152 var layout_list_len = this._layout_list.length; 2153 if (layout_list_len > 0) { 2154 var old_layout_name = this._current_layout_name; 2155 this._current_layout_name = ""; 2156 this._cur_real_layout = ""; 2157 2158 var xy = { 2159 cx : this._adjust_width, 2160 cy : this._adjust_height 2161 }; 2162 var idx = application.getLayoutManager().checkValid(this, xy); 2163 2164 layout_list_len = this._layout_list.length; 2165 2166 2167 if (this._layout_list[layout_list_len - 1].name != "default") { 2168 if (this._default_layout.screenid == "" || this._default_layout.screenid.indexOf(application._curscreen.name) >= 0) { 2169 this._layout_list.add_item("default", this._default_layout); 2170 layout_list_len = this._layout_list.length; 2171 } 2172 } 2173 2174 2175 if (idx >= 0) { 2176 var ret; 2177 var old_layout = this._layout_list[old_layout_name]; 2178 var new_layout = this._layout_list[idx]; 2179 var oldwidth = 0, oldheight = 0; 2180 oldwidth = old_layout ? old_layout.width : 0; 2181 oldheight = old_layout ? old_layout.height : 0; 2182 2183 if (old_layout_name != new_layout.name) { 2184 ret = this.on_fire_canlayoutchange(this, "canlayoutchange", old_layout_name, new_layout.name, oldwidth, new_layout.width, oldheight, new_layout.height); 2185 } 2186 2187 if (ret === true || ret === undefined) { 2188 application.getLayoutManager().loadLayout(this, null, new_layout); 2189 2190 if (old_layout_name != new_layout.name) { 2191 this.on_fire_onlayoutchanged(this, "onlayoutchanged", old_layout_name, new_layout.name, oldwidth, new_layout.width, oldheight, new_layout.height); 2192 } 2193 2194 this._current_layout_name = new_layout.name; 2195 this._cur_real_layout = new_layout.name; 2196 } 2197 else { 2198 if (old_layout_name) { 2199 layout_name = old_layout_name; 2200 } 2201 2202 this._current_layout_name = layout_name; 2203 this._cur_real_layout = layout_name; 2204 } 2205 } 2206 } 2207 else if (layout_list_len <= 0 && this._default_layout) { 2208 application.getLayoutManager().loadLayout(this, null, this._default_layout, this._default_layout); 2209 2210 this._current_layout_name = layout_name; 2211 this._cur_real_layout = layout_name; 2212 } 2213 }; 2214 2215 _pFormBase._checkValidLayout = function () { 2216 var pManager = application.getLayoutManager(); 2217 if (pManager) { 2218 var old_layout_name = this._current_layout_name; 2219 var new_layout = null; 2220 var xy = { 2221 cx : this._adjust_width, 2222 cy : this._adjust_height 2223 }; 2224 var new_idx = pManager.checkValid(this, xy); 2225 2226 if (new_idx > -1) { 2227 new_layout = this._layout_list[new_idx]; 2228 } 2229 else { 2230 return pManager.getCurrentLayout(this); 2231 } 2232 2233 if (new_layout && old_layout_name != new_layout.name) { 2234 var len = this.all.length; 2235 for (var i = 0; i < len; i++) { 2236 if (this.all[i]._is_form && this.all[i]._layout_list.length > 0) { 2237 this.all[i]._checkValidLayout(xy); 2238 } 2239 } 2240 2241 var old_layout = this._layout_list[old_layout_name]; 2242 var oldwidth = 0, oldheight = 0; 2243 oldwidth = old_layout ? old_layout.width : 0; 2244 oldheight = old_layout ? old_layout.height : 0; 2245 var ret = this.on_fire_canlayoutchange(this, "canlayoutchange", old_layout_name, new_layout.name, oldwidth, new_layout.width, oldheight, new_layout.height); 2246 if (ret === true || ret === undefined) { 2247 if (new_layout.name != "default") { 2248 pManager.changeLayout(this, this._default_layout); 2249 } 2250 2251 pManager.changeLayout(this, new_layout); 2252 2253 this.on_fire_onlayoutchanged(this, "onlayoutchanged", old_layout_name, new_layout.name, oldwidth, new_layout.width, oldheight, new_layout.height); 2254 } 2255 2256 if (this._is_scrollable) { 2257 this.resetScroll(); 2258 } 2259 2260 return new_layout; 2261 } 2262 } 2263 }; 2264 2265 _pFormBase._on_prepare_stepcontents = function (old_stepcount, old_stepindex, new_stepcount, new_stepindex) { 2266 var control_elem = this.getElement(); 2267 if (control_elem) { 2268 if (this._is_created && (old_stepcount > 0 || new_stepcount > 0)) { 2269 var comps = this.components; 2270 var comp_len = comps.length; 2271 for (var i = 0; i < comp_len; i++) { 2272 var comp_elem = comps[i].getElement(); 2273 control_elem.removeChildElement(comp_elem); 2274 } 2275 } 2276 2277 control_elem.setElementStepCount(new_stepcount);
2278 control_elem.setElementStepIndex(new_stepindex); 2279 if (new_stepindex > -1 && control_elem._step_count > new_stepindex) { 2280 control_elem.setElementHScrollPos(control_elem.client_width * new_stepindex); 2281 } 2282 } 2283 2284 if (this.stepcontrol) { 2285 this._destroyStepControl(); 2286 } 2287 }; 2288 2289 _pFormBase._on_refresh_stepcontents = function (old_stepcount, old_stepindex, new_stepcount, new_stepindex) { 2290 var control_elem = this.getElement(); 2291 if (control_elem) { 2292 if (this._is_created && (old_stepcount > 0 || new_stepcount > 0)) { 2293 var comps = this.components; 2294 var comp_len = comps.length; 2295 for (var i = 0; i < comp_len; i++) { 2296 var comp_elem = comps[i].getElement(); 2297 control_elem.appendChildElement(comp_elem); 2298 } 2299 } 2300 } 2301 2302 if (new_stepcount > 0) { 2303 if (!this.stepcontrol) { 2304 this._createStepControl(new_stepcount, new_stepindex); 2305 } 2306 2307 if (this._is_created) { 2308 this.stepcontrol.on_created(); 2309 } 2310 } 2311 }; 2312 2313 _pFormBase._createStepControl = function (stepcnt, stepidx) { 2314 if (!this.stepcontrol) { 2315 var step_ctrl = new nexacro.StepCtrl("stepcontrol", "absolute", 0, 0, 0, 0, null, null, this); 2316 step_ctrl.createComponent(true); 2317 step_ctrl.set_stepcount(stepcnt); 2318 step_ctrl.set_stepindex(stepidx); 2319 step_ctrl._setRtlDirection(this._rtldirection); 2320 2321 this.stepcontrol = step_ctrl; 2322 2323 this._updateStepControlSize(); 2324 this._setEventHandler("onstepchanged", this._on_stepchanged, this); 2325 } 2326 }; 2327 2328 _pFormBase._destroyStepControl = function () { 2329 var step_ctrl = this.stepcontrol; 2330 if (step_ctrl) { 2331 step_ctrl.destroy(); 2332 this.stepcontrol = null; 2333 } 2334 }; 2335 2336 _pFormBase._updateStepControlSize = function () { 2337 var step_ctrl = this.stepcontrol; 2338 if (step_ctrl) { 2339 this.on_update_style_stepalign(); 2340 } 2341 }; 2342 2343 _pFormBase._on_stepchanged = function (obj, e) { 2344 var stepcontrol = this.stepcontrol; 2345 var control_elem = this.getElement(); 2346 if (stepcontrol && control_elem) { 2347 var zoomFactor = this.getZoom() / 100; 2348 var client_width = control_elem.client_width / zoomFactor; 2349 2350 var is_invalid_pos = (control_elem.scroll_left != (client_width * stepcontrol.stepindex)); 2351 if (!is_invalid_pos) { 2352 return; 2353 } 2354 2355 this._createStepChangeAnimation(stepcontrol.stepindex, 400); 2356 } 2357 }; 2358 2359 _pFormBase.on_fire_sys_onslidestart = function (elem, touch_manager, touchinfos, xaccvalue, yaccvalue, xdeltavalue, ydeltavalue, from_comp, from_refer_comp) { 2360 if (this.stepcontrol && this._stepchange_info) { 2361 this._on_cancel_stepchange_animation(); 2362 } 2363 return nexacro.Component.prototype.on_fire_sys_onslidestart.call(this, elem, touch_manager, touchinfos, xaccvalue, yaccvalue, xdeltavalue, ydeltavalue, from_comp, from_refer_comp); 2364 }; 2365 2366 _pFormBase.on_fire_sys_onslideend = function (elem, touch_manager, touchinfos, xaccvalue, yaccvalue, xdeltavalue, ydeltavalue, from_comp, from_refer_comp) { 2367 if (touch_manager && touch_manager._scroll_comp == this) { 2368 var control_elem = this.getElement(); 2369 var stepcontrol = this.stepcontrol; 2370 if (!control_elem || !stepcontrol) { 2371 return; 2372 } 2373 2374 var zoomFactor = this.getZoom() / 100; 2375 var client_width = control_elem.client_width / zoomFactor; 2376 2377 var is_invalid_pos = (control_elem.scroll_left != (client_width * stepcontrol.stepindex)); 2378 if (!is_invalid_pos) { 2379 return; 2380 } 2381 2382 var duration = 400; 2383 2384 2385 var target_pos = control_elem.scroll_left - (client_width / 2); 2386 2387 var flinginfo = touch_manager.checkFling(); 2388 if (flinginfo) { 2389 var flingfactor = 3; 2390 var flingdistance = flinginfo.xstartvalue | 0; 2391 2392 if (flingdistance < -(client_width / flingfactor)) { 2393 flingdistance = -(client_width / flingfactor); 2394 } 2395 if (flingdistance > (client_width / flingfactor)) { 2396 flingdistance = (client_width / flingfactor); 2397 } 2398 2399 target_pos -= flingdistance; 2400 } 2401 2402 var target_index = nexacro.round(target_pos / (client_width) + 0.5); 2403 2404 var ret = stepcontrol.set_stepindex(target_index); 2405 2406 if (!ret) { 2407 control_elem.setElementHScrollPos(client_width * stepcontrol.stepindex); 2408 } 2409 2410 touch_manager._fling_blocked = true; 2411 } 2412 else { 2413 return nexacro.Component.prototype.on_fire_sys_onslideend.call(this, elem, touch_manager, touchinfos, xaccvalue, yaccvalue, xdeltavalue, ydeltavalue, from_comp, from_refer_comp); 2414 } 2415 2416 return false; 2417 }; 2418 2419 _pFormBase._createStepChangeAnimation = function (target_index, duration) { 2420 if (this._stepchange_info) { 2421 this._on_cancel_stepchange_animation(); 2422 } 2423 2424 var control_elem = this.getElement(); 2425 if (control_elem) { 2426 var info = { 2427 }; 2428 info.is_alive = true; 2429 info.target_index = target_index; 2430 info.starttime = new Date().getTime(); 2431 info.duration = duration; 2432 var zoomFactor = this.getZoom() / 100; 2433 var hscroll_step = control_elem.hscroll_limit / (control_elem._step_count - 1); 2434 info.startpos = control_elem.scroll_left; 2435 info.endpos = hscroll_step * target_index; 2436 2437 if (this.style.stepshowtype == "action") { 2438 var stepcontrol = this.stepcontrol; 2439 if (stepcontrol) { 2440 stepcontrol.set_visible(true); 2441 } 2442 } 2443 2444 var pThis = this; 2445 info.timer = new nexacro.AnimationFrame(this, function () { 2446 pThis._on_stepchange_animation(); 2447 }); 2448 info.timer.start(); 2449 2450 this._stepchange_info = info; 2451 } 2452 }; 2453 2454 _pFormBase._on_stepchange_animation = function () { 2455 var control_elem = this.getElement(); 2456 if (!control_elem) { 2457 return; 2458 } 2459 2460 var info = this._stepchange_info; 2461 if (info && info.is_alive) { 2462 var t = new Date().getTime() - info.starttime; 2463 var d = info.duration; 2464 var q = t / d - 1; 2465 var c = Math.min((q * q * q + 1), 1); 2466 var curpos = info.startpos + ((info.endpos - info.startpos) * c); 2467 2468 control_elem.setElementHScrollPos(curpos); 2469 if (t >= info.duration) { 2470 this._on_end_stepchange_animation(); 2471 } 2472 else { 2473 info.timer.start(); 2474 } 2475 } 2476 }; 2477 2478 _pFormBase._on_end_stepchange_animation = function () { 2479 var info = this._stepchange_info; 2480 if (!info) { 2481 return; 2482 } 2483 2484 info.is_alive = false; 2485 if (info.timer) { 2486 info.timer.stop(); 2487 } 2488 2489 var control_elem = this.getElement(); 2490 var stepcontrol = this.stepcontrol; 2491 if (control_elem && stepcontrol) { 2492 var new_index = info.target_index; 2493 delete info; 2494 2495 control_elem.setElementStepIndex(new_index); 2496 var hscroll_step = control_elem.hscroll_limit / (control_elem._step_count - 1); 2497 control_elem.setElementHScrollPos(hscroll_step * new_index); 2498 2499 var comps = this.components; 2500 var comp_len = comps.length; 2501 for (var i = 0; i < comp_len; i++) { 2502 comps[i].on_apply_positionstep(comps[i].positionstep); 2503 } 2504 2505 this.on_apply_style_stepshowtype(this.style.stepshowtype); 2506 this._stepchange_info = null; 2507 } 2508 }; 2509 2510 _pFormBase._on_cancel_stepchange_animation = function () { 2511 var info = this._stepchange_info; 2512 if (!info) { 2513 return; 2514 } 2515 2516 info.is_alive = false; 2517 if (info.timer) { 2518 info.timer.stop(); 2519 } 2520 delete info; 2521 this._stepchange_info = null; 2522 }; 2523 2524 _pFormBase._searchNextComponent = function (current, bSearchFromFirst, opt_force_cycle, bAccessibility, bhotkey) { 2525 var opt_cycle = (opt_force_cycle == undefined) ? (application._tabkeycirculation == 0) : opt_force_cycle; 2526 var opt_container_focus = nexacro._enableaccessibility && (nexacro._accessibilitytype != 5); 2527 2528 var temp, ret, next; 2529 var my_tapstop_childs = this._getSortedDecendants(this, undefined, bAccessibility); 2530 var my_tabstop_child_cnt = my_tapstop_childs ? my_tapstop_childs.length : 0; 2531 2532 if (my_tabstop_child_cnt > 0 && current && !bSearchFromFirst) { 2533 next = this._getTabOrderNext(current, true, bAccessibility, undefined, undefined, bhotkey, undefined, true); 2534 2535 if (opt_cycle && !next && this._isPopupVisible()) { 2536 next = this._getTabOrderFirst(bAccessibility); 2537 } 2538 if (!next) { 2539 var parent = this.parent; 2540 var parent_tabstop_childs = parent._getSortedDecendants(this.parent, undefined, bAccessibility); 2541 var parent_tabstop_child_cnt = parent_tabstop_childs ? parent_tabstop_childs.length : 0; 2542 if (!opt_cycle && (parent._is_frame || this._is_window)) { 2543 ret = [null, this, 1]; 2544 } 2545 else if (parent._is_form && parent_tabstop_child_cnt > 0) { 2546 ret = parent._searchNextComponent(this, false, undefined, bAccessibility, bhotkey); 2547 } 2548 else { 2549 next = this._getTabOrderFirst(bAccessibility); 2550 } 2551 } 2552 } 2553 else { 2554 next = this._getTabOrderFirst(bAccessibility); 2555 2556 if (!next) { 2557 if (this.parent._is_form) { 2558 ret = this.parent._searchNextComponent(this, undefined, undefined, bAccessibility, bhotkey); 2559 } 2560 else { 2561 ret = null; 2562 } 2563 } 2564 } 2565 2566 if (next && !ret) { 2567 var next_tabstop_childs = (next._is_form ? next._getSortedDecendants(next, undefined, bAccessibility) : null); 2568 var next_tabstop_child_cnt = next_tabstop_childs ? next_tabstop_childs.length : 0; 2569 if (next._is_form && bAccessibility && next._checkContainerTabFocus() == true) { 2570 ret = [next]; 2571 } 2572 else if (next._is_form && next_tabstop_child_cnt > 0) { 2573 ret = next._searchNextComponent(null, true, undefined, bAccessibility, bhotkey); 2574 } 2575 else { 2576 ret = [next]; 2577 } 2578 } 2579 2580 return ret; 2581 }; 2582 2583 _pFormBase._searchNextTabFocus = function (current, bSearchFromFirst, opt_force_cycle, bAccessibility, bhotkey) { 2584 var opt_cycle = (opt_force_cycle == undefined) ? (application._tabkeycirculation == 0) : opt_force_cycle; 2585 var opt_container_focus = nexacro._enableaccessibility && (nexacro._accessibilitytype != 5); 2586 2587 var temp, ret, next; 2588 var my_tapstop_childs = this._getSortedDecendants(this, undefined, bAccessibility); 2589 var my_tabstop_child_cnt = my_tapstop_childs ? my_tapstop_childs.length : 0; 2590 2591 if (my_tabstop_child_cnt > 0 && current && !bSearchFromFirst) { 2592 next = this._getTabOrderNext(current, true, bAccessibility, undefined, undefined, bhotkey); 2593 2594 if (opt_cycle && !next && this._isPopupVisible()) { 2595 next = this._getTabOrderFirst(bAccessibility); 2596 } 2597 if (!next) { 2598 var parent = this.parent; 2599 var parent_tabstop_childs = parent._getSortedDecendants(this.parent, undefined, bAccessibility); 2600 var parent_tabstop_child_cnt = parent_tabstop_childs ? parent_tabstop_childs.length : 0; 2601 if (!opt_cycle && (parent._is_frame || this._is_window)) { 2602 ret = [null, this, 1]; 2603 } 2604 else if (parent._is_form && parent_tabstop_child_cnt > 0) { 2605 ret = parent._searchNextTabFocus(this, false, undefined, bAccessibility, bhotkey); 2606 } 2607 else { 2608 next = this._getTabOrderFirst(bAccessibility); 2609 } 2610 } 2611 } 2612 else { 2613 next = this._getTabOrderFirst(bAccessibility); 2614 2615 if (!next) { 2616 if (this.parent._is_form) { 2617 ret = this.parent._searchNextTabFocus(this, undefined, undefined, bAccessibility, bhotkey); 2618 } 2619 else { 2620 ret = null; 2621 } 2622 } 2623 } 2624 2625 if (next && !ret) { 2626 var next_tabstop_childs = (next._is_form ? next._getSortedDecendants(next, undefined, bAccessibility) : null); 2627 var next_tabstop_child_cnt = next_tabstop_childs ? next_tabstop_childs.length : 0; 2628 if (next._is_form && bAccessibility && next._checkContainerTabFocus() == true) { 2629 ret = [next]; 2630 } 2631 else if (next._is_form && next_tabstop_child_cnt > 0) { 2632 ret = next._searchNextTabFocus(null, true, undefined, bAccessibility, bhotkey); 2633 } 2634 else { 2635 ret = [next]; 2636 } 2637 } 2638 2639 return ret; 2640 }; 2641 2642 _pFormBase._searchNextHeadingFocus = function (current, bSearchFromFirst, opt_force_cycle) { 2643 var opt_cycle = (opt_force_cycle == undefined) ? (application._tabkeycirculation == 0) : opt_force_cycle; 2644 var opt_container_focus = nexacro._enableaccessibility; 2645 2646 var temp, ret, next; 2647 var my_tapstop_childs = this._getSortedDecendants(this, undefined, true); 2648 var my_tabstop_child_cnt = my_tapstop_childs ? my_tapstop_childs.length : 0; 2649 if (my_tabstop_child_cnt > 0 && current && !bSearchFromFirst) { 2650 next = this._getHeadingOrderNext(current, 1); 2651 if (opt_cycle && !next && this._isPopupVisible()) { 2652 next = this._getHeadingOrderFirst(); 2653 } 2654 if (!next) { 2655 var parent = this.parent; 2656 var parent_tabstop_childs = parent._getSortedDecendants(this.parent, undefined, true); 2657 var parent_tabstop_child_cnt = parent_tabstop_childs ? parent_tabstop_childs.length : 0; 2658 if (!opt_cycle && (parent._is_frame || this._is_window)) { 2659 ret = [null, this, 1]; 2660 } 2661 else if (parent._is_form && parent_tabstop_child_cnt > 0) { 2662 ret = parent._searchNextHeadingFocus(this); 2663 } 2664 else { 2665 next = this._getHeadingOrderFirst(); 2666 } 2667 } 2668 } 2669 else { 2670 next = this._getHeadingOrderFirst(); 2671 if (!next) { 2672 if (this.parent._is_form) { 2673 ret = this.parent._searchNextHeadingFocus(this); 2674 } 2675 else { 2676 ret = null; 2677 } 2678 } 2679 } 2680 2681 if (next && !ret) { 2682 var next_tabstop_childs = (next._is_form ? next._getSortedDecendants(next, undefined, true) : null); 2683 var next_tabstop_child_cnt = next_tabstop_childs ? next_tabstop_childs.length : 0; 2684 if (next._is_form && next._checkContainerHeadingFocus() == true) { 2685 ret = [next]; 2686 } 2687 else if (next._is_form && next_tabstop_child_cnt > 0) { 2688 ret = next._searchNextHeadingFocus(null, true); 2689 } 2690 else { 2691 ret = [next]; 2692 } 2693 } 2694 2695 return ret; 2696 }; 2697 2698 2699 _pFormBase._searchPrevTabFocus = function (current, bSearchFromLast, opt_force_cycle, bAccessibility, bhotkey) { 2700 var opt_cycle = (opt_force_cycle == undefined) ? (application._tabkeycirculation == 0) : opt_force_cycle; 2701 var opt_container_focus = nexacro._enableaccessibility && (nexacro._accessibilitytype != 5); 2702 2703 var temp, ret, next; 2704 var my_tapstop_childs = this._getSortedDecendants(this, undefined, bAccessibility); 2705 var my_tabstop_child_cnt = my_tapstop_childs ? my_tapstop_childs.length : 0; 2706 if (my_tabstop_child_cnt && current && !bSearchFromLast) { 2707 next = this._getTabOrderNext(current, -1, bAccessibility, undefined, undefined, bhotkey); 2708 if (opt_cycle && !next && this._isPopupVisible()) { 2709 next = this._getTabOrderLast(bAccessibility); 2710 } 2711 2712 if (!next) { 2713 var parent_tabstop_childs = this.parent._getSortedDecendants(this.parent, undefined, bAccessibility); 2714 var parent_tabstop_child_cnt = parent_tabstop_childs ? parent_tabstop_childs.length : 0; 2715 var parent_comps = this.parent.components; 2716 if (opt_cycle == false && (this.parent._is_frame || this._is_window)) {
2717 ret = [null, this, -1]; 2718 } 2719 else if (bAccessibility && this._checkContainerTabFocus() == true && this.parent._is_form) { 2720 ret = [this]; 2721 } 2722 else if (this.parent._is_form && parent_tabstop_child_cnt > 0) { 2723 ret = this.parent._searchPrevTabFocus(this, undefined, undefined, bAccessibility, bhotkey); 2724 } 2725 else { 2726 next = this._getTabOrderLast(bAccessibility); 2727 } 2728 } 2729 } 2730 else { 2731 if (!bSearchFromLast) { 2732 if (this instanceof nexacro.PopupDiv) { 2733 next = this._getTabOrderLast(bAccessibility); 2734 } 2735 else if (this.parent._is_form) { 2736 ret = this.parent._searchPrevTabFocus(this, undefined, undefined, bAccessibility, bhotkey); 2737 } 2738 else { 2739 ret = null; 2740 } 2741 } 2742 2743 if (!ret) { 2744 next = this._getTabOrderLast(bAccessibility); 2745 if (!next && ret !== null) { 2746 if (bAccessibility && opt_container_focus && this._checkContainerTabFocus() == true) { 2747 ret = [this]; 2748 } 2749 else if (this.parent._is_form) { 2750 ret = this.parent._searchPrevTabFocus(this, undefined, undefined, bAccessibility, bhotkey); 2751 } 2752 else { 2753 ret = null; 2754 } 2755 } 2756 } 2757 } 2758 2759 if (next && !ret) { 2760 var next_tabstop_childs = (next._is_form ? next._getSortedDecendants(next, undefined, bAccessibility) : null); 2761 var next_tabstop_child_cnt = next_tabstop_childs ? next_tabstop_childs.length : 0; 2762 2763 if (next._is_form && next_tabstop_child_cnt > 0) { 2764 ret = next._searchPrevTabFocus(null, true, undefined, bAccessibility, bhotkey); 2765 } 2766 else { 2767 ret = [next]; 2768 } 2769 } 2770 2771 return ret; 2772 }; 2773 2774 2775 _pFormBase._searchPrevHeadingFocus = function (current, bSearchFromLast, opt_force_cycle) { 2776 var opt_cycle = (opt_force_cycle == undefined) ? (application._tabkeycirculation == 0) : opt_force_cycle; 2777 var opt_container_focus = nexacro._enableaccessibility; 2778 2779 var temp, ret, next; 2780 var my_tapstop_childs = this._getSortedDecendants(this, undefined, true); 2781 var my_tabstop_child_cnt = my_tapstop_childs ? my_tapstop_childs.length : 0; 2782 if (my_tabstop_child_cnt && current && !bSearchFromLast) { 2783 next = this._getHeadingOrderNext(current, -1); 2784 2785 if (opt_cycle && !next && this._isPopupVisible()) { 2786 next = this._getHeadingOrderLast(); 2787 } 2788 if (!next) { 2789 var parent_tabstop_childs = this.parent._getSortedDecendants(this.parent, undefined, true); 2790 var parent_tabstop_child_cnt = parent_tabstop_childs ? parent_tabstop_childs.length : 0; 2791 var parent_comps = this.parent.components; 2792 if (opt_cycle == false && (this.parent._is_frame || this._is_window)) { 2793 ret = [null, this, -1]; 2794 } 2795 else if (opt_container_focus && this._type_name == "Tabpage") { 2796 ret = [this.parent]; 2797 } 2798 else if (opt_container_focus && this._checkContainerHeadingFocus() == true) { 2799 ret = [this]; 2800 } 2801 else if (this.parent._is_form && parent_tabstop_child_cnt > 0) { 2802 ret = this.parent._searchPrevHeadingFocus(this); 2803 } 2804 else { 2805 next = this._getHeadingOrderLast(); 2806 } 2807 } 2808 } 2809 else { 2810 if (!bSearchFromLast) { 2811 if (this.parent._is_form) { 2812 ret = this.parent._searchPrevTabFocus(this); 2813 } 2814 else { 2815 ret = null; 2816 } 2817 } 2818 2819 if (!ret) { 2820 next = this._getTabOrderLast(); 2821 if (!next && ret !== null) { 2822 if (this.parent._is_form) { 2823 ret = this.parent._searchPrevHeadingFocus(this); 2824 } 2825 else { 2826 ret = null; 2827 } 2828 } 2829 } 2830 } 2831 2832 if (next && !ret) { 2833 var next_tabstop_childs = (next._is_form ? next._getSortedDecendants(next, undefined, true) : null); 2834 var next_tabstop_child_cnt = next_tabstop_childs ? next_tabstop_childs.length : 0; 2835 if (next._is_form && next_tabstop_child_cnt > 0) { 2836 ret = next._searchPrevHeadingFocus(null, true); 2837 } 2838 else { 2839 ret = [next]; 2840 } 2841 } 2842 2843 return ret; 2844 }; 2845 2846 _pFormBase._processArrowKey = function (bdown, newfocus_comp) { 2847 if (newfocus_comp[0] instanceof nexacro.Form && newfocus_comp[0]._last_focused) { 2848 var win = this._getWindow(); 2849 win._removeFromCurrentFocusPath(newfocus_comp[0]._last_focused); 2850 } 2851 var dir = 2; 2852 if (!bdown) { 2853 dir = 3; 2854 } 2855 newfocus_comp[0]._setFocus(true, dir, false); 2856 if (application.accessibilityfirstovertext && newfocus_comp[0] == this._getTabOrderFirst()) { 2857 var comp = newfocus_comp[0]; 2858 var _label = comp._getAccessibilityReadLabel() + " " + application.accessibilityfirstovertext; 2859 comp.getElement().notifyAccessibility(_label, "focus"); 2860 } 2861 else if (application.accessibilitylastovertext && newfocus_comp[0] == this._getTabOrderLast()) { 2862 var comp = newfocus_comp[0]; 2863 var _label = comp._getAccessibilityReadLabel() + " " + application.accessibilitylastovertext; 2864 comp.getElement().notifyAccessibility(_label, "focus"); 2865 } 2866 }; 2867 2868 _pFormBase._processHotkey = function (keycode, altKey, ctrlKey, shift
2868Key, obj) { 2869 var parent = null; 2870 if (obj) { 2871 parent = obj.parent; 2872 } 2873 2874 var _form = this._getMainForm(); 2875 var hotkey_list = _form ? _form._hotkey_list : this._hotkey_list; 2876 for (var i = 0, n = hotkey_list.length; i < n; i++) { 2877 var hotkey_info = hotkey_list[i]; 2878 if (hotkey_info[1] == keycode && 2879 hotkey_info[2] == altKey && 2880 hotkey_info[3] == ctrlKey && 2881 hotkey_info[4] == shiftKey) { 2882 var comp = hotkey_info[0]; 2883 if (comp.parent instanceof nexacro.Tabpage) { 2884 if (comp.parent._index != comp.parent.parent.tabindex) { 2885 continue; 2886 } 2887 } 2888 2889 2890 if (obj && comp && comp.parent) { 2891 if (obj.name != comp.name || obj.parent.name != comp.parent.name) { 2892 var ctflag = false; 2893 for (var j = (i + 1), n = hotkey_list.length; j < n; j++) { 2894 if ((obj.name == hotkey_list[j][0].name && obj.parent.name == hotkey_list[j][0].parent.name) || (hotkey_list[j][0].parent && obj.parent == hotkey_list[j][0].parent && hotkey_list[j][0].enable)) { 2895 i = (j - 1); 2896 j = hotkey_list.length; 2897 ctflag = true; 2898 } 2899 } 2900 if (ctflag) { 2901 continue; 2902 } 2903 } 2904 } 2905 2906 if (!comp.enable || (comp._isEnable && !comp._isEnable())) { 2907 continue; 2908 } 2909 2910 var p = comp.parent; 2911 do { 2912 if (p instanceof nexacro.FormBase) { 2913 break; 2914 } 2915 2916 p = p.parent; 2917 } while (p); 2918 2919 if (!p.enable) { 2920 return true; 2921 } 2922 2923 2924 comp._on_hotkey(keycode, altKey, ctrlKey, shiftKey); 2925 return true; 2926 } 2927 } 2928 2929 if (this._is_frame && this._is_window && (this._window_type == 1 || this._window_type == 4)) { 2930 return; 2931 } 2932 2933 var owner_frame = this.getOwnerFrame(); 2934 if (owner_frame) { 2935 return owner_frame._processHotkey(keycode, altKey, ctrlKey, shiftKey); 2936 } 2937 }; 2938 2939 _pFormBase._appendBeforeCloseMsg = function (current_message, new_message) { 2940 if (typeof (new_message) == "boolean") { 2941 new_message = nexacro._toString(new_message); 2942 } 2943 2944 if (new_message === undefined || new_message == "" || new_message === null) { 2945 return current_message; 2946 } 2947 2948 if (current_message === undefined || current_message === null) { 2949 current_message = ""; 2950 } 2951 else if (current_message != "") { 2952 current_message += "\n"; 2953 } 2954 2955 return (current_message + new_message); 2956 }; 2957 2958 _pFormBase._checkAndConfirmClose = function (confirm_message) { 2959 if (confirm_message === undefined || confirm_message == "" || confirm_message === null) { 2960 return true; 2961 } 2962 2963 if (this._window && this._window._ignore_close_confirm) { 2964 return true; 2965 } 2966 2967 return nexacro._confirm(this, confirm_message); 2968 }; 2969 2970 _pFormBase._onResetScrollBar = function () { 2971 if (!this._is_scrollable) { 2972 return; 2973 } 2974 2975 var control_elem = this._control_element; 2976 if (control_elem) { 2977 var new_hbar = false; 2978 var new_vbar = false; 2979 2980 var scroll_default_size = nexacro.Component.SCROLLBAR_DEFAULT_SIZE; 2981 var hscroll_size = scroll_default_size; 2982 var vscroll_size = scroll_default_size; 2983 2984 var show_type = 0; 2985 var bShowVScroll = false; 2986 var bShowHScroll = false; 2987 2988 var scrollbars = this._scrollbars; 2989 if (this.getStepCount() > 0 && (scrollbars == 0 || scrollbars == 1 || scrollbars == 4 || scrollbars == 16)) { 2990 scrollbars = 2; 2991 } 2992 2993 switch (scrollbars) { 2994 case 0: 2995 break; 2996 case 1: 2997 bShowVScroll = true; 2998 show_type = 1; 2999 break; 3000 case 2: 3001 bShowHScroll = true; 3002 show_type = 1; 3003 break; 3004 case 3: 3005 bShowVScroll = true; 3006 bShowHScroll = true; 3007 show_type = 1; 3008 break; 3009 case 4: 3010 bShowVScroll = true; 3011 show_type = 2; 3012 break; 3013 case 8: 3014 bShowHScroll = true; 3015 show_type = 2; 3016 break; 3017 case 12: 3018 bShowVScroll = true; 3019 bShowHScroll = true; 3020 show_type = 2; 3021 break; 3022 case 16: 3023 bShowVScroll = true; 3024 bShowHScroll = true; 3025 show_type = 31; 3026 break; 3027 case 32: 3028 bShowVScroll = true; 3029 bShowHScroll = true; 3030 show_type = 32; 3031 break; 3032 } 3033 3034 if (bShowHScroll && !this.hscrollbar) { 3035 this.hscrollbar = this._createHScrollBar(scroll_default_size); 3036 if (this.hscrollbar.scrollbarsize > 0) { 3037 hscroll_size = this.hscrollbar.scrollbarsize; 3038 this.hscrollbar.resize(control_elem.client_width, hscroll_size); 3039 } 3040 new_hbar = true; 3041 } 3042 else if (bShowHScroll && this.hscrollbar) { 3043 if (this.hscrollbar.scrollbarsize > 0) { 3044 hscroll_size = this.hscrollbar.scrollbarsize; 3045 this.hscrollbar.resize(control_elem.client_width, hscroll_size); 3046 control_elem._hscroll_height = hscroll_size; 3047 } 3048 } 3049 else if (!bShowHScroll && this.hscrollbar) { 3050 this.hscrollbar.destroy(); 3051 this.hscrollbar = null; 3052 } 3053 3054 if (bShowVScroll && !this.vscrollbar) { 3055 this.vscrollbar = this._createVScrollBar(scroll_default_size); 3056 if (this.vscrollbar.scrollbarsize > 0) { 3057 vscroll_size = this.vscrollbar.scrollbarsize; 3058 this.vscrollbar.resize(vscroll_size, control_elem.client_height); 3059 } 3060 new_vbar = true; 3061 } 3062 else if (bShowVScroll && this.vscrollbar) { 3063 if (this.vscrollbar.scrollbarsize > 0) { 3064 vscroll_size = this.vscrollbar.scrollbarsize; 3065 this.vscrollbar.resize(vscroll_size, control_elem.client_height); 3066 control_elem._vscroll_width = vscroll_size; 3067 } 3068 } 3069 else if (!bShowVScroll && this.vscrollbar) { 3070 this.vscrollbar.destroy(); 3071 this.vscrollbar = null; 3072 } 3073
3074 control_elem.setScrollControls(this.hscrollbar, this.vscrollbar, hscroll_size, vscroll_size, show_type); 3075 3076 if (new_hbar || this.getStepCount() > 0) { 3077 this.hscrollbar.createComponent(); 3078 } 3079 if (new_vbar) { 3080 this.vscrollbar.createComponent(); 3081 } 3082 3083 if (control_elem._handle) { 3084 if (this.hscrollbar && !this.hscrollbar._is_created) { 3085 this.hscrollbar.on_created(); 3086 } 3087 if (this.vscrollbar && !this.vscrollbar._is_created) { 3088 this.vscrollbar.on_created(); 3089 } 3090 } 3091 3092 this._updateClientSize(control_elem); 3093 } 3094 }; 3095 3096 delete _pFormBase; 3097 3098 nexacro.Form_Style = function (target) { 3099 nexacro.Style.call(this, target); 3100 }; 3101 3102 var _pFormStyle = nexacro._createPrototype(nexacro.Style, nexacro.Form_Style); 3103 nexacro.Form_Style.prototype = _pFormStyle; 3104 3105 eval(nexacro._createAlignAttributeEvalStr("_pFormStyle", "stepalign")); 3106 eval(nexacro._createValueAttributeEvalStr("_pFormStyle", "stepshowtype")); 3107 3108 _pFormStyle.__custom_emptyObject = function () { 3109 this.stepalign = null; 3110 this.stepshowtype = null; 3111 }; 3112 _pFormStyle.__get_custom_style_value = function () { 3113 var val = ""; 3114 if (this.stepalign && !this.stepalign._is_empty) { 3115 val += "stepalign:" + this.stepalign._value + "; "; 3116 } 3117 if (this.stepshowtype && !this.stepshowtype._is_empty) { 3118 val += "stepshowtype:" + this.stepshowtype._value + "; "; 3119 } 3120 return val; 3121 }; 3122 3123 nexacro.Form_CurrentStyle = function () { 3124 nexacro.CurrentStyle.call(this); 3125 this.stepalign = null; 3126 this.stepshowtype = null; 3127 }; 3128 3129 var _pFormCurrentStyle = nexacro._createPrototype(nexacro.CurrentStyle, nexacro.Form_CurrentStyle); 3130 nexacro.Form_CurrentStyle.prototype = _pFormCurrentStyle; 3131 3132 3133 _pFormCurrentStyle.__custom_emptyObject = _pFormStyle.__custom_emptyObject; 3134 _pFormCurrentStyle.__get_custom_style_value = _pFormStyle.__get_custom_style_value; 3135 3136 delete _pFormStyle; 3137 delete _pFormCurrentStyle; 3138 3139 3140 nexacro.Form = function (id, position, left, top, width, height, right, bottom, parent) { 3141 nexacro.FormBase.call(this, id, position, left, top, width, height, right, bottom, parent, true); 3142 3143 this.inheritanceid = ""; 3144 this.layout = ""; 3145 this.opener = null; 3146 this.resizebutton = null; 3147 this.statustext = ""; 3148 this.titletext = ""; 3149 this.classname = ""; 3150 this.cachelevel = ""; 3151 this.version = ""; 3152 this.layoutautofittype = undefined; 3153 this.locale = ""; 3154 3155 3156 this._event_list = { 3157 "onclick" : 1, 3158 "ondblclick" : 1, 3159 "onkillfocus" : 1, 3160 "onsetfocus" : 1, 3161 "onkeypress" : 1, 3162 "onkeydown" : 1, 3163 "onkeyup" : 1, 3164 "onlbuttondown" : 1, 3165 "onlbuttonup" : 1, 3166 "onrbuttondown" : 1, 3167 "onrbuttonup" : 1, 3168 "onmouseenter" : 1, 3169 "onmouseleave" : 1, 3170 "onmousemove" : 1, 3171 "onmousewheel" : 1, 3172 "ondrag" : 1, 3173 "ondragenter" : 1, 3174 "ondragleave" : 1, 3175 "ondragmove" : 1, 3176 "ondrop" : 1, 3177 "onmove" : 1, 3178 "onsize" : 1, 3179 "ontouch" : 1, 3180 "onvscroll" : 1, 3181 "onhscroll" : 1, 3182 "onactivate" : 1, 3183 "onbeforeclose" : 1, 3184 "onclose" : 1, 3185 "ondeactivate" : 1, 3186 "onsyscommand" : 1, 3187 "ontimer" : 1, 3188 "oninit" : 1, 3189 "onload" : 1, 3190 "canlayoutchange" : 1, 3191 "canstepchange" : 1, 3192 "onlayoutchanged" : 1, 3193 "onstepchanged" : 1, 3194 "ondevicebuttonup" : 1, 3195 "ontouchstart" : 1, 3196 "ontouchmove" : 1, 3197 "ontouchend" : 1, 3198 "ontap" : 1, 3199 "ondbltap" : 1, 3200 "onpinchstart" : 1, 3201 "onpinch" : 1, 3202 "onpinchend" : 1, 3203 "onflingstart" : 1, 3204 "onfling" : 1, 3205 "onflingend" : 1, 3206 "onlongpress" : 1, 3207 "onslidestart" : 1, 3208 "onslide" : 1, 3209 "onslideend" : 1, 3210 "onzoom" : 1, 3211 3212 "onorientationchange" : 1 3213 }; 3214 3215 3216 this._url = ""; 3217 this._init_width = 0; 3218 this._init_height = 0; 3219 this._defaultbutton = null; 3220 this._escapebutton = null; 3221 this._accessibility_role = "form"; 3222 this._zoomFactor = undefined; 3223 this._autofittedZoomFactor = undefined; 3224 3225 this._is_init = true; 3226 this._is_closing = false; 3227 }; 3228 3229 var _pForm = nexacro._createPrototype(nexacro.FormBase, nexacro.Form); 3230 nexacro.Form.prototype = _pForm; 3231 3232 _pForm._type_name = "Form"; 3233 3234 nexacro.Form_default_stepshowtype = nexacro._getCachedStyleObj("stepshowtype", "always"); 3235 3236 _pForm.on_create_custom_style = function () { 3237 return new nexacro.Form_Style(this); 3238 }; 3239 3240 _pForm.on_create_custom_currentStyle = function () { 3241 return new nexacro.Form_CurrentStyle(); 3242 }; 3243 3244 _pForm.on_apply_custom_pseudo = function (pseudo) { 3245 var curstyle = this.currentstyle; 3246 var stepalign = this.on_find_CurrentStyle_stepalign(pseudo); 3247 if (curstyle.stepalign != stepalign) { 3248 curstyle.stepalign = stepalign; 3249 this.on_apply_style_stepalign(stepalign); 3250 } 3251 3252 var stepshowtype = this.on_find_CurrentStyle_stepshowtype(pseudo); 3253 if (curstyle.stepshowtype != stepshowtype) { 3254 curstyle.stepshowtype = stepshowtype; 3255 this.on_apply_style_stepshowtype(stepshowtype); 3256 } 3257 }; 3258 3259 _pForm.on_apply_custom_css = function (pseudo) { 3260 var components = this.components; 3261 if (components) { 3262 for (var i = 0, n = components.length; i < n; i++) { 3263 var comp = components[i]; 3264 comp.on_apply_prop_class(comp[i], pseudo); 3265 } 3266 } 3267 }; 3268 _pForm.on_find_CurrentStyle_stepalign = function (pseudo) { 3269 var align = this._find_pseudo_obj("stepalign", pseudo, "align"); 3270 return align ? align : nexacro.Component._default_step_align; 3271 }; 3272 _pForm.on_find_CurrentStyle_stepshowtype = function (pseudo) { 3273 var stepshowtype = this._find_pseudo_obj("stepshowtype", pseudo, "value");
3274 return stepshowtype || nexacro.Form_default_stepshowtype; 3275 }; 3276 3277 _pForm.on_update_style_stepalign = function () { 3278 var align = this.on_find_CurrentStyle_stepalign(this._pseudo); 3279 this.currentstyle.stepalign = align; 3280 this.on_apply_style_stepalign(align); 3281 }; 3282 3283 _pForm.on_update_style_stepshowtype = function () { 3284 var showtype = this.on_find_CurrentStyle_stepshowtype(this._pseudo); 3285 this.currentstyle.stepshowtype = showtype; 3286 this.on_apply_style_stepshowtype(showtype); 3287 }; 3288 3289 _pForm.on_apply_style_stepalign = function (stepalign) { 3290 var control_elem = this.getElement(); 3291 var step_ctrl = this.stepcontrol; 3292 if (control_elem && step_ctrl) { 3293 var form_border = this.on_find_CurrentStyle_border(this._pseudo); 3294 var border_left = (form_border) ? form_border._left_width : 0; 3295 var border_top = (form_border) ? form_border._top_width : 0; 3296 var border_right = (form_border) ? form_border._right_width : 0; 3297 var border_bottom = (form_border) ? form_border._bottom_width : 0; 3298 3299 var form_width = this._adjust_width - border_left - border_right; 3300 var form_height = this._adjust_height - border_top - border_bottom; 3301 3302 var btn_size = step_ctrl._getButtonSize(); 3303 var btn_area = step_ctrl._getButtonAreaSize(step_ctrl.stepcount, btn_size); 3304 3305 var halign = stepalign.halign; 3306 var valign = stepalign.valign; 3307 var left, top; 3308 3309 switch (halign) { 3310 case "left": 3311 left = 0; 3312 break; 3313 case "center": 3314 left = (form_width - btn_area.width) / 2; 3315 break; 3316 case "right": 3317 left = form_width - btn_area.width; 3318 break; 3319 } 3320 3321 switch (valign) { 3322 case "top": 3323 top = 0; 3324 break; 3325 case "middle": 3326 top = (form_height - btn_area.height) / 2; 3327 break; 3328 case "bottom": 3329 top = form_height - btn_area.height; 3330 break; 3331 } 3332 3333 step_ctrl.move(left, top, btn_area.width, btn_area.height, null, null); 3334 } 3335 }; 3336 3337 _pForm.on_apply_style_stepshowtype = function (stepshowtype) { 3338 var stepcontrol = this.stepcontrol; 3339 if (stepcontrol && stepshowtype) { 3340 var type = stepshowtype.value; 3341 switch (type) { 3342 case "action": 3343 stepcontrol.set_visible(false); 3344 break; 3345 case "always": 3346 default: 3347 stepcontrol.set_visible(true); 3348 break; 3349 } 3350 } 3351 }; 3352 _pForm.on_get_style_accessibility_label = function () { 3353 return this.titletext; 3354 }; 3355 3356 _pForm.on_get_prop_tabstop = function () { 3357 return this.tabstop; 3358 }; 3359 3360 3361 _pForm.on_created = function (_window) { 3362 var ret = nexacro.FormBase.prototype.on_created.call(this, _window); 3363 3364 3365 3366 if (this._is_loadcallback && this._is_created) { 3367 this.on_fire_onload(this, this._url); 3368 } 3369 3370 return ret; 3371 }; 3372 3373 _pForm.on_update_position = function (resize_flag, move_flag) { 3374 var control_elem = this._control_element; 3375 if (control_elem) { 3376 var bForce = false; 3377 if (this._isRtl(this.parent) && this._left != null) { 3378 bForce = true; 3379 } 3380 3381 control_elem.setElementPosition(this._adjust_left, this._adjust_top, bForce); 3382 3383 if (resize_flag) { 3384 var val = this._calcScrollMaxSize(); 3385 control_elem.container_maxwidth = val.w; 3386 control_elem.container_maxheight = val.h; 3387 } 3388 3389 control_elem.setElementSize(this._adjust_width, this._adjust_height); 3390 3391 this._updateClientSize(control_elem); 3392 3393 if (move_flag) { 3394 this.on_fire_onmove(this._adjust_left, this._adjust_top); 3395 } 3396 if (resize_flag) { 3397 this.on_fire_onsize(this._adjust_width, this._adjust_height); 3398 } 3399 } 3400 }; 3401 3402 _pForm.on_change_containerRect = function (width, height) { 3403 var _move_scroll = false; 3404 var comps = this.components; 3405 if (nexacro.OS == "Android" && this.vscrollbar && this.vscrollbar.visible) { 3406 _move_scroll = true; 3407 var comp_bottom; 3408 var comp_scroll_pos; 3409 var last_comp = this._getLastFocused(); 3410 var form_bottom = this.getOffsetBottom(); 3411 } 3412 3413 for (var i = 0, n = comps.length; i < n; i++) { 3414 var comp = comps[i]; 3415 var control_elem = comp.getElement(); 3416 if (control_elem) { 3417 if (_move_scroll && comp instanceof nexacro.Edit) { 3418 comp_bottom = comp.getOffsetBottom(); 3419 comp_scroll_pos = comp_bottom - form_bottom; 3420 if (this.vscrollbar.pos < comp_scroll_pos && form_bottom < comp_bottom && last_comp == comp) { 3421 this.vscrollbar.set_pos(comp_scroll_pos); 3422 } 3423 } 3424 comp._bChangeRtl = this._bChangeRtl; 3425 comp.move(comp.left, comp.top, comp.width, comp.height, comp.right, comp.bottom); 3426 comp._bChangeRtl = false; 3427 } 3428 } 3429 3430 if (this.stepcontrol) { 3431 this._updateStepControlSize(); 3432 } 3433 this._onRecalcScrollSize(); 3434 }; 3435 3436 3437 3438 3439 _pForm._on_load = function (obj, url) { 3440 if (!this._load_callbacklist) { 3441 return; 3442 } 3443 3444 var parent_foraddcallback = this.parent; 3445 if (this.parent && this.parent.form == this) { 3446 parent_foraddcallback = application; 3447 } 3448 3449 if (parent_foraddcallback && parent_foraddcallback._addLoadCallbacklist) { 3450 var pthis = this; 3451 var ret = parent_foraddcallback._addLoadCallbacklist({ 3452 target : pthis, 3453 callback : pthis._on_loadcallback, 3454 url : this.url 3455 }); 3456 if (!ret) { 3457 this._on_loadcallback(obj, url); 3458 } 3459 } 3460 }; 3461 3462 _pForm._addLoadCallbacklist = function (item) { 3463 if (!this._is_loaded && this._url && this._url.length > 0) { 3464 if (!this.parent._load_callbacklist) { 3465 this.parent._load_callbacklist = []; 3466 } 3467 this._load_callbacklist.push(item); 3468 return true; 3469 } 3470 return false; 3471 }; 3472 3473 3474 _pForm._on_loadcallback = function (obj, url) { 3475 var callbacklist = this._load_callbacklist; 3476 3477 var n = callbacklist.length, _url; 3478 if (n > 0) { 3479 for (var i = 0; i < n; i++) { 3480 var item = callbacklist[i]; 3481 var target = item.target; 3482 _url = nexacro._makeurl(item.url); 3483 3484 if (target._is_alive != false) { 3485 item.callback.call(target, target, _url); 3486 } 3487 } 3488 callbacklist.splice(0, n); 3489 } 3490 var binds = this.binds; 3491 if (binds) { 3492 for (var i = 0, len = binds.length; i < len; i++) { 3493 binds[i].bind(); 3494 } 3495 } 3496 this.on_fire_oninit(this); 3497 this.createComponent(true); 3498 3499 var _window; 3500 if (!this._is_created) { 3501 this._is_loadcallback = true; 3502 _window = this._getWindow(); 3503 this.on_created(_window); 3504 this._is_loadcallback = false; 3505 } 3506 3507 3508 var ret = false; 3509 3510 3511 if (!(this instanceof nexacro.Tabpage)) { 3512 this._on_activate(); 3513 } 3514 3515 var parent = this.parent; 3516 if (parent) { 3517 if (parent._is_frame && parent.form == this) { 3518 parent._createdForm(); 3519 application._notifyLoadforms(this); 3520 } 3521 else { 3522 if (!_window) { 3523 _window = this._getRootWindow(); 3524 } 3525 3526 if (_window && _window.frame && _window.frame._activate == true) { 3527 var cur_focus_paths = _window.getCurrentFocusPaths(); 3528 if (cur_focus_paths && nexacro._indexOf(cur_focus_paths, this) > -1) { 3529 if (this instanceof nexacro.Tabpage) { 3530 this._on_activate(); 3531 } 3532 3533 if (nexacro._enableaccessibility && nexacro._accessibilitywholereadtype > 1) { 3534 this._setFocus(); 3535 this._playAccessibilityWholeReadLabel("wholeread"); 3536 } 3537 else { 3538 this._on_focus(true); 3539 } 3540 } 3541 else if (nexacro._enableaccessibility && nexacro._accessibilitywholereadtype > 1 && this instanceof nexacro.Div) { 3542 this._playAccessibilityWholeReadLabel("wholeread"); 3543 } 3544 } 3545 } 3546 } 3547 this._refreshAccessibilityValue(); 3548 return ret; 3549 }; 3550 3551 _pForm.set_opener = nexacro._emptyFn; 3552 3553 _pForm.set_inheritanceid = function (v) { 3554 }; 3555 3556 _pForm.set_layout = function (v) { 3557 }; 3558 3559 _pForm.set_statustext = function (v) { 3560 if (this.parent && this.parent._is_frame) { 3561 if (this.statustext != v) { 3562 this.statustext = v; 3563 this.parent._applyStatusText(); 3564 } 3565 } 3566 }; 3567 3568 _pForm.set_titletext = function (v) { 3569 this._setAccessibilityLabel(v); 3570 3571 if (this.parent && this.parent._is_frame) { 3572 if (this.titletext != v) { 3573 this.titletext = v; 3574 this.parent._applyTitleText(); 3575 } 3576 } 3577 }; 3578 3579 _pForm.set_classname = function (v) { 3580 return; 3581 }; 3582 3583 _pForm.set_cachelevel = function (v) { 3584 }; 3585 3586 _pForm.set_version = function (v) { 3587 ; 3588 }; 3589 3590 3591 _pForm.set_dragscrolltype = function (v) { 3592 var enums = ["none", "vert", "horz", "both", "all"]; 3593 if (this.dragscrolltype != v) { 3594 if (nexacro._indexOf(enums, v) >= 0) { 3595 this.dragscrolltype = v; 3596 } 3597 else { 3598 } 3599 } 3600 }; 3601 3602 _pForm.set_layoutautofittype = function (v) { 3603 return; 3604 }; 3605 3606 _pForm.on_apply_prop_enable = function (v) { 3607 nexacro.Component.prototype.on_apply_prop_enable.call(this, v); 3608 3609 var comps = this.components; 3610 3611 var root_form = this._getRootForm(); 3612 var binds = root_form.binds; 3613 3614 for (var i = 0, n = comps.length; i < n; i++) { 3615 var comp = comps[i]; 3616 3617 if (binds) { 3618 var skip = false; 3619 for (var idx = 0, bind_len = binds.length; idx < bind_len; idx++) { 3620 var item_comp = binds[idx]._comp; 3621 if (item_comp == comp && binds[idx]._en_type == 2) { 3622 skip = true; 3623 var dataset = binds[idx]._dataset; 3624 if (dataset.rowposition != -1) { 3625 comp._setEnable(v); 3626 } 3627 break; 3628 } 3629 } 3630 3631 if (!skip) { 3632 comp._setEnable(v); 3633 } 3634 } 3635 else { 3636 comp._setEnable(v); 3637 } 3638 } 3639 }; 3640 3641 _pForm.on_apply_prop_rtldirection = function () { 3642 this._bChangeRtl = true; 3643 3644 nexacro.Component.prototype.on_apply_prop_rtldirection.call(this); 3645 3646 var control_elem = this._control_element; 3647 if (control_elem) { 3648 if (nexacro._isDesktop()) { 3649 this.on_change_containerRect(control_elem.client_width, control_elem.client_height); 3650 } 3651 } 3652 3653 var comps = this.components; 3654 var _rtldirection = this._rtldirection; 3655 3656 for (var i = 0, n = comps.length; i < n; i++) { 3657 var comp = comps[i]; 3658 if (comp._is_form) { 3659 comp.on_apply_prop_rtldirection(_rtldirection); 3660 } 3661 comp._setRtlDirection(_rtldirection); 3662 } 3663 3664 if (this.vscrollbar) { 3665 this.vscrollbar._setRtlDirection(_rtldirection); 3666 } 3667 if (this.hscrollbar) { 3668 this.hscrollbar._setRtlDirection(_rtldirection); 3669 } 3670 3671 if (this.stepcontrol) { 3672 this.stepcontrol._setRtlDirection(_rtldirection); 3673 } 3674 3675 this._bChangeRtl = false; 3676 }; 3677 3678 _pForm.set_locale = function (v) { 3679 if (v != this.locale) { 3680 this.locale = v; 3681 if (this._locale != v) { 3682 this._locale = v; 3683 this.on_apply_locale(); 3684 } 3685 } 3686 }; 3687 3688 _pForm.on_apply_locale = function () { 3689 var comps = this.components; 3690 3691 for (var i = 0, n = comps.length; i < n; i++) { 3692 var comp = comps[i]; 3693 comp._setLocale(this._locale); 3694 } 3695 }; 3696 3697 3698 _pForm.on_fire_sys_onrbuttonup = function (button, alt_key, ctrl_key, shift_key, screenX, screenY, canvasX, canvasY, clientX, clientY, from_comp, from_refer_comp) { 3699 var ret = nexacro.Component.prototype.on_fire_sys_onrbuttonup.call(this, button, alt_key, ctrl_key, shift_key, screenX, screenY, canvasX, canvasY, clientX, clientY, from_comp, from_refer_comp); 3700 3701 if (application._quickview_mode && ret !== true && this.parent instanceof nexacro.ChildFrame) { 3702 if (from_refer_comp && !from_refer_comp._input_element) { 3703 return nexacro._showQuickviewMenu(this, screenX, screenY); 3704 } 3705 } 3706 return ret; 3707 }; 3708 3709 3710 _pForm.on_fire_oninit = function (obj) { 3711 if (this._is_init && this.oninit && this.oninit._has_handlers) { 3712 this._is_init = false; 3713 var evt = new nexacro.Event(obj, "oninit"); 3714 return this.oninit._fireEvent(this, evt); 3715 } 3716 return true; 3717 }; 3718 3719 _pForm.on_fire_canstepchange = function (obj) { 3720 if (this.canstepchange && this.canstepchange._has_handlers) {
3721 var evt = new nexacro.StepChangeEventInfo(obj, "canstepchange", obj._prestepindex, obj._poststepindex); 3722 return this.canstepchange._fireCheckEvent(this, evt); 3723 } 3724 }; 3725 3726 _pForm.on_fire_onstepchanged = function (obj) { 3727 if (this.onstepchanged && this.onstepchanged._has_handlers) { 3728 var evt = new nexacro.StepChangeEventInfo(obj, "onstepchanged", obj._prestepindex, obj._poststepindex); 3729 return this.onstepchanged._fireEvent(this, evt); 3730 } 3731 }; 3732 3733 _pForm.on_fire_canlayoutchange = function (obj, eventid, curlayoutname, newlayoutname, curlayoutwidth, newlayoutwidth, curlayoutheight, newlayoutheight) { 3734 if (this.canlayoutchange && this.canlayoutchange._has_handlers) { 3735 var evt = new nexacro.LayoutChangeEventInfo(obj, eventid, curlayoutname, newlayoutname, curlayoutwidth, newlayoutwidth, curlayoutheight, newlayoutheight); 3736 return this.canlayoutchange._fireCheckEvent(this, evt); 3737 } 3738 return true; 3739 }; 3740 3741 _pForm.on_fire_onlayoutchanged = function (obj, eventid, curlayoutname, newlayoutname, curlayoutwidth, newlayoutwidth, curlayoutheight, newlayoutheight) { 3742 if (this.onlayoutchanged && this.onlayoutchanged._has_handlers) { 3743 var evt = new nexacro.LayoutChangeEventInfo(obj, eventid, curlayoutname, newlayoutname, curlayoutwidth, newlayoutwidth, curlayoutheight, newlayoutheight); 3744 return this.onlayoutchanged._fireEvent(this, evt); 3745 } 3746 return true; 3747 }; 3748 3749 _pForm.on_fire_onbeforelayoutchange = function (obj, eventid, curlayout, newlayout) { 3750 if (this.onbeforelayoutchange && this.onbeforelayoutchange._has_handlers) { 3751 var evt = new nexacro.LayoutChangeEventInfo(obj, eventid, curlayout, newlayout); 3752 return this.onbeforelayoutchange._fireEvent(this, evt); 3753 } 3754 return true; 3755 }; 3756 3757 _pForm.on_fire_onload = function (obj, url) { 3758 if (this.onload && this.onload._has_handlers) { 3759 this._bFireLoadEvent = true; 3760 var evt = new nexacro.LoadEventInfo(obj, "onload", url); 3761 var ret = this.onload._fireEvent(this, evt); 3762 this._bFireLoadEvent = false; 3763 evt.destroy(); 3764 evt = null; 3765 return ret; 3766 } 3767 return true; 3768 }; 3769 3770 _pForm.on_fire_ondevicebuttonup = function (obj, e) { 3771 if (this.ondevicebuttonup && this.ondevicebuttonup._has_handlers) { 3772 var evt = new nexacro.DeviceButtonEventInfo(obj, e); 3773 return this.ondevicebuttonup._fireEvent(this, evt); 3774 } 3775 return true; 3776 }; 3777 3778 _pForm._on_devicebuttonup = function (e) { 3779 var ret = this.on_fire_ondevicebuttonup(this, e); 3780 if (!ret && this.parent && this.parent instanceof nexacro.Form) { 3781 return this.parent._on_devicebuttonup(e); 3782 } 3783 return ret; 3784 }; 3785 3786 3787 _pForm.on_fire_user_onkeydown = function (keycode, alt_key, ctrl_key, shift_key, fire_comp, refer_comp) { 3788 if (!this._is_alive) { 3789 return; 3790 } 3791 3792 var focusedComp = refer_comp; 3793 3794 if (!focusedComp) { 3795 focusedComp = this.getFocus(); 3796 } 3797 if (!focusedComp) { 3798 focusedComp = this; 3799 } 3800 if (focusedComp) { 3801 focusedComp = focusedComp._getRootComponent(focusedComp); 3802 } 3803 3804 var dlgc = focusedComp._getDlgCode(keycode, alt_key, ctrl_key, shift_key); 3805 3806 if (keycode == nexacro.Event.KEY_TAB) { 3807 if (dlgc.want_tab == false) { 3808 var newfocus_comp; 3809 3810 var root_window = this._getRootWindow(); 3811 if (root_window._keydown_element) { 3812 root_window._keydown_element._event_stop = true; 3813 } 3814 3815 if (nexacro._enableaccessibility) { 3816 var ret = nexacro.Component.prototype.on_fire_user_onkeydown.call(this, keycode, alt_key, ctrl_key, shift_key, this, this._last_focused); 3817 } 3818 3819 3820 if (!shift_key) { 3821 newfocus_comp = this._searchNextTabFocus(this._last_focused, undefined, undefined, false); 3822 } 3823 else { 3824 newfocus_comp = this._searchPrevTabFocus(this._last_focused, undefined, undefined, false); 3825 } 3826 3827 if (newfocus_comp && newfocus_comp[0]) { 3828 if (newfocus_comp[0] instanceof nexacro.Form && newfocus_comp[0]._last_focused) { 3829 var win = this._getWindow(); 3830 win._removeFromCurrentFocusPath(newfocus_comp[0]._last_focused); 3831 } 3832 3833 newfocus_comp[0]._setFocus(true, (!shift_key ? 0 : 1), true); 3834 } 3835 else if (newfocus_comp && newfocus_comp[2] == -1) { 3836 var comp = this._last_focused; 3837 if (comp) { 3838 comp.getElement().notifyAccessibility(application.accessibilityfirstovertext); 3839 } 3840 } 3841 else if (newfocus_comp && newfocus_comp[2] == 1) { 3842 var comp = this._last_focused; 3843 if (comp) { 3844 comp.getElement().notifyAccessibility(application.accessibilitylastovertext); 3845 } 3846 } 3847 3848 return true; 3849 } 3850 } 3851 else if (keycode == nexacro.Event.KEY_RETURN) { 3852 if (dlgc.want_return == false) { 3853 if (this instanceof nexacro.Form) { 3854 var is_popup = focusedComp._isPopupVisible(); 3855 if (!is_popup && this._defaultbutton && this._defaultbutton.enableevent && this._defaultbutton._isEnable()) { 3856 this._defaultbutton.click(); 3857 } 3858 } 3859 } 3860 } 3861 else if (keycode == nexacro.Event.KEY_ESC) { 3862 if (nexacro._stopTransaction(this, 1) <= 0 && dlgc.want_escape == false) { 3863 if (this instanceof nexacro.Form) { 3864 if (this._escapebutton && this._escapebutton.enableevent && this._escapebutton._isEnable()) { 3865 this._escapebutton.click(); 3866 } 3867 } 3868 } 3869 } 3870 else if (nexacro._enableaccessibility && keycode == nexacro.Event.KEY_DOWN) { 3871 if (dlgc.want_arrows == false) { 3872 var ret = nexacro.Component.prototype.on_fire_user_onkeydown.call(this, keycode, alt_key, ctrl_key, shift_key, this, this._last_focused); 3873 3874 var newfocus_comp = this._searchNextTabFocus(this._last_focused, undefined, undefined, true); 3875 if (newfocus_comp && newfocus_comp[0]) { 3876 if (newfocus_comp[0] instanceof nexacro.Form && newfocus_comp[0]._last_focused) { 3877 var win = this._getWindow(); 3878 win._removeFromCurrentFocusPath(newfocus_comp[0]._last_focused); 3879 } 3880 newfocus_comp[0]._setFocus(true, 2, true); 3881 } 3882 var root_window = this._getRootWindow(); 3883 root_window._keydown_element._event_stop = true; 3884 return true; 3885 } 3886 } 3887 else if (nexacro._enableaccessibility && keycode == nexacro.Event.KEY_UP) { 3888 if (dlgc.want_arrows == false) { 3889 var ret = nexacro.Component.prototype.on_fire_user_onkeydown.call(this, keycode, alt_key, ctrl_key, shift_key, this, this._last_focused); 3890 3891 var newfocus_comp = this._searchPrevTabFocus(this._last_focused, undefined, undefined, true); 3892 if (newfocus_comp && newfocus_comp[0]) { 3893 if (newfocus_comp[0] instanceof nexacro.Form && newfocus_comp[0]._last_focused) { 3894 var win = this._getWindow(); 3895 win._removeFromCurrentFocusPath(newfocus_comp[0]._last_focused); 3896 } 3897 newfocus_comp[0]._setFocus(true, 3, true); 3898 } 3899 var root_window = this._getRootWindow(); 3900 root_window._keydown_element._event_stop = true; 3901 return true; 3902 } 3903 } 3904 3905 var ret = nexacro.Component.prototype.on_fire_user_onkeydown.call(this, keycode, alt_key, ctrl_key, shift_key, this, refer_comp); 3906 3907 if (!this.onkeydown || (this.onkeydown && !this.onkeydown.defaultprevented)) { 3908 if (keycode == nexacro.Event.KEY_LEFT || keycode == nexacro.Event.KEY_RIGHT) { 3909 if (this.hscrollbar && this.hscrollbar.visible && ctrl_key == true) { 3910 if (dlgc.want_arrows == false) { 3911 var line = this.hscrollbar.line; 3912 if (line <= 0) { 3913 line = this.hscrollbar._linedown; 3914 } 3915 if (keycode == nexacro.Event.KEY_LEFT) { 3916 line *= -1; 3917 } 3918 this.hscrollbar.set_pos(this.hscrollbar.pos + line); 3919 return true; 3920 } 3921 } 3922 } 3923 else if (keycode == nexacro.Event.KEY_UP || keycode == nexacro.Event.KEY_DOWN) { 3924 if (this.vscrollbar && this.vscrollbar.visible && ctrl_key == true) { 3925 if (dlgc.want_arrows == false) { 3926 var line = this.vscrollbar.line; 3927 if (line <= 0) { 3928 line = this.vscrollbar._linedown; 3929 } 3930 if (keycode == nexacro.Event.KEY_UP) { 3931 line *= -1; 3932 } 3933 3934 this.vscrollbar.set_pos(this.vscrollbar.pos + line); 3935 return true; 3936 } 3937 } 3938 } 3939 } 3940 3941 return ret; 3942 }; 3943 3944 _pForm._on_activate = function () { 3945 if (!this.parent) { 3946 return; 3947 } 3948 3949 var owner_frame = this.getOwnerFrame(); 3950 if (!owner_frame || !owner_frame._activate) { 3951 return; 3952 } 3953 3954 nexacro.FormBase.prototype._on_activate.call(this); 3955 }; 3956 3957 _pForm._on_deactivate = function () { 3958 if (!this.parent) { 3959 return; 3960 } 3961 3962 var owner_frame = this.getOwnerFrame(); 3963 if (!owner_frame || !owner_frame._activate) { 3964 return; 3965 } 3966 3967 nexacro.FormBase.prototype._on_deactivate.call(this); 3968 }; 3969 3970 _pForm._refresh_input_comp = function (child_list, is_focus) { 3971 if ((nexacro.OS == "iOS" && !nexacro._isHybrid()) || (nexacro.Browser == "IE" || nexacro.Browser == "Edge" || nexacro.Browser == "MobileSafari")) { 3972 var child_list_len = child_list ? child_list.length : 0; 3973 for (var i = 0; i < child_list_len; i++) { 3974 var child_comp = child_list[i]; 3975 if (child_comp) { 3976 if (child_comp instanceof nexacro.TextArea && child_comp.value) { 3977 if (is_focus) { 3978 if (child_comp._input_element) { 3979 child_comp._input_element._refreshElement1(is_focus); 3980 } 3981 } 3982 else { 3983 (function (c1) { 3984 setTimeout(function () { 3985 if (c1 && c1._input_element) { 3986 c1._input_element._refreshElement1(); 3987 } 3988 }, 100); 3989 })(child_comp); 3990 } 3991 } 3992 else if (child_comp instanceof nexacro.Div) { 3993 this._refresh_input_comp(child_comp._child_list, is_focus); 3994 } 3995 } 3996 } 3997 } 3998 }; 3999 4000 _pForm._refresh_input_components = function () { 4001 if ((nexacro.OS == "iOS" && !nexacro._isHybrid()) || (nexacro.Browser == "IE" || nexacro.Browser == "Edge" || nexacro.Browser == "MobileSafari")) { 4002 var comp = this._last_focused ? this._last_focused : this; 4003 4004 while (comp) { 4005 if (comp instanceof nexacro.FormBase) { 4006 if (comp._last_focused) { 4007 comp = comp._last_focused; 4008 } 4009 else { 4010 break; 4011 } 4012 } 4013 else { 4014 break; 4015 } 4016 } 4017 4018 if (comp && (comp._has_inputElement || comp instanceof nexacro.Grid)) { 4019 var edit_base = null; 4020 if (comp instanceof nexacro.Grid) { 4021 edit_base = comp._tempEditor ? comp._tempEditor._edit_base_api : null; 4022 } 4023 else { 4024 edit_base = comp._edit_base_api; 4025 } 4026 if (edit_base && !edit_base._is_composition()) { 4027 if (nexacro.OSVersion >= 10 && (nexacro.Browser == "Edge" || nexacro.Browser == "IE")) { 4028 if (comp instanceof nexacro.TextArea) { 4029 edit_base.comp._input_element._refreshElement1(true); 4030 edit_base.comp._input_element.setElementSetSelect(edit_base._begin_pos, edit_base._end_pos); 4031 } 4032 else { 4033 edit_base.comp._input_element._refreshElement(); 4034 } 4035 } 4036 else { 4037 edit_base.comp._input_element._refreshElement(); 4038 } 4039 } 4040 } 4041 else if (comp && comp instanceof nexacro.FileUpload) { 4042 if (comp._items) { 4043 var item = comp._items[comp.index]; 4044 if (item) { 4045 item.fileitemedit._input_element._refreshElement(); 4046 } 4047 } 4048 } 4049 else { 4050 } 4051 } 4052 }; 4053 _pForm.on_vscroll = function (obj, e) { 4054 if (this.onvscroll && this.onvscroll._has_handlers) { 4055 e.fromobject = this; 4056 this.onvscroll._fireEvent(this, e); 4057 } 4058 4059 var control_elem = this._control_element; 4060 var limit_pos = 0; 4061 4062 if (control_elem) { 4063 if (control_elem.scroll_top == control_elem.vscroll_limit && 4064 e.pos >= control_elem.scroll_top) { 4065 return true; 4066 } 4067 else { 4068 limit_pos = control_elem.vscroll_limit; 4069 control_elem.setElementVScrollPos(e.pos); 4070 } 4071 } 4072 4073 if (e.pos >= limit_pos) { 4074 return true; 4075 } 4076 4077 this._refresh_input_components(); 4078 4079 return true; 4080 }; 4081 4082 _pForm.on_hscroll = function (obj, e) { 4083 if (this.onhscroll && this.onhscroll._has_handlers) { 4084 e.fromobject = this; 4085 this.onhscroll._fireEvent(this, e); 4086 } 4087 4088 var control_elem = this._control_element; 4089 if (control_elem) { 4090 control_elem.setElementHScrollPos(e.pos); 4091 } 4092 4093 this._refresh_input_components(); 4094 4095 return true; 4096 }; 4097 4098 _pForm._on_orientationchange = function (orientation) { 4099 this.on_fire_onorientationchange(orientation); 4100 }; 4101 4102 _pForm.on_fire_onorientationchange = function (orientation) { 4103 if (this.onorientationchange && this.onorientationchange._has_handlers) { 4104 var evt = new nexacro.OrientationChangeEventInfo(this, "onorientationchange", orientation); 4105 this.onorientationchange._fireEvent(this, evt); 4106 } 4107 }; 4108 4109 _pForm.on_fire_sys_onaccessibilitygesture = function (direction, fire_comp, refer_comp) { 4110 if (!this._is_alive) { 4111 return; 4112 } 4113 4114 var _window = this._getWindow(); 4115 var accessibility_focus_comp = refer_comp; 4116 var comp = null; 4117 4118 if (!accessibility_focus_comp) { 4119 accessibility_focus_comp = this.getFocus(); 4120 } 4121 4122 if (!accessibility_focus_comp) { 4123 accessibility_focus_comp = this; 4124 } 4125 4126 if (accessibility_focus_comp) { 4127 accessibility_focus_comp = accessibility_focus_comp._getRootComponent(accessibility_focus_comp); 4128 } 4129 4130 if (!direction) { 4131 comp = this._searchPrevTabFocus(_window._accessibility_last_focused_comp, undefined, undefined, true); 4132 4133 while (comp && comp[0] && comp[0]._is_form) { 4134 if (comp[0] == this) { 4135 var new_comp = comp[0].parent._searchPrevTabFocus(comp[0], undefined, undefined, true); 4136 } 4137 4138 if (new_comp && new_comp[0]) { 4139 if (comp[0] == new_comp[0]) { 4140 comp = new_comp; 4141 break; 4142 } 4143 comp = new_comp; 4144 } 4145 else { 4146 break; 4147 } 4148 } 4149 } 4150 else { 4151 comp = this._searchNextTabFocus(_window._accessibility_last_focused_comp, undefined, undefined, true); 4152 4153 while (comp && comp[0] && comp[0]._is_form) { 4154 var my_tapstop_childs = this._getSortedDecendants(comp[0], undefined, true); 4155 var my_tapstop_childs_cnt = my_tapstop_childs ? my_tapstop_childs.length : 0; 4156 if (my_tapstop_childs_cnt == 0) { 4157 break; 4158 } 4159 4160 var new_comp = this._searchNextTabFocus(comp[0], undefined, undefined, true); 4161 4162 if (comp[0] == new_comp[0]) { 4163 comp = new_comp; 4164 break; 4165 } 4166 comp = new_comp; 4167 } 4168 } 4169 4170 if (comp && comp[0]) { 4171 comp[0]._setAccessibilityNotifyEvent(direction); 4172 return true; 4173 } 4174 4175 return false; 4176 }; 4177 4178 4179 4180 _pForm.addChild = function (id, obj) { 4181 var ret = -1; 4182 4183 if (id && id.length <= 0) { 4184 return -1; 4185 } 4186 if (!obj) { 4187 throw nexacro.MakeReferenceError(this, "reference_not_define", id); 4188 } 4189 4190 if (this[id]) { 4191 throw nexacro.MakeNativeError(this, "native_exist_id", id); 4192 } 4193 4194 obj.parent = this; 4195 obj._refform = this; 4196 4197 this[id] = obj;
4198 this.all.add_item(id, obj); 4199 obj.id = id; 4200 4201 if (this.visible && !this._real_visible) { 4202 obj._real_visible = false; 4203 } 4204 else { 4205 obj._real_visible = this.visible; 4206 } 4207 4208 if (obj._is_component) { 4209 ret = this.components.add_item(id, obj); 4210 this._child_list.push(obj); 4211 if (obj._is_alive && obj._is_created && this._is_created) { 4212 this._control_element.appendChildElement(obj.getElement()); 4213 } 4214 4215 obj._setRtlDirection(this._rtldirection); 4216 } 4217 else if (obj instanceof nexacro.BindItem) { 4218 ret = this.binds.add_item(id, obj); 4219 } 4220 else { 4221 ret = this.objects.add_item(id, obj); 4222 } 4223 return ret; 4224 }; 4225 4226 _pForm.resetScroll = function () { 4227 this._onRecalcScrollSize(); 4228 this._onResetScrollBar(); 4229 }; 4230 4231 _pForm.close = function (arg) { 4232 if (this._is_closing) { 4233 return; 4234 } 4235 this._is_closing = true; 4236 if (!this.parent || !this.parent._is_frame) { 4237 return; 4238 } 4239 4240 this.setWaitCursor(false, null); 4241 4242 var childframe = this.parent; 4243 4244 var confirm_message = childframe._on_beforeclose(); 4245 if (childframe._checkAndConfirmClose(confirm_message) == false) { 4246 this._is_closing = false; 4247 return false; 4248 } 4249 4250 if (childframe._window) { 4251 childframe._window._ignore_close_confirm = true; 4252 } 4253 4254 childframe._on_close(); 4255 4256 if (typeof (arg) == "object") { 4257 arg = null; 4258 } 4259 4260 if (this.parent) { 4261 this.parent._closeForm(arg); 4262 } 4263 this._is_closing = false; 4264 }; 4265 4266 _pForm.getFirstComponent = function (no_composite_flag) { 4267 if (no_composite_flag !== true) { 4268 no_composite_flag = false; 4269 } 4270 4271 var first = this._getTabOrderFirst(false, false); 4272 if (no_composite_flag) { 4273 if (first._is_form) { 4274 return first._getTabOrderFirst(false, false); 4275 } 4276 } 4277 return first; 4278 }; 4279 4280 _pForm.getLastComponent = function (no_composite_flag) { 4281 if (no_composite_flag !== true) { 4282 no_composite_flag = false; 4283 } 4284 4285 var last = this._getTabOrderLast(false, false); 4286 if (no_composite_flag) { 4287 if (last._is_form) { 4288 return last._getTabOrderLast(false, false); 4289 } 4290 } 4291 return last; 4292 }; 4293 4294 _pForm.getNextComponent = function (comp, no_composite_flag) { 4295 if (no_composite_flag !== true) { 4296 no_composite_flag = false; 4297 } 4298 4299 var pThis = comp.parent; 4300 var next = pThis._getTabOrderNext(comp, 1, false, false, undefined, undefined, undefined, undefined, no_composite_flag); 4301 4302 if (!next) { 4303 next = pThis._searchNextComponent(comp, undefined, undefined, false)[0]; 4304 } 4305 4306 return next; 4307 }; 4308 4309 _pForm.getPrevComponent = function (comp, no_composite_flag) { 4310 if (no_composite_flag !== true) { 4311 no_composite_flag = false; 4312 } 4313 4314 var pThis = comp.parent; 4315 var prev = pThis._getTabOrderNext(comp, -1, false, false); 4316 if (no_composite_flag) { 4317 pThis = prev; 4318 if (prev._is_form) { 4319 var prev_c = prev._getTabOrderNext(comp, -1, false, false); 4320 if (prev_c) { 4321 return prev_c; 4322 } 4323 prev_c = prev._getTabOrderLast(false, false); 4324 if (prev_c) { 4325 return prev_c; 4326 } 4327 } 4328 } 4329 return prev; 4330 }; 4331 4332 _pForm.getFirstAccessibilityComponent = function (no_composite_flag) { 4333 if (no_composite_flag !== true) { 4334 no_composite_flag = false; 4335 } 4336 4337 var first = this._getTabOrderFirst(true, false); 4338 if (!first._isAccessibilityEnable()) { 4339 first = this.getNextAccessibilityComponent(first, no_composite_flag); 4340 } 4341 if (no_composite_flag) { 4342 if (first._is_form) { 4343 return first._getTabOrderFirst(true, false); 4344 } 4345 } 4346 return first; 4347 }; 4348 4349 _pForm.getLastAccessibilityComponent = function (no_composite_flag) { 4350 if (no_composite_flag !== true) { 4351 no_composite_flag = false; 4352 } 4353 4354 var last = this._getTabOrderLast(true, false); 4355 if (!last._isAccessibilityEnable()) { 4356 last = this.getPrevAccessibilityComponent(last, no_composite_flag); 4357 } 4358 if (no_composite_flag) { 4359 if (last._is_form) { 4360 return last._getTabOrderLast(true, false); 4361 } 4362 } 4363 return last; 4364 }; 4365 4366 _pForm.getNextAccessibilityComponent = function (comp, no_composite_flag) { 4367 if (no_composite_flag !== true) { 4368 no_composite_flag = false; 4369 } 4370 if (comp) { 4371 var pThis = comp.parent; 4372 var next = pThis._getTabOrderNext(comp, 1, true, false); 4373 if (next == undefined && !nexacro._enableaccessibility) { 4374 next = pThis.getFirstComponent(no_composite_flag); 4375 } 4376 if (no_composite_flag) { 4377 pThis = next; 4378 if (next._is_form) { 4379 var next_c = next._getTabOrderNext(comp, 1, true, false); 4380 if (next_c) { 4381 return next_c; 4382 } 4383 next_c = next._getTabOrderFirst(true, false); 4384 if (next_c) { 4385 return next_c; 4386 } 4387 } 4388 } 4389 return next; 4390 } 4391 return undefined; 4392 }; 4393 4394 _pForm.getPrevAccessibilityComponent = function (comp, no_composite_flag) { 4395 if (no_composite_flag !== true) { 4396 no_composite_flag = false; 4397 } 4398 4399 if (comp) { 4400 var pThis = comp.parent; 4401 var prev = pThis._getTabOrderNext(comp, -1, true, false); 4402 if (prev == undefined && !nexacro._enableaccessibility) { 4403 prev = pThis.getLastComponent(no_composite_flag); 4404 } 4405 if (no_composite_flag) { 4406 pThis = prev; 4407 if (prev._is_form) { 4408 var prev_c = prev._getTabOrderNext(comp, -1, true, false); 4409 if (prev_c) { 4410 return prev_c; 4411 } 4412 prev_c = prev._getTabOrderLast(true, false); 4413 if (prev_c) { 4414 return prev_c; 4415 } 4416 } 4417 } 4418 return prev; 4419 } 4420 return undefined; 4421 }; 4422 4423 _pForm.getNextEditableComponent = function (comp, edittype, no_composite_flag) { 4424 if (no_composite_flag !== true) { 4425 no_composite_flag = false; 4426 } 4427 if (comp) { 4428 var pThis = comp.parent; 4429 var next = pThis._getTabOrderNext(comp, 1, false, true, edittype, undefined, no_composite_flag); 4430 if (next == undefined) { 4431 next = pThis._getTabOrderNext(comp, 1, false, true, "All", undefined, no_composite_flag); 4432 } 4433 if (next == undefined) { 4434 next = pThis.getFirstEditableComponent(edittype, no_composite_flag); 4435 } 4436 4437 return next; 4438 } 4439 return undefined; 4440 }; 4441 4442 _pForm.getPrevEditableComponent = function (comp, edittype, no_composite_flag) { 4443 if (no_composite_flag !== true) { 4444 no_composite_flag = false; 4445 } 4446 4447 if (comp) { 4448 var pThis = comp.parent; 4449 var prev = pThis._getTabOrderNext(comp, -1, false, true, edittype, undefined, no_composite_flag); 4450 if (prev == undefined) { 4451 prev = pThis._getTabOrderNext(comp, -1, false, true, "All", undefined, no_composite_flag); 4452 } 4453 if (prev == undefined) { 4454 prev = pThis.getLastEditableComponent(edittype, no_composite_flag); 4455 } 4456 4457 return prev; 4458 } 4459 return undefined; 4460 }; 4461 4462 _pForm.getFirstEditableComponent = function (edittype, no_composite_flag) { 4463 if (no_composite_flag !== true) { 4464 no_composite_flag = false; 4465 } 4466 4467 var first = this._getTabOrderFirst(false, true, edittype, no_composite_flag); 4468 if (!first) { 4469 first = this._getTabOrderFirst(false, true, "All", no_composite_flag); 4470 } 4471 return first; 4472 }; 4473 4474 _pForm.getLastEditableComponent = function (edittype, no_composite_flag) { 4475 if (no_composite_flag !== true) { 4476 no_composite_flag = false; 4477 } 4478 4479 var last = this._getTabOrderLast(false, true, edittype, no_composite_flag); 4480 if (!last) { 4481 last = this._getTabOrderLast(false, true, "All", no_composite_flag); 4482 } 4483 return last; 4484 }; 4485 4486 _pForm._getNextHeadingComponent = function (current) { 4487 var arcomp = this._searchNextHeadingFocus(current); 4488 if (arcomp) { 4489 return arcomp[0]; 4490 } 4491 }; 4492 4493 _pForm._getPrevHeadingComponent = function (current) { 4494 var arcomp = this._searchPrevHeadingFocus(current); 4495 if (arcomp) { 4496 return arcomp[0]; 4497 } 4498 }; 4499 4500 _pForm.getFocus = function () { 4501 var last_focus = this._find_lastFocused(); 4502 if (last_focus == null) { 4503 return this; 4504 } 4505 return last_focus; 4506 }; 4507 4508 _pForm.getZoom = function () { 4509 var control_elem = this._control_element; 4510 if (control_elem && control_elem.getZoom) { 4511 return (this._zoomFactor !== undefined) ? this._zoomFactor : control_elem.getZoom(); 4512 } 4513 4514 return 100; 4515 }; 4516 4517 _pForm.setZoom = function (v) { 4518 var prevZoomFactor = this.getZoom(); 4519 if (typeof v == "string" && v.charAt(v.length - 1) == "%") { 4520 v = v.slice(0, v.length - 1); 4521 } 4522 4523 4524 4525 var control_elem = this._control_element; 4526 if (control_elem) { 4527 this._zoomFactor = v; 4528 4529 control_elem.container_maxwidth = 0; 4530 control_elem.container_maxheight = 0; 4531 control_elem.setElementScrollMaxSize(0, 0); 4532 4533 4534 this._client_width = 0; 4535 this._client_height = 0; 4536 this._updateClientSize(control_elem); 4537 4538 control_elem.setZoom(v); 4539 nexacro._applyZoomEdge(control_elem, v); 4540 4541 var popups = nexacro._current_popups; 4542 var len = popups.length; 4543 for (var i = 0; i < len; i++) { 4544 if (this._contains(popups[i])) { 4545 popups[i].parent._applyZoomPopup(); 4546 } 4547 } 4548 } 4549 4550 return prevZoomFactor; 4551 }; 4552 4553 _pForm.go = function (v) { 4554 if (this._url != v) { 4555 if (this._url != "") { 4556 var confirm_message = this._on_beforeclose(); 4557 if (this._checkAndConfirmClose(confirm_message) == false) { 4558 return; 4559 } 4560 this._on_close(); 4561 } 4562 4563 this._url = v; 4564 this._base_url = nexacro._getBaseUrl(v); 4565 this._apply_formurl(); 4566 4567 if (nexacro.OS == "Windows" && nexacro.Browser == "Runtime") { 4568 if (this.getZoom() != 100) { 4569 var zoomfactor = 100; 4570 this._zoomFactor = zoomfactor; 4571 var control_elem = this._control_element; 4572 if (control_elem) { 4573 this._updateClientSize(control_elem); 4574 control_elem.setZoom(zoomfactor); 4575 nexacro._applyZoomEdge(control_elem, zoomfactor); 4576 } 4577 } 4578 } 4579 } 4580 }; 4581 4582 _pForm.hasPopupFrame = function () { 4583 return false; 4584 }; 4585 4586 _pForm.insertChild = function (idx, id, obj) { 4587 if (id && id.length <= 0) { 4588 return -1; 4589 } 4590 if (!obj) { 4591 return -1; 4592 } 4593 if (this[id]) { 4594 return -1; 4595 } 4596 4597 obj.parent = this; 4598 obj._refform = this; 4599 4600 this[id] = obj;
4601 this.all.add_item(id, obj); 4602 obj.id = id; 4603 4604 if (obj._is_component) { 4605 ret = this.components.insert_item(idx, id, obj); 4606 this._child_list.push(obj); 4607 } 4608 else if (obj instanceof nexacro.BindItem) { 4609 ret = this.binds.insert_item(idx, id, obj); 4610 } 4611 else { 4612 ret = this.objects.insert_item(idx, id, obj); 4613 } 4614 4615 4616 return ret; 4617 }; 4618 4619 _pForm.isValidObject = function (target) { 4620 if (typeof target == "string") { 4621 if (this[target]) { 4622 return true; 4623 } 4624 } 4625 else if (target instanceof Object) { 4626 var len = this.all.length; 4627 for (var i = 0; i < len; i++) { 4628 if (this.all[i] == target) { 4629 return true; 4630 } 4631 } 4632 } 4633 else { 4634 if (nexacro._indexOf(this.all, target) > -1) { 4635 return true; 4636 } 4637 } 4638 return false; 4639 }; 4640 4641 _pForm.killTimer = function (nTimerID) { 4642 this._timerManager.deleteTimer(nTimerID); 4643 }; 4644 4645 _pForm.setTimer = function (nTimerID, nElapse) { 4646 var timer = new nexacro.EventTimer(this, nTimerID, nElapse); 4647 timer.start(); 4648 }; 4649 4650 _pForm.loadStyle = function (url, bclear) { 4651 if ((typeof (url) != "string") || url.length == 0) { 4652 return; 4653 } 4654 bclear = bclear == false ? false : true; 4655 var exceptcssselector = true; 4656 4657 if (bclear) { 4658 exceptcssselector = false; 4659 } 4660 4661 this._clearCssInfo(exceptcssselector); 4662 var base_url = this._base_url; 4663 var cssurl = []; 4664 cssurl.push(nexacro._getServiceLocation(url, base_url)); 4665 if (!application.checkversion) { 4666 cssurl.push(".js"); 4667 } 4668 4669 var service = nexacro._getServiceObject(url); 4670 this._load_manager.reloadCssModule(cssurl.join(""), null, false, service); 4671 4672 this._apply_formstyle(this); 4673 }; 4674 4675 _pForm.reload = function () { 4676 var _win = this._getRootWindow(); 4677 _win._removeFromCurrentFocusPath(this._last_focused, true); 4678 4679 var _win = this._getWindow(); 4680 _win.clearCurrentFocusPaths(); 4681 4682 this._last_focused = null; 4683 4684 4685 this._url = this.parent._formurl; 4686 this._base_url = nexacro._getBaseUrl(this._url); 4687 4688 if (nexacro.OS == "Windows" && nexacro.Browser == "Runtime") { 4689 if (this.getZoom() != 100) { 4690 var zoomfactor = 100; 4691 this._zoomFactor = zoomfactor; 4692 var control_elem = this._control_element; 4693 if (control_elem) { 4694 this._updateClientSize(control_elem); 4695 control_elem.setZoom(zoomfactor); 4696 nexacro._applyZoomEdge(control_elem, zoomfactor); 4697 } 4698 } 4699 } 4700 this._zoomFactor = 100; 4701 4702 this._apply_formurl(); 4703 }; 4704 4705 _pForm.removeChild = function (id) { 4706 if (!id || id.length <= 0) { 4707 return null; 4708 } 4709 if (!this[id]) { 4710 return null; 4711 } 4712 var obj = this[id]; 4713 4714 if (obj._is_component) { 4715 var is_focused = false; 4716 var _window = this._getWindow(); 4717 if (_window) { 4718 is_focused = (_window._indexOfCurrentFocusPaths(obj) > -1); 4719 } 4720 4721 if (this._defaultbutton == obj) { 4722 this._defaultbutton = null; 4723 } 4724 if (this._escapebutton == obj) { 4725 this._escapebutton = null; 4726 } 4727 4728 if (this._is_alive && obj._control_element) { 4729 obj._control_element._removeFromContainer(); 4730 } 4731 4732 if (this._bind_manager) { 4733 this._bind_manager._dettachSBindItem(obj); 4734 } 4735 4736 if (this._overedobj == obj) { 4737 this._overedobj = null; 4738 } 4739 4740 this.components.delete_item(id); 4741 var cidx = nexacro._indexOf(this._child_list, obj); 4742 if (cidx > -1) { 4743 this._child_list.splice(cidx, 1); 4744 } 4745 4746 if (is_focused && this._is_alive) { 4747 if (obj instanceof nexacro.Form) { 4748 obj._on_deactivate(); 4749 } 4750 4751 _window._removeFromCurrentFocusPath(obj, true); 4752 _window._last_focused_elem = this._control_element; 4753 4754 this._on_focus(true); 4755 } 4756 } 4757 else if (obj instanceof nexacro.BindItem) { 4758 this._bind_manager._setBinditem(obj, true); 4759 this.binds.delete_item(id); 4760 } 4761 else { 4762 this.objects.delete_item(id); 4763 } 4764 4765 obj.parent = null; 4766 delete this[id]; 4767 this.all.delete_item(id); 4768 4769 return obj; 4770 }; 4771 4772 _pForm.setWaitCursor = function (wait_flag, forcely_flag) { 4773 var wait = wait_flag; 4774 var forcely = forcely_flag; 4775 if (wait == undefined) { 4776 wait = true; 4777 } 4778 if (forcely == undefined) { 4779 forcely = false; 4780 } 4781 4782 if (!forcely && !application.usewaitcursor) { 4783 return; 4784 } 4785 4786 var window = this._getWindow(); 4787 if (window) { 4788 if (wait_flag || nexacro._getLocalStorage("_com_waiting", false)) { 4789 window._cancelEvent(); 4790 } 4791 } 4792 this._waitCursor(wait, null); 4793 }; 4794 4795 _pForm.sleep = function (nMilliseconds) { 4796 nexacro._sleep(nMilliseconds); 4797 }; 4798 4799 _pForm.transaction = function (id, url, inDatasetsParam, outDatasetsParam, argsParam, callbackFn, isAsync, datatype, isCompress) { 4800 var window = this._getWindow(); 4801 if (window) { 4802 var elem = window._cur_ldown_elem || window._keydown_element;
4803 var comp = window.findComponent(elem, 0, 0); 4804 4805 window._cancelEvent(); 4806 } 4807 4808 var realurl = nexacro._getServiceLocation(url, this._base_url); 4809 var service = nexacro._getServiceObject(url, true); 4810 4811 this._load_manager.loadDataModule(realurl, id, inDatasetsParam, outDatasetsParam, argsParam, callbackFn, isAsync, datatype, isCompress, service); 4812 }; 4813 4814 _pForm.cancelTransaction = function (id) { 4815 if (!this._load_manager) { 4816 return -1; 4817 } 4818 var datalist = this._load_manager.dataList; 4819 if (!datalist) { 4820 return -1; 4821 } 4822 var canceledCnt = 0; 4823 4824 if (id != undefined) { 4825 var datalistid = (typeof id == "string") ? id.split(",") : id; 4826 if (datalistid.length > 0) { 4827 var datalistfilter = []; 4828 for (var k = 0, n = datalist.length; k < n; k++) { 4829 datalistfilter[k] = datalist[k].url; 4830 } 4831 4832 var datalistfiltered = []; 4833 for (var j = 0, n = datalistfilter.length; n > j; j++) { 4834 var datalistfound = false; 4835 for (var i = 0, n = datalistid.length; n > i; i++) { 4836 if (datalistid[i] == datalistfilter[j]) { 4837 datalistfound = true; 4838 break; 4839 } 4840 } 4841 if (!datalistfound) { 4842 datalistfiltered.push(datalistfilter[j]); 4843 } 4844 } 4845 4846 for (var j = datalistfiltered.length - 1; j >= 0; j--) { 4847 for (var i = datalist.length - 1; i >= 0; i--) { 4848 if (datalist[i].url == datalistfiltered[j]) { 4849 datalist = nexacro._removedatalist(datalist, i); 4850 } 4851 } 4852 } 4853 } 4854 } 4855 4856 this._stopTransaction(true); 4857 }; 4858 4859 _pForm.updateWindow = function () { 4860 }; 4861 4862 _pForm.getStepCount = function () { 4863 var step_ctrl = this.stepcontrol; 4864 if (step_ctrl) { 4865 return step_ctrl.stepcount; 4866 } 4867 }; 4868 4869 _pForm.setStepIndex = function (index) { 4870 var step_ctrl = this.stepcontrol; 4871 if (step_ctrl) { 4872 return step_ctrl.set_stepindex(index); 4873 } 4874 }; 4875 4876 _pForm.applyChange = function () { 4877 var comp = this._last_focused; 4878 if (!comp) { 4879 return; 4880 } 4881 comp.applyto_bindSource("value", comp.value); 4882 4883 var binds = this.binds; 4884 var len = binds.length; 4885 for (var i = 0; i < len; i++) { 4886 var bind_item = binds[i]; 4887 if (bind_item._comp == comp && bind_item.propid == "value") { 4888 this._bind_manager._notify(bind_item); 4889 return; 4890 } 4891 } 4892 }; 4893 4894 _pForm._setFormPosition = function (left, top, width, height) { 4895 this._init_width = width; 4896 this._init_height = height; 4897 }; 4898 4899 _pForm._resetScrollPos = function (target_comp, left, top, right, bottom, focus_direction) { 4900 if (this._is_frame || !this._control_element) { 4901 return; 4902 } 4903 4904 var hscroll = this.hscrollbar; 4905 var vscroll = this.vscrollbar; 4906 4907 var client_width, client_height; 4908 client_width = this._client_width; 4909 client_height = this._client_height; 4910 4911 var hpos = 0; 4912 var vpos = 0; 4913 4914 if (hscroll && hscroll.visible) { 4915 hpos = hscroll.pos; 4916 4917 if (left - hpos < client_width && right - hpos > client_width) { 4918 if (focus_direction == 1 && right - left > client_width) { 4919 hscroll.set_pos(right - client_width); 4920 } 4921 else { 4922 hscroll.set_pos(left); 4923 } 4924 } 4925 else if (hpos > left) { 4926 if (focus_direction == 1 && right - left > client_width) { 4927 hscroll.set_pos(right - client_width); 4928 } 4929 else { 4930 hscroll.set_pos(left); 4931 } 4932 } 4933 else if (left - hpos > client_width) { 4934 if (focus_direction == 1 && right - left > client_width) { 4935 hscroll.set_pos(right - client_width); 4936 } 4937 else { 4938 hscroll.set_pos(left); 4939 } 4940 } 4941 hpos = hscroll.pos; 4942 } 4943 4944 if (vscroll && vscroll.visible) { 4945 vpos = vscroll.pos; 4946 if (top - vpos < client_height && bottom - vpos > client_height) { 4947 if (focus_direction == 1 && bottom - top > client_height) { 4948 vscroll.set_pos(bottom - client_height); 4949 } 4950 else { 4951 vscroll.set_pos(top); 4952 } 4953 } 4954 else if (vpos > top) { 4955 if (focus_direction == 1 && bottom - top > client_height) { 4956 vscroll.set_pos(bottom - client_height); 4957 } 4958 else { 4959 vscroll.set_pos(top); 4960 } 4961 } 4962 else if (top - vpos > client_height) { 4963 if (focus_direction == 1 && bottom - top > client_height) {
4964 vscroll.set_pos(bottom - client_height); 4965 } 4966 else { 4967 vscroll.set_pos(top); 4968 } 4969 } 4970 vpos = vscroll.pos; 4971 } 4972 4973 left = this._adjust_left + left - hpos; 4974 top = this._adjust_top + top - vpos; 4975 right = this._adjust_left + right - hpos; 4976 bottom = this._adjust_top + bottom - vpos; 4977 4978 if (!this._is_popup_control && this.parent && this.parent != this) { 4979 this.parent._resetScrollPos(this, left, top, right, bottom, focus_direction); 4980 } 4981 }; 4982 4983 4984 4985 _pForm._setDragMove = function (v, is_windowframe) { 4986 this._is_track = v; 4987 if (v && is_windowframe) { 4988 this._hittest_type = "caption"; 4989 } 4990 else { 4991 this._hittest_type = "none"; 4992 } 4993 4994 if (this._control_element) { 4995 this._control_element.setElementHittestType(this._hittest_type); 4996 } 4997 }; 4998 4999 _pForm._on_starttrack = function () { 5000 if (!this._is_alive) { 5001 return; 5002 } 5003 var ownerframe = this.getOwnerFrame(); 5004 if (ownerframe) { 5005 ownerframe._on_titlebar_starttrack(); 5006 } 5007 }; 5008 5009 _pForm._on_endtrack = function (x, y, dragdata) { 5010 if (!this._is_alive) { 5011 return; 5012 } 5013 var ownerframe = this.getOwnerFrame(); 5014 if (ownerframe) { 5015 ownerframe._on_titlebar_endtrack(x, y, dragdata); 5016 } 5017 }; 5018 5019 _pForm._on_movetrack = function (x, y, dragdata, windowX, windowY) { 5020 if (!this._is_alive) { 5021 return; 5022 } 5023 var ownerframe = this.getOwnerFrame(); 5024 if (ownerframe) { 5025 ownerframe._on_titlebar_movetrack(x, y, dragdata, windowX, windowY); 5026 } 5027 }; 5028 5029 _pForm._setSize = function (width, height) { 5030 var control_elem = this.getElement(); 5031 var w = this._adjust_width; 5032 var h = this._adjust_height; 5033 var left = this._adjust_left; 5034 var top = this._adjust_top; 5035 5036 if (w != width || h != height) { 5037 var update = false; 5038 if (w == 0 || h == 0) { 5039 update = true; 5040 } 5041 5042 this.width = this._adjust_width = width; 5043 this.height = this._adjust_height = height; 5044 5045 if (this.parent) { 5046 this._adjustPosition(this.left, this.top, this.right, this.bottom, this.width, this.height, this.parent._client_width, this.parent._client_height); 5047 } 5048 else { 5049 this._adjustPosition(this.left, this.top, this.right, this.bottom, this.width, this.height, 0, 0); 5050 } 5051 5052 5053 5054 5055 if (this._layout_list && this._layout_list.length > 0) { 5056 var layout = this._checkValidLayout(); 5057 if (layout) { 5058 control_elem = layout._form.getElement(); 5059 if (control_elem) { 5060 control_elem.setElementSize(width, height); 5061 this._updateClientSize(control_elem); 5062 } 5063 } 5064 } 5065 5066 this.on_update_position(true, false); 5067 5068 if (control_elem && update) { 5069 this.currentstyle._empty(); 5070 this._control_pseudo = ""; 5071 5072 var pseudo = this._getResultPseudo(this._status, this._pseudo); 5073 this._updateControl(control_elem, pseudo); 5074 this._updateContents(control_elem, pseudo); 5075 } 5076 } 5077 }; 5078 5079 _pForm._stopTransaction = function (is_cancel) { 5080 if (!this._load_manager) { 5081 return -1; 5082 } 5083 var datalist = this._load_manager.dataList; 5084 if (!datalist) { 5085 return -1; 5086 } 5087 5088 var trlist = this._load_manager.transactionList; 5089 var idx = 0; 5090 var pre_len = datalist.length; 5091 var canceledCnt = 0; 5092 while (idx < datalist.length) { 5093 var dataitem = datalist[idx]; 5094 if (!dataitem) { 5095 idx++; 5096 continue; 5097 } 5098 5099 var dataitem_handle = dataitem._handle; 5100 if (!dataitem_handle) { 5101 idx++; 5102 continue; 5103 } 5104 5105 if (dataitem._is_cancel || dataitem._is_process) { 5106 idx++; 5107 pre_len = datalist.length; 5108 continue; 5109 } 5110 5111 if (!is_cancel) { 5112 dataitem_handle._user_aborted = false; 5113 var tritem = trlist[idx]; 5114 if (tritem) { 5115 var ret = tritem.on_error(-1, "comm_stop_transaction_byesc", nexacro._communicationStatusTable["stop"], ""); 5116 if (ret) { 5117 dataitem._is_process = true; 5118 dataitem_handle._user_aborted = undefined; 5119 idx++; 5120 continue; 5121 } 5122 } 5123 } 5124 5125 dataitem_handle._user_aborted = true; 5126 dataitem._is_cancel = true; 5127 5128 if (nexacro.Browser == "Runtime") { 5129 nexacro._cancelLoad(dataitem_handle); 5130 } 5131 else { 5132 nexacro._cancelLoad(dataitem_handle); 5133 5134 if (tritem) { 5135 tritem.on_error(0, "comm_cancel_byuser"); 5136 } 5137 } 5138 5139 dataitem_handle = null; 5140 dataitem = null; 5141 5142 canceledCnt++; 5143 5144 if (pre_len == datalist.length) { 5145 idx++; 5146 } 5147 else { 5148 idx = 0; 5149 pre_len = datalist.length; 5150 } 5151 } 5152 5153 5154 return canceledCnt; 5155 }; 5156 5157 _pForm._onRecalcScrollSize = function (fromComp) { 5158 var control_elem = this._control_element; 5159 if (this._is_scrollable && control_elem) { 5160 var ret = false; 5161 var w = 0, h = 0; 5162 if (!fromComp) { 5163 var comps = this.components; 5164 var zoom_factor = this.getZoom() / 100; 5165 var org_maxwidth = this._client_width / zoom_factor; 5166 var org_maxheight = this._client_height / zoom_factor; 5167 5168 for (var i = 0, n = comps.length; i < n; i++) { 5169 var comp = comps[i]; 5170 if (comp && comp.visible) { 5171 var offsetright = comp.getOffsetRight(); 5172 var offsetbottom = comp.getOffsetBottom(); 5173 5174 var applywidht = 1; 5175 if (comp.right) { 5176 var val = comp.right; 5177 if (typeof (val) == "string" && val.indexOf("%") >= 0) { 5178 if (parseFloat(val) >= 0) { 5179 applywidht = 0; 5180 } 5181 } 5182 else { 5183 if (parseInt(val) >= 0) { 5184 applywidht = 0; 5185 } 5186 } 5187 } 5188
5189 if (applywidht || w < offsetright) { 5190 w = Math.max(w, offsetright); 5191 } 5192 5193 var applyheight = 1; 5194 if (comp.bottom) { 5195 var val = comp.bottom; 5196 if (typeof (val) == "string" && val.indexOf("%") >= 0) { 5197 if (parseFloat(val) >= 0) { 5198 applyheight = 0; 5199 } 5200 } 5201 else { 5202 if (parseInt(val) >= 0) { 5203 applyheight = 0; 5204 } 5205 } 5206 } 5207 5208 if (applyheight || h < offsetbottom) { 5209 h = Math.max(h, offsetbottom); 5210 } 5211 } 5212 } 5213 5214 if (org_maxwidth || org_maxheight) { 5215 if (org_maxwidth <= -1) { 5216 w = -1; 5217 } 5218 5219 if (org_maxheight <= -1) { 5220 h = -1; 5221 } 5222 } 5223 5224 control_elem.setElementScrollMaxSize(w, h); 5225 } 5226 else if (fromComp.visible) { 5227 var curMaxWidth = control_elem.container_maxwidth; 5228 var curMaxHeight = control_elem.container_maxheight; 5229 5230 var offsetRight = fromComp.getOffsetRight(); 5231 var offsetBottom = fromComp.getOffsetBottom(); 5232 5233 if (curMaxWidth < offsetRight || curMaxHeight < offsetBottom) { 5234 w = Math.max(curMaxWidth, offsetRight); 5235 h = Math.max(curMaxHeight, offsetBottom); 5236 ret = control_elem.setElementScrollMaxSize(w, h); 5237 } 5238 } 5239 } 5240 }; 5241 5242 _pForm._calcScrollMaxSize = function () { 5243 var control_elem = this._control_element; 5244 if (this._is_scrollable && control_elem) { 5245 var _w = 0, _h = 0; 5246 var comps = this.components; 5247 for (var i = 0, n = comps.length; i < n; i++) { 5248 var comp = comps[i]; 5249 if (comp && comp.visible) { 5250 var offsets = comp._getFixedOffsetValue(); 5251 _w = Math.max(_w, offsets.right); 5252 _h = Math.max(_h, offsets.bottom); 5253 } 5254 } 5255 5256 return { 5257 w : _w, 5258 h : _h 5259 }; 5260 } 5261 return { 5262 w : -1, 5263 h : -1 5264 }; 5265 }; 5266 5267 _pForm._dragEnd = function (info) { 5268 var control_elem = this.getElement(); 5269 if (control_elem) { 5270 var stepcontrol = this.stepcontrol; 5271 if (stepcontrol) { 5272 var step_count = control_elem._step_count; 5273 var step_index = control_elem._step_index; 5274 var direction = info.direction; 5275 if (step_count > 0) { 5276 var new_index = -1; 5277 if (direction == "L") { 5278 new_index = step_index + 1; 5279 } 5280 else if (direction == "R") { 5281 new_index = step_index - 1; 5282 } 5283 if (new_index < 0 || new_index >= step_count) { 5284 return; 5285 } 5286 stepcontrol.set_stepindex(new_index); 5287 } 5288 } 5289 } 5290 }; 5291 5292 _pForm._getDefaultButton = function () { 5293 var comps = this.components; 5294 if (comps) { 5295 var comp; 5296 for (var i = 0, n = comps.length; i < n; i++) { 5297 comp = comps[i]; 5298 if (comp._is_form) { 5299 var btn = comp._getDefaultButton(); 5300 if (btn) { 5301 return btn; 5302 } 5303 } 5304 else if (nexacro._toBoolean(comp.defaultbutton)) { 5305 return comp; 5306 } 5307 } 5308 } 5309 return null; 5310 }; 5311 5312 _pForm._getEscapeButton = function () { 5313 var comps = this.components; 5314 if (comps) { 5315 var comp; 5316 for (var i = 0, n = comps.length; i < n; i++) { 5317 comp = comps[i]; 5318 if (comp._is_form) { 5319 var btn = comp._getEscapeButton(); 5320 if (btn) { 5321 return btn; 5322 } 5323 } 5324 else if (nexacro._toBoolean(comp.escapebutton)) { 5325 return comp; 5326 } 5327 } 5328 } 5329 return null; 5330 }; 5331 5332 5333 5334 _pForm._apply_formurl = function () { 5335 this._clear(); 5336 if (this._url) { 5337 this.loadForm(this._url, true, true); 5338 this.set_visible(true); 5339 } 5340 }; 5341 5342 _pForm._apply_formstyle = function (obj) { 5343 var comps = obj.components; 5344 for (var i = 0, n = comps.length; i < n; i++) { 5345 var comp = comps[i]; 5346 if (comp) { 5347 comp.currentstyle._empty(); 5348 comp._control_pseudo = ""; 5349 comp._contents_pseudo = ""; 5350 comp._css_finder = null; 5351 comp._ref_css_finder = null; 5352 if (comp._is_form) { 5353 comp.on_apply_pseudo(""); 5354 this._apply_formstyle(comp); 5355 } 5356 else { 5357 comp.on_apply_pseudo(""); 5358 comp.on_apply_custom_class(); 5359 } 5360 } 5361 } 5362 5363 if (this.vscrollbar) { 5364 this.vscrollbar.on_apply_prop_class(); 5365 } 5366 if (this.hscrollbar) { 5367 this.hscrollbar.on_apply_prop_class(); 5368 } 5369 5370 this._onResetScrollBar(); 5371 5372 5373 this._control_pseudo = ""; 5374 this._contents_pseudo = ""; 5375 this.on_apply_pseudo(""); 5376 }; 5377 5378 5379 _pForm._apply_stepcount = function () { 5380 var stepctrl = this.stepcontrol; 5381 5382 if (stepctrl) { 5383 this._on_prepare_stepcontents(stepctrl._prestepcount, stepctrl._prestepindex, stepctrl.stepcount, stepctrl.stepindex); 5384 this._on_refresh_stepcontents(stepctrl._prestepcount, stepctrl._prestepindex, stepctrl.stepcount, stepctrl.stepindex); 5385 } 5386 }; 5387 _pForm._getAccessibilityWholeReadLabel = function () { 5388 var readlabel = ""; 5389 var ar = this._getSortedDecendants(this, true, true); 5390 for (var i = 0, n = ar.length; i < n; i++) { 5391 comp = ar[i]; 5392 if (comp._isAccessibilityEnable()) { 5393 var label = comp._getAccessibilityReadLabel(true); 5394 if (label) { 5395 label.trim(); 5396 if (label && label.length > 0) { 5397 readlabel += label + " "; 5398 } 5399 } 5400 } 5401 } 5402 return readlabel; 5403 }; 5404 5405 _pForm._playAccessibilityWholeReadLabel = function (type) { 5406 var control = this.getElement(); 5407 if (control) { 5408 var label = this._getAccessibilityWholeReadLabel(); 5409 control.notifyAccessibility(label, type); 5410 } 5411 }; 5412 5413 5414 delete _pForm; 5415} 5416
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.