====== TabForm ====== this.init(); function init() { this.setCaption(LABELS.licType_caption_new, "license_symbol"); this.allowCloseButton([this, "menuFormFnc", "cancel"]); var bData = { controlPoint: { x: this.form_control_point._x, y: this.form_control_point._y } }; var e = new bEvent(); e.setSource(this); e.setData(bData); cc_broadcaster.broadcastEvent("technology/init", e); delete e; var res = _UI_TOOLS.resizeFormAfterInit(this, {}, bData); // tab control var tabs = []; tabs.push({id:"base", label:LABELS.app_tab_base, symbol:"", hint:""}); tabs.push({id:"sk", label:"SK", symbol:"", hint:""}); tabs.push({id:"en", label:"EN", symbol:"", hint:""}); tabs.push({id:"tech_info", label:LABELS.licType_t_tech_info, symbol:"", hint:""}); var e = new bEvent(); e.setSource(this); e.setTabs(tabs); cc_broadcaster.broadcastEvent("lic/type/getControlTabs", e); this.tab_control.setTabs(e.getTabs()); delete e; // tab form var tabs = []; tabs.push({id: "init", load_symbol: "app_tab_loading_symbol", preload:true}); tabs.push({id: "base", load_symbol: "form_lic_type_tab_base_symbol"}); tabs.push({id: "sk", load_symbol: "form_lic_type_tab_lang_spec_symbol"}); tabs.push({id: "en", load_symbol: "form_lic_type_tab_lang_spec_symbol"}); tabs.push({id: "tech_info", load_symbol: "form_lic_type_tab_tech_info_symbol"}); var e = new bEvent(); e.setSource(this); e.setTabs(tabs); cc_broadcaster.broadcastEvent("lic/type/getFormTabs", e); this.tab_form.setTabs(e.getTabs()); this.tab_form.attachControl(this.tab_control); this.tab_form.attachForm(this); delete e; // menu var menuArray = []; menuArray.push(new class_menu_item(0, LABELS.app_save, "save", "save_symbol")); menuArray.push(new class_menu_item(0, LABELS.app_close, "cancel", "cancel_symbol")); // menuArray.push(new class_menu_item(0, LABELS.app_apply, "apply", "apply_symbol")); var e = new bEvent(); e.setSource(this); e.setMenu(menuArray); cc_broadcaster.broadcastEvent("lic/type/getMenu", e); this.menu_form.setMenu(e.getMenu()); delete e; this.loadSettings(); } function unload() { var e = new bEvent(); e.setSource(this); cc_broadcaster.broadcastEvent("lic/type/done", e); delete e; _call(this.formArguments.onClose); } function loadSettings() { var settings = { mode: this.formArguments.mode }; if (this.formArguments.mode === "edit") { var arr = this.formArguments.rowId.split("||"); settings.code = arr[0]; settings.validFrom = arr[1]; } var t = new cc_eTransaction(); t.addRequest( 'lic/licTypes/fLoadSettings', settings, [this, "loadSettingsLoaded"] ); t.useForm(this); t.send([this, "loadSettingsResult"]); } function loadSettingsResult(e) { // trace(analyze_variable(e.response)); if (!e.response.status) { FORMS.unload_form(this); } } function loadSettingsLoaded(e) { // trace(analyze_variable(e.response)); if (!e.response.status) return; this.loadedFormData = e.response.result.formData; this.loadedHelperData = e.response.result.helperData; this.tab_form.setData(this.loadedFormData); this.resetChangeStatus(); tabFormResetSettings("licType", "base", "base"); tabFormSelectTab("licType", this.tab_control); } function onChanged(status) { this.menu_form.setMenuEnabled("apply", status); } function menuFormFnc(callId) { _form_cancel_fnc(this, callId, "menuFormFnc"); var e = new bEvent(); e.setSource(this); e.setData(data); e.setCallId(callId); cc_broadcaster.broadcastEvent("lic/type/callMenu", e); if (e.isCancelled()) return true; delete e; if (callId === "save" || callId === "apply") { var settings = { mode: this.formArguments.mode, formData: this.tab_form.getData() }; if (this.formArguments.mode === "edit") { var arr = this.formArguments.rowId.split("||"); settings.code = arr[0]; settings.validFrom = arr[1]; } var t = new cc_eTransaction(); t.addRequest( "lic/licTypes/fSaveSettings", settings, [this, 'fSaveSettingsSaved', callId] ); t.useForm(this); t.send(); } } function fSaveSettingsSaved(e, callId) { // trace(analyze_variable(e.response)); // var status = e.response.status, result = e.response.result; if (!e.response.status) return; if (callId === "save") { _call(this.formArguments.onSave, e.response.result.rowId); FORMS.unload_form(this); } else if (callId === "apply") { this.loadSettings(); } }