⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainframe.java

📁 CRM源码This file describes some issues that should be implemented in future and how it should be imple
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
            if(!mainFrameSA.isIgnoreTreeSelection()) {                FamgMeta.Index index = (FamgMeta.Index) event.getData();                selectForm(index, true, event.isUserGenerated());            }        } else if (event == MainFrameSA.Events.CLEAR_ALL) {            clearAll(getClearingFormState());        } else if (event == MainFrameSA.Events.LAST_SEARCH) {            performLastSearch();        } else if (event == MainFrameSA.Events.DO_LOAD_SAVED_SEARCH) {            SavedSearchObject search = (SavedSearchObject) event.getData();            clearAll(getClearingFormState());            FamgMeta.Index tmpIndex = (FamgMeta.Index) appMetaData.getIndexByID(search.getFormId());            selectForm(tmpIndex, true);            FieldData[] tmp = search.getFieldsData();            mainFrameFA.performCommand(new SetDataForFormCommand(tmp, null), tmpIndex);            mainFrameFA.performCommand(new TurnFormToStateCommand(FormState.SEARCH_STATE), tmpIndex);            QForm f = mainFrameFA.getForm(tmpIndex);            f.getModel().fireDataChagendPerformed();        } else if (event == MainFrameSA.Events.DELETE_SAVED_SEARCH) {            Long activeRowID = (Long) event.getData();            performDeleteSavedSearchRequest(new Long[]{activeRowID});        } else if (event == MainFrameSA.Events.DO_SAVE_CURRENT_SEARCH) {            FamgMeta.Index formIndex = mainFrameFA.getActiveFormIndex();            String formId = appMetaData.getFormID(formIndex);            String name = (String)event.getData();            if (appMetaData.getTabMeta(formIndex).isMyQueWeb()) {                // TODO Fix the implementation. Rather toolbar buttons should be disabled                DialogHelper.showModalMessageDialog(I18N.getMessages().cantSaveSearch());            } else {                AccumulatedEntitiesRequestObject request = (AccumulatedEntitiesRequestObject) lastFormSearches.get(formId);                List fieldFilters = new ArrayList();                if (request != null) {                    String entityID = mainFrameFA.getActiveForm().getModel().getEntityID();                    for (Iterator it = request.getEntityFilters().iterator(); it.hasNext();) {                        EntityData data = (EntityData) it.next();                        if (data.getEntityID().equals(entityID)) {                            FieldData[] fields = data.getFields();                            for (int i = 0; i < fields.length; i++) {                                fieldFilters.add(fields[i]);                            }                            break;                        }                    }                }                MainFrameSA.saveSearch(name, formId, fieldFilters);            }        } else if (event == MainFrameSA.Events.PRINT_FORM) {            if(printFormRequest != null) {                PrintFormAsyncCallback callback = new PrintFormAsyncCallback();                RPC.getRPC().printForm(printFormRequest, callback);            }            //} else if (event == MainFrameSA.Events.PRINT_GRID) {            //    printGrid("html", true);        } else if (event == MainFrameSA.Events.AD_HOC_REPORTS) {            if(!isReportDesignState) {                mainFrameFA.setFormsState(FormState.REPORT_DESIGN_STATE);            } else {                mainFrameFA.setFormsState(FormState.PREVIOUS_STATE);            }            isReportDesignState = !isReportDesignState;        } else if (event == MainFrameSA.Events.HISTORY_MENU_ITEM) {            GridHistoryRecord rec = (GridHistoryRecord) event.getData();            ignoreGridRecordHistory = true;            selectForm(rec.getFormIndex(), true);            QForm form = mainFrameFA.getForm(rec.getFormIndex());            form.getFormController().searchByPkey(rec.getRecordId());        } else if (event == MainFrameSA.Events.SAVE_SETTINGS) {            collectUISettings();            RPC.QAsyncCallback saveSettingCallback = new RPC.QAsyncCallback() {                public void onRequestEnded(boolean success, Object result) {                    if(success) {                        DialogHelper.showModalMessageDialog(I18N.getMessages().uiSettingsSavedSucc());                    }                }            };            RPC.getRPC().saveSettings(appMetaData, saveSettingCallback);        } else if (event == MainFrameSA.Events.OPEN_QUEPLIX_SITE) {            Window.open("http://www.queplix.com", "Queplix","");        } else {            eventSource.fireEvent(event); // event not processed -- retranslate        }    }    public void performLastSearch() {        if(lastSearchFormIndex != null) {            selectForm(lastSearchFormIndex, true);            FieldData[] tmp = new FieldData[lastSearchFieldData.length];            for(int i=0; i<tmp.length; i++) {                tmp[i] = lastSearchFieldData[i].cloneData();            }            mainFrameFA.performCommand(new SetDataForFormCommand(tmp, null), lastSearchFormIndex);            mainFrameFA.performCommand(new TurnFormToStateCommand(FormState.SEARCH_STATE), lastSearchFormIndex);            performSearchRecordsRequest(lastSearchFormIndex, false);        }    }    private void clearAll(int formStateAfter) {        if(agreeToResetForms(mainFrameFA.existingFormsIterator())) {            lastFormSearches.clear();            unlockLockedRecords(mainFrameFA.existingFormsIterator());            dataInjector.onClearAllAction(formStateAfter);            isReportDesignState = (formStateAfter == FormState.REPORT_DESIGN_STATE);        }    }    private void unlockLockedRecords(Iterator formsToClear) {        while(formsToClear.hasNext()) {            FamgMeta.Index index = (Index) formsToClear.next();            QForm form = mainFrameFA.getForm(index);            QFormController qfc = form.getFormController();            int state = qfc.getCurrentState();            if(state == FormState.EDIT_STATE) {                performUnlockAfterEditRequest(index, form.getModel().getActiveRowID(), appMetaData.getFormID(index), false);            }        }    }    private boolean agreeToResetForms(Iterator formsToClear) {        while(formsToClear.hasNext()) {            FamgMeta.Index index = (Index) formsToClear.next();            QForm form = mainFrameFA.getForm(index);            QFormController qfc = form.getFormController();            int state = qfc.getCurrentState();            if(state == FormState.EDIT_STATE || state == FormState.NEW_STATE) {                selectFormIgnoreHistory(index, true);                if(!discardFormChanges(form)) {                    return false;                }            }        }        return true;    }    private boolean discardFormChanges(QForm form) {        return DialogHelper.showModalQuestionDialog("Form \"" + form.getModel().getFormTitle()                + "\" is editing. \nDiscard your changes? ") == DialogHelper.YES;    }    private void processGAEvents(Event event) {        FamgMeta.Index gridIndex = mainFrameGA.getActiveGridIndex();        if (event == MainFrameGA.Events.GRID_CUSTOMIZE) {            SubsetData data = /*]/*[*/(SubsetData)/*]*[*//*]/[*/ event.getData();            performCustomizeGridRequest(gridIndex, data);        } else if (event == MainFrameGA.Events.GRID_REFRESH) {            performGridDrivenRequest(gridIndex);        } else if (event == MainFrameGA.Events.GRID_NEED_DATA) {            performGridDrivenRequest(gridIndex);        } else if (event == MainFrameGA.Events.RECORD_TO_BE_SELECTED) {            Long selectedRecord = (Long) event.getData();            selectedRecordChanged(gridIndex, selectedRecord);        } else if (event == MainFrameGA.Events.RECORD_SELECTED) {            Long recordID = (Long) event.getData();            recordSelected(recordID, gridIndex);        } else if (event == MainFrameGA.Events.GRID_PRINT) {            printGrid("html", true);        } else if (event == MainFrameGA.Events.GRID_EXPORT_TO_WORD) {            printGrid("word", false);        } else if (event == MainFrameGA.Events.GRID_EXPORT_TO_EXCEL) {            printGrid("excel", false);        } else if (event == QGridController.Events.DELETE_KEY_PRESSED) {            Index formIndex = mainFrameFA.getActiveForm().getModel().getIndex();            processDeleteEvent(formIndex);        }    }    private void selectedRecordChanged(FamgMeta.Index gridIndex, Long recordId) {        QGrid grid = mainFrameGA.getGrid(gridIndex);        QForm form = mainFrameFA.getForm(gridIndex);        int formState = form.getFormController().getCurrentState();        if(formState == FormState.EDIT_STATE || formState == FormState.NEW_STATE) {            if(DialogHelper.showModalQuestionDialog(form.getFormController().getRecordEditingMessage()) == DialogHelper.YES) {                if(formState == FormState.EDIT_STATE) {                    performUnlockAfterEditRequest(gridIndex, recordId, appMetaData.getFormID(gridIndex), true);                }                grid.getModel().setSelectedRecordId(recordId);            }        } else {            grid.getModel().setSelectedRecordId(recordId);        }    }    public void onLengthyTaskStart() {        mainFrameSA.setIndicatorState(MainFrameSA.Indicator.WORKING);        WindowHelper.setApplicationBusyMouse(true);    }    public void onLengthyTaskEnd() {        mainFrameSA.setIndicatorState(MainFrameSA.Indicator.IDLE);        WindowHelper.setApplicationBusyMouse(false);    }    public void onRequestStarted() {        mainFrameSA.setIndicatorState(MainFrameSA.Indicator.COMMUNICATING);    }    public void onRequestFinished(boolean success) {        mainFrameSA.setIndicatorState(MainFrameSA.Indicator.IDLE);    }    public void handleError(Throwable caught) {    }    private AboutFrame getAboutFrame() {        if(aboutFrame == null) {            aboutFrame = new AboutFrame(appMetaData.getProductMeta());        }        return aboutFrame;    }    private class RecordsSelectedAsyncCallback extends RPC.QAsyncCallback {        private FamgMeta.Index formIndex;        public RecordsSelectedAsyncCallback(FamgMeta.Index formIndex) {            this.formIndex = formIndex;        }        public void onRequestEnded(boolean success, Object result) {            if (success) {                AccumulatedEntityDataResponse response = (AccumulatedEntityDataResponse) result;                if (mainFrameFA.performCommand(new TurnFormToStateCommand(                        FormState.SELECTED_STATE), formIndex)) {                    dataInjector.onFormsDataUpdated(response.getEntitiesList(), response.getExternalFieldsList(), response.getGridData());                    if (!ignoreGridRecordHistory) {                        FamgMeta.Index index = gridHistoryRecord.getFormIndex();                        gridHistoryRecord.setDescription(mainFrameFA.getForm(index).getModel().getRecordDescription());                        mainFrameSA.addHistoryItem(gridHistoryRecord);                    } else {                        ignoreGridRecordHistory = false;                    }                } else {                    mainFrameGA.performCommand(new ClearRecordGridCommand(), formIndex);                }            }        }    }    private class ClearEntityAsyncCallback extends RPC.QAsyncCallback {        private FamgMeta.Index formIndex;        public ClearEntityAsyncCallback(FamgMeta.Index formIndex) {            this.formIndex = formIndex;        }        public void onRequestEnded(boolean success, Object result) {            if (success) {                AccumulatedEntityDataResponse response = (AccumulatedEntityDataResponse) result;                dataInjector.onFormsDataUpdated(response.getEntitiesList(), response.getExternalFieldsList(), response.getGridData());            }        }    }    private class UnlockAterEditAsyncCallback extends RPC.QAsyncCallback {        private FamgMeta.Index formIndex;        private Long rowID;        private boolean updateAfterUnlock;        public UnlockAterEditAsyncCallback(FamgMeta.Index formIndex, Long rowID, boolean updateAfterUnlock) {            this.formIndex = formIndex;            this.rowID = rowID;            this.updateAfterUnlock = updateAfterUnlock;        }        public void onRequestEnded(boolean success, Object result) {            if (!success) {                DialogHelper.showModalMessageDialog("Couldn't unlock the record with id [" + rowID +                        "], form [" + appMetaData.getFormID(formIndex) + "].");            } else {                if(updateAfterUnlock) {                    AccumulatedEntityDataResponse response = (AccumulatedEntityDataResponse) result;                    dataInjector.onFormsDataUpdated(response.getEntitiesList(), response.getExternalFieldsList(), response.getGridData());                }            }        }    }    private class SavedSearchDeleteAsyncCallback extends RPC.QAsyncCallback {        public void onRequestEnded(boolean success, Object result) {            if(success){                MainFrameSA.onSearchDeleted();            }        }    }    private class PrintFormAsyncCallback extends RPC.QAsyncCallback {        public void onRequestEnded(boolean success, Object result) {            if (success) {                JavaScriptObject printFormWindow = WindowHelper.openWindow("../getReport/response/html/" + printFormRequest.getProcessId() + "?transletName=form");                WindowHelper.printWindow(printFormWindow);            }        }    }    private class PrintGridAsyncCallback extends RPC.QAsyncCallback {        private static final String validFormats = "'html', 'word', 'excel'";        private String format;        private boolean print;        public PrintGridAsyncCallback() {            this("html", false);        }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -