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

📄 mainframe.java

📁 CRM源码This file describes some issues that should be implemented in future and how it should be imple
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
        public PrintGridAsyncCallback(String format, boolean print) {            if (validFormats.indexOf("'" + format + "'") == -1) {                throw new IllegalArgumentException(                        "Format must be one of the values: " + validFormats);            }            this.format = format;            this.print = print;        }        public void onRequestEnded(boolean success, Object result) {            if(success) {                String url = "../getReport/response/" + format + "/" +                        printGridRequest.getProcessId() + "?transletName=grid";                JavaScriptObject printGridWindow = WindowHelper.openWindow(url);                if (print) {                    WindowHelper.printWindow(printGridWindow);                }            }        }    }    private class BuildChartAsyncCallback extends RPC.QAsyncCallback {        private QChartModel chartModel;        public BuildChartAsyncCallback(QChartModel chartModel){            this.chartModel = chartModel;        }        public void onRequestEnded(boolean success, Object result) {            if (success) {                chartModel.setData(((ChartResponseObject) result).getData());            }        }    }//    private boolean ignoreFormSelection;    public void onEvent(Event event, Widget sender) {        if (processCommonEvents(event)) {            // processed common event        } else if (sender == mainFrameSA) {            processSAEvents(event);        } else if (sender == mainFrameFA) {            processFAEvents(event);        } else if (sender == mainFrameGA) {            processGAEvents(event);        }    }    public void setAdhocElementIn(String elementId, FamgMeta.Index index) {        setElementReportState(index, elementId, QFormElementModel.IN_REPORT);    }    public void setAdhocElementOut(String elementId, FamgMeta.Index index) {        setElementReportState(index, elementId, QFormElementModel.NOT_IN_REPORT);    }    private void setElementReportState(Index index, String elementId, int state) {        QForm form = mainFrameFA.getForm(index);        if(form != null) {            form.getView().setAdhocControlState(elementId, state);        }    }    /**     * Set all elements in the given tab that contains in #inReportList to the "in_report" state,     * and all other in the given tab to "out_of_report" state.     * @param inReport Set<Adhoc>     * @param index tab index     */    public void setAdhocData(Set inReport, TabMeta.Index index) {        FamgMeta[] forms = appMetaData.getTabMeta(index).getFamgs();        //set out of report for all elements        for(int i = 0; i < forms.length; i++) {            FamgMeta form = forms[i];            FieldMeta[] fields = form.getForm().getEntityMeta().getFields();            for(int j = 0; j < fields.length; j++) {                FieldMeta field = fields[j];                setAdhocElementOut(field.getFieldID(), form.getIndex());            }        }        //set in for selected        for(Iterator iterator = inReport.iterator(); iterator.hasNext();) {            AdhocData data = (AdhocData) iterator.next();            setAdhocElementIn(data.getFieldSent().getFieldID(), data.getFormIndex());        }    }    /**     * This method disables all forms for report design, which not joined with the given form and set "not_in_report" state other froms.     * @param formIndex enables all joinable to this index forms.     */    public void enableAdhocForJoinable(FamgMeta.Index formIndex) {        initialAdhocFormIndex = formIndex;        Set jf = appMetaData.getFamgMeta(formIndex).getForm().getJoinableForms();        Iterator it = mainFrameFA.existingFormsIterator();        while(it.hasNext()) {            FamgMeta.Index famgIndex = (FamgMeta.Index) it.next();            mainFrameFA.getForm(famgIndex).getView().setAdhocControlsEnabled(jf.contains(famgIndex));        }        QForm form = mainFrameFA.getForm(formIndex);        if(form != null) {            form.getView().setAdhocControlsEnabled(true);        }    }    /**     * This method disables all forms in tab with index = tabIndex for report design than     * enables all joinable forms of form with index = formIndex in tab with index = tabIndex in report design mode.     * @param formIndex initial adhoc form index     * @param tabIndex initialized tab index.     */    public void enableAdhocForJoinable(FamgMeta.Index formIndex, TabMeta.Index tabIndex) {        Set jf = appMetaData.getFamgMeta(formIndex).getForm().getJoinableForms();        FamgMeta[] initializedTabForms = appMetaData.getTabMeta(tabIndex).getFamgs();        for(int j = 0; j < initializedTabForms.length; j++) {            FamgMeta.Index index = initializedTabForms[j].getIndex();            mainFrameFA.getForm(index).getView().setAdhocControlsEnabled(jf.contains(index));        }    }    public void enableAdhocForAllForms() {        initialAdhocFormIndex = null;        Iterator it = mainFrameFA.existingFormsIterator();        while(it.hasNext()) {            FamgMeta.Index index = (Index) it.next();            mainFrameFA.getForm(index).getView().setAdhocControlsEnabled(true);        }    }    /**     * @return list of entity data filters. List<EntityData>     */    public List getAdhocFilters() {        ArrayList filters = new ArrayList();        if(initialAdhocFormIndex != null) {            //add current form filters            EntityData baseData = getStateRelatedFormFilters(initialAdhocFormIndex);            if(baseData != null && baseData.getFields().length > 0) {                filters.add(baseData);            }            //add all joined forms filters            Set formsToGetFiltersFrom = appMetaData.getFamgMeta(                    initialAdhocFormIndex).getForm().getJoinableForms();            for(Iterator iterator = formsToGetFiltersFrom.iterator();                iterator.hasNext();) {                FamgMeta.Index index = (Index) iterator.next();                EntityData data = getStateRelatedFormFilters(index);                if(data != null && data.getFields().length > 0) {                    filters.add(data);                }            }        }        return filters;    }    public AdhocOperations getAdhocOperations() {        return this;    }    public GridOperations getGridOperations() {        return this;    }    public FormOperations getFormOperations() {        return this;    }    public MetaData getMetaData(){        return appMetaData;    }    public boolean isInEditMode() {        return mainFrameFA.isInEditMode();    }    public FieldData getFieldData(Index index, String elementId) {        FieldData data = null;        QForm form = mainFrameFA.getForm(index);        if(form != null) {            data = form.getModel().getElementData(elementId);            if(data == null) {                throw new IllegalArgumentException("There is no field [" +                elementId + "] on the form [" + form.getModel().getFormTitle()                        + "]");            }        }        return data;    }    public void setFieldData(Index index, FieldData data) {        if(data == null) {            throw new NullPointerException("Field data could not be null object.");        }        QForm form = mainFrameFA.getForm(index);        if(form != null) {            form.getModel().setDataForElement(data);            form.getModel().fireDataChagendPerformed(data.getFieldID());        }    }    public void setOnDemandData(Index formIndex, FieldOnDemandData data    ) {        mainFrameFA.performCommand(new SetOnDemandDataForControlCommand(data),                formIndex);    }    public void setFormData(FieldData[] fields, Long rowId,                            Index index, boolean clearOtherFields) {        SetDataForFormCommand cmd = new SetDataForFormCommand(fields, rowId,                clearOtherFields);        mainFrameFA.performCommand(cmd, index);    }    public void setData(EntityData[] entitiesList,                        EntityData[] externalFieldsList,                        Collection gridData) {        dataInjector.onFormsDataUpdated(entitiesList, externalFieldsList,                gridData);    }    public void setOperationStatus(int operation, boolean isSuccessful,                                   Index index) {        switch(operation) {            case OperationTypes.CREATE_RECORD_PROTOTYPE: {                int state = isSuccessful ? QFormModel.NEW_SUCCESSFUL                : QFormModel.NEW_FAILED;                mainFrameFA.performCommand(new SetNewEntityStatusFormCommand(state), index);                break;            }            case OperationTypes.DELETE_RECORDS: {                int state = isSuccessful ? QFormModel.DELETE_SUCCESSFUL                : QFormModel.DELETE_FAILED;                mainFrameFA.performCommand(new SetDeleteStatusFormCommand(state), index);                break;            }            case OperationTypes.UPDATE_RECORD: //same handler, don't break;            case OperationTypes.INSERT_RECORD: {                int state = isSuccessful ? QFormModel.UPDATE_SUCCESSFUL                : QFormModel.UPDATE_FAILED;                mainFrameFA.performCommand(new SetUpdateStatusFormCommand(state), index);                break;            }            case OperationTypes.LOCK_AND_EDIT_RECORD: {                int state = isSuccessful ? QFormModel.LOCK_FOR_EDIT_SUCCESSFUL                : QFormModel.LOCK_FOR_EDIT_FAILED;                mainFrameFA.performCommand(new SetLockForEditStatusFormCommand(state), index);                break;            }            case OperationTypes.SEARCH_RECORDS: {                int state = isSuccessful ? QFormModel.SEARCH_SUCCESSFUL_SINGLE                : QFormModel.SEARCH_FAILED;                mainFrameFA.performCommand(new SetSearchStatusFormCommand(state), index);                break;            }        }    }    public void performOperation(int operation, Index index) {        Event event = null;        switch(operation) {            case OperationTypes.CREATE_RECORD_PROTOTYPE: {                event = QFormController.Events.FORM_NEW_BUTTON_EVENT;                break;            }            case OperationTypes.DELETE_RECORDS: {                processDeleteEvent(index);                break;            }            case OperationTypes.UPDATE_RECORD: //same handler, don't break;            case OperationTypes.INSERT_RECORD: {                event = QFormController.Events.FORM_UPDATE_BUTTON_EVENT;                break;            }            case OperationTypes.LOCK_AND_EDIT_RECORD: {                event = QFormController.Events.FORM_CHANGE_BUTTON_EVENT;                break;            }            case OperationTypes.SEARCH_RECORDS: {                event = QFormController.Events.FORM_SEARCH_BUTTON_EVENT;                break;            }            case OperationTypes.CLEAR_FORM: {                event = QFormController.Events.FORM_CLEAR_BUTTON_EVENT;                break;            }        }        if(event != null) {            mainFrameFA.getForm(index).getFormController().performAction(                        event);        }    }    public void clearForm(Index index, boolean clearExternalFields) {        QForm form = mainFrameFA.getForm(index);        if(form == null) {            dataInjector.onClearAction(appMetaData.getFamgMeta(index));        } else {            performOperation(OperationTypes.CLEAR_FORM, index)

⌨️ 快捷键说明

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