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

📄 mainframe.java

📁 CRM源码This file describes some issues that should be implemented in future and how it should be imple
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
    public void setButtonEnabled(Index formIndex, String buttonId,                                 boolean isEnabled) {        QForm form = mainFrameFA.getForm(formIndex);        if(form == null) {            activateForm(formIndex);        }        form = mainFrameFA.getForm(formIndex);        form.getView().setCustomButtonsEnabled(new String[] {buttonId}, isEnabled);    }    private int getClearingFormState() {        return isReportDesignState ? FormState.REPORT_DESIGN_STATE : FormState.SEARCH_STATE;    }    /**     * Build entity of {@link com.queplix.core.client.app.vo.AccumulatedEntitiesRequestObject} with the given params.     *     * @param formIndex form index to build     * @param doCount   should doCount information be retrieved     * @param page      requested page     * @param pageSize  preferred page size     * @param order     order of ret records     * @param localSearch     whether search action will be performed for only local form     * @return accumulated entities request object     *//*    private AccumulatedEntitiesRequestObject buildFullFormRequest(FamgMeta.Index formIndex, boolean doCount, int page,            int pageSize, SortField order, boolean localSearch) {        FamgMeta baseFormMeta = appMetaData.getFamgMeta(formIndex);        ArrayList filterEntities = getFormsFilters(baseFormMeta, localSearch);        return new AccumulatedEntitiesRequestObject(baseFormMeta.getFormID(), filterEntities, doCount, page, pageSize, order);    }*/    /**     * Builds forms filters for all bound forms. Forms constraints bound by "external-form" parameter.     *     * @param baseFormMeta metadata for meta form. Data for that form is searching.     * @param localSearch should this method be performed for local search procedure     * @return ArrayList of element of type {@link com.queplix.core.client.app.vo.EntityData}     */    private ArrayList getFormsFilters(FamgMeta baseFormMeta, boolean localSearch) {        FamgMeta.Index baseFormIndex = baseFormMeta.getIndex();        //create entity filterfs for current form        ArrayList filterEntities = new ArrayList();        EntityData baseFormFilters = getStateRelatedFormFilters(baseFormIndex);        gridPagerSearchFilters = Arrays.asList(baseFormFilters.getFields());//local search only        if(baseFormFilters.getFields().length > 0) {            filterEntities.add(baseFormFilters);        }        if (!localSearch) {            //iterate external form constraints            List externalForms = baseFormMeta.getForm().getExternalForms();            for (int i = 0; i < externalForms.size(); i++) {                FamgMeta.Index index = (FamgMeta.Index) externalForms.get(i);                EntityData entityData = getStateRelatedFormFilters(index);                if(entityData != null && entityData.getFields().length > 0) {                    filterEntities.add(entityData);                }            }        }        return filterEntities;    }    /**     * Retrieve form filters either from form object, or data injector if the form doesn't exist yet.     * @param index form index     * @return entity data object. Can be null if form wasn't created and data isn't set for it.     */    private EntityData getStateRelatedFormFilters(Index index) {        EntityData entityData;        QForm form = mainFrameFA.getForm(index);        FamgMeta famgMeta = appMetaData.getFamgMeta(index);        String entityName = famgMeta.getEntityName();        if (form != null) {            Collection col = getStateRelatedFormFilters(form);            FieldData[] typedArray = new FieldData[col.size()];            CollectionsHelper.copyToArray(col, typedArray);            entityData = new EntityData(entityName, new Long(-1), typedArray);        } else {            entityData = dataInjector.getEntityData(entityName);            if(entityData != null) {                if(entityData.countNotEmptyFields() > 0) {//if has filters, then create non-empty filters                    if(dataInjector.isExternalFieldEntity(entityName)) {//just put filters                        entityData = new EntityData(entityName, new Long(-1), entityData.getNotEmptyFields());                    } else {//get pkey id                        String pkeyID = famgMeta.getForm().getPkeyID();                        FieldData pkeyFieldData = entityData.getFieldById(pkeyID);                        if(pkeyFieldData != null) {                            entityData = new EntityData(entityName, new Long(-1), new FieldData[]{pkeyFieldData});                        } else {//log warning                            GWT.log("Incorrect behaviour, pkey field doesn't "                                    + "have value, but in forms data injector "                                    + "it was filled out by external-set", null);                            entityData = null;                        }                    }                } else {//else null the entity                    entityData = null;                }            }        }        return entityData;    }    /**     * Retrieve form filters according to form state.     * @param form form to retrieve filters     * @return form filters. If form in selected state - return single pkey filter, otherwise all non empty values in it.     */    private Collection getStateRelatedFormFilters(QForm form) {        Collection formFilters;        if(form.getModel().getFormState() == FormState.SELECTED_STATE) {            String pkeyID = form.getModel().getPkeyID();            formFilters = new ArrayList();            formFilters.add(form.getModel().getElementData(pkeyID));        } else {            formFilters = form.getModel().getNonEmptyFilters();        }        return formFilters;    }    private void recordSelected(Long recordID, FamgMeta.Index index) {        if (mainFrameFA.performCommand(new GetCanFormBeTurnedCommand(), index)) {            printFormRequest = new PrintFormRequestObject(appMetaData.getFormID(index), recordID, true, false, 0, 20);            EntityIDRequestObject request = new EntityIDRequestObject(appMetaData.getFormID(index), recordID);            RecordsSelectedAsyncCallback callback = new RecordsSelectedAsyncCallback(index);            RPC.getRPC().getEntityData(request, callback);            gridHistoryRecord = new GridHistoryRecord(index, mainFrameFA.getForm(index).getView().getCaption(), recordID, null);        } else {            DialogHelper.showModalMessageDialog(I18N.getMessages().couldNotSelectRecord());        }    }    private void newHistoryItem(String indexStr) {        if(!indexStr.equalsIgnoreCase(History.getToken())) {            History.newItem(indexStr);        }    }    public void onHistoryChanged(String historyToken) {        if(historyToken.length() > 0) {            Index activeIndex = mainFrameFA.getActiveFormIndex();            Index historyIndex = null;            try {                historyIndex = FamgMeta.Index.deSerialize(historyToken);            } catch (SerializableException e) {                //do nothing, incorrect data in history string. just put active index string there.            }            if(historyIndex != null) {                if(!activeIndex.equals(historyIndex)) {//equals reloaded in FamgsMeta.Index                    selectForm(historyIndex, true);                }            }        }    }    private void selectFocus(FocusMeta.Index index) {        selectFocus(index, false);    }    private void selectFocus(final FocusMeta.Index index, boolean isLastStatement) {        if (isLastStatement) {            LengthyTaskManager.runLengthyTask(new LengthyTaskManager.Runnable() {                public void run() {                    _selectFocus(index);                }            });        } else {            _selectFocus(index);        }    }    private void _selectFocus(FocusMeta.Index index) {        mainFrameFA.activateFocus(index);        mainFrameGA.activateFocus(index);        Index activeFormIndex = mainFrameFA.getActiveFormIndex();        mainFrameSA.activateFocus(activeFormIndex);        //event if only focus is selected we choose active area and notify dataInjector.        dataInjector.onVisualAreaChanged(appMetaData.getTabMeta(activeFormIndex));    }    /*private void selectSubFocus(SubFocusMeta.Index index) {        selectSubFocus(index, false);    }*/    private void selectSubFocus(final SubFocusMeta.Index index, boolean isLastStatement) {        if (isLastStatement) {            LengthyTaskManager.runLengthyTask(new LengthyTaskManager.Runnable() {                public void run() {                    _selectSubFocus(index);                }            });        } else {            _selectSubFocus(index);        }    }    private void _selectSubFocus(SubFocusMeta.Index index) {        mainFrameFA.activateSubFocus(index);        mainFrameGA.activateSubFocus(index);        Index activeFormIndex = mainFrameFA.getActiveFormIndex();        mainFrameSA.activateSubFocus(activeFormIndex);        //event if only subfocus is selected we choose active area and notify dataInjector.        dataInjector.onVisualAreaChanged(appMetaData.getTabMeta(activeFormIndex));    }    private void selectTab(TabMeta.Index index) {        selectTab(index, false);    }    private void selectTab(final TabMeta.Index index, boolean isLastStatement) {        if (isLastStatement) {            LengthyTaskManager.runLengthyTask(new LengthyTaskManager.Runnable() {                public void run() {                    _selectTab(index);                }            });        } else {            _selectTab(index);        }    }    private void _selectTab(TabMeta.Index index) {        mainFrameFA.activateTab(index);        mainFrameGA.activateTab(index);        Index activeFormIndex = mainFrameFA.getActiveFormIndex();        mainFrameSA.activateTab(activeFormIndex);        dataInjector.onVisualAreaChanged(appMetaData.getTabMeta(index));    }    private void selectForm(FamgMeta.Index index, boolean ensureVisible) {        selectForm(index, ensureVisible, false);    }    private void selectForm(final FamgMeta.Index index, final boolean ensureVisible,            boolean isLastStatement) {        if (isLastStatement) {            LengthyTaskManager.runLengthyTask(new LengthyTaskManager.Runnable() {                public void run() {                    _selectForm(index, ensureVisible);                }            });        } else {            _selectForm(index, ensureVisible);        }    }    private void _selectForm(FamgMeta.Index index, boolean ensureVisible) {        selectFormIgnoreHistory(index, ensureVisible);        mainFrameSA.selectTreeItem(mainFrameFA.getActiveFormIndex(), false);        newHistoryItem(index.serialize());    }    private void selectFormIgnoreHistory(FamgMeta.Index index, boolean ensureVisible) {        //TODO remove it somewhere (optimize)        QForm form = mainFrameFA.getForm(index);        if(form != null) {            gridPagerSearchFilters = form.getModel().elementsValues();        } else {            gridPagerSearchFilters = EMPTY_LIST;        }        if(!index.equals(mainFrameFA.getActiveFormIndex())) {            mainFrameFA.activateForm(index);        }        if(ensureVisible) {            mainFrameFA.ensureVisibility(mainFrameFA.getActiveFormIndex());        }        selectTab(index);    }    private boolean parsingDate;    private ArrayList dateTimers = new ArrayList();    private void doFireDateTimers() {        for(int i=0; i<dateTimers.size(); i++) {            Timer t = (Timer) dateTimers.get(i);            t.cancel();            t.run();        }        dateTimers.clear();    }    private void removeDateTimer(Timer t) {        dateTimers.remove(t);    }    private boolean resolvingEntity;    private ArrayList entityTimers = new ArrayList();    private void doFireEntityTimers() {        for(int i=0; i<entityTimers.size(); i++) {            Timer t = (Timer) entityTimers.get(i);            t.cancel();            t.run();        }        entityTimers.clear();

⌨️ 快捷键说明

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