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

📄 uiscreensection.java

📁 国外的一套开源CRM
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
        default:
            throw new GenericEntityException("Invalid layout type.");
        }
    }

    /**
     * DOCUMENT ME!
     *
     * @param dataMatrix 
     * @param action 
     * @param sectionTitle 
     * @param isSubsection 
     * @param tabOffset 
     *
     * @return 
     *
     * @throws GenericEntityException 
     */
    public abstract String displayFreeFormSection(DataMatrix dataMatrix,
        String action, String sectionTitle, boolean isSubsection, int tabOffset)
        throws GenericEntityException;

    /**
     * DOCUMENT ME!
     *
     * @param dataMatrix 
     * @param action 
     * @param sectionTitle 
     * @param queryId 
     *
     * @return 
     *
     * @throws GenericEntityException 
     */
    public abstract String displayTabularSection(DataMatrix dataMatrix,
        String action, String sectionTitle, String queryId)
        throws GenericEntityException;

    /**
     * DOCUMENT ME!
     *
     * @param action 
     * @param sectionTitle 
     * @param queryId 
     * @param rows 
     * @param sendQueryParams 
     *
     * @return 
     *
     * @throws GenericEntityException 
     */
    public abstract String displayTabularSectionHeader(String action,
        String sectionTitle, String queryId, int rows, String sendQueryParams)
        throws GenericEntityException;

    /**
     * DOCUMENT ME!
     *
     * @param row 
     * @param rows 
     * @param entityDetailsVector 
     * @param action 
     *
     * @return 
     *
     * @throws GenericEntityException 
     */
    public abstract String displayTabularSectionRow(int row, int rows,
        Vector entityDetailsVector, String action)
        throws GenericEntityException;

    /**
     * DOCUMENT ME!
     *
     * @param action 
     * @param sendQueryParams 
     *
     * @return 
     */
    public abstract String displayTabularSectionFooter(String action,
        String sendQueryParams, String queryId);

    /**
     * DOCUMENT ME!
     *
     * @param dataMatrix 
     * @param action 
     * @param sectionTitle 
     * @param queryId 
     *
     * @return 
     *
     * @throws GenericEntityException 
     */
    public abstract String displaySelectSection(DataMatrix dataMatrix,
        String action, String sectionTitle, String queryId)
        throws GenericEntityException;

    /**
     * DOCUMENT ME!
     *
     * @param fieldInfo 
     * @param entityDetailsVector 
     * @param action 
     * @param row 
     * @param isSubsection 
     * @param tabOffset 
     *
     * @return 
     */
    public abstract String displayField(UIFieldInfo fieldInfo,
        Vector entityDetailsVector, String action, int row,
        boolean isSubsection, int tabOffset);

    /**
     * DOCUMENT ME!
     *
     * @param uiCache 
     *
     * @return 
     *
     * @throws GenericEntityException 
     */
    public List getDisplayFields(UICache uiCache) throws GenericEntityException {
        UtilTimer timer = new UtilTimer();

        if (TIMER) {
            timer.timerString(2, "[UIScreenSection.getDisplayFields] Start");
        }

        ArrayList uiFields = new ArrayList();
        boolean gotFields = false;

        // Get the primary key names for the primary entity.
        UIScreenSectionEntity primaryUiScreenSectionEntity = (UIScreenSectionEntity) (getUiScreenSectionEntityList()
                                                                                          .get(0));
        UIEntity primaryUiEntity = primaryUiScreenSectionEntity.getUiEntity();
        String primaryEntityName = primaryUiEntity.getEntityName();
        ModelEntity primaryModelEntity = primaryUiScreenSectionEntity.getUiEntity()
                                                                     .getModelEntity();
        List primaryPrimaryKeyFieldNameList = primaryModelEntity.getPkFieldNames();

        boolean[] primaryKeyIncluded = new boolean[20];

        for (int keyFieldNbr = 0;
                keyFieldNbr < primaryPrimaryKeyFieldNameList.size();
                keyFieldNbr++) {
            primaryKeyIncluded[keyFieldNbr] = false;
        }

        for (int i = 0; i < 3; i++) {
            String partyId = getUserInfo().getPartyId();

            if (i == 1) {
                partyId = getUserInfo().getAccountId(); //search for the company settings the second time through the loop
            }

            if (i == 2) {
                partyId = "-1"; //search for default party the last time through the loop
            }

            HashMap findMap = new HashMap();
            findMap.put("sectionId", sectionId);
            findMap.put("partyId", partyId);

            ArrayList orderBy = new ArrayList();
            orderBy.add("displayOrder");

            List uiFieldInfoL = getDelegator().findByAnd("UiScreenSectionInfo",
                    findMap, orderBy);

            int numRows = 0;

            Iterator uiFieldInfoI = uiFieldInfoL.iterator();

            while (uiFieldInfoI.hasNext()) {
                numRows++;

                GenericValue uiScreenSectionInfoGV = (GenericValue) uiFieldInfoI.next();
                int displayOrder = (uiScreenSectionInfoGV.get("displayOrder") == null)
                    ? 0
                    : Integer.valueOf(uiScreenSectionInfoGV.getString(
                            "displayOrder")).intValue();

                if (displayOrder > 0) {
                    // Only fields with display order > 0 get displayed.
                    String attributeId = (uiScreenSectionInfoGV.getString(
                            "attributeId") == null) ? ""
                                                    : uiScreenSectionInfoGV.getString(
                            "attributeId");

                    if (TIMER) {
                        timer.timerString(2,
                            "[UIScreenSection.getDisplayFields] Processing field with attribute ID " +
                            attributeId);
                    }

                    if (TIMER) {
                        timer.timerString(1,
                            "[UIScreenSection.getDisplayFields] Looking for UIScreenSectionInfo in cache.");
                    }

                    UIFieldInfo uiFieldInfo = uiCache.getUiFieldInfo(sectionId,
                            partyId, attributeId);

                    if (uiFieldInfo == null) {
                        if (TIMER) {
                            timer.timerString(1,
                                "[UIScreenSection.getDisplayFields] UIScreenSectionInfo not found in cache. Creating a new one.");
                        }

                        uiFieldInfo = new UIFieldInfo(uiScreenSectionInfoGV,
                                getDelegator(), uiCache);
                        uiCache.putUiFieldInfo(sectionId, partyId, attributeId,
                            uiFieldInfo);
                    } else {
                        if (TIMER) {
                            timer.timerString(1,
                                "[UIScreenSection.getDisplayFields] Found UIScreenSectionInfo in cache.");
                        }
                    }

                    uiFields.add(uiFieldInfo);

                    String attributeName = uiFieldInfo.getUiAttribute()
                                                      .getAttributeName();

                    for (int keyFieldNbr = 0;
                            keyFieldNbr < primaryPrimaryKeyFieldNameList.size();
                            keyFieldNbr++) {
                        if (attributeName.equals(
                                    primaryPrimaryKeyFieldNameList.get(
                                        keyFieldNbr))) {
                            primaryKeyIncluded[keyFieldNbr] = true;
                        }
                    }
                }
            }

            if (numRows > 0) {
                break;
            }
        }

        // Make sure all the primary key fields of the primary entity were included.
        for (int keyFieldNbr = 0;
                keyFieldNbr < primaryPrimaryKeyFieldNameList.size();
                keyFieldNbr++) {
            if (!primaryKeyIncluded[keyFieldNbr]) {
                throw new GenericEntityException(
                    "[UIScreenSection.getDisplayFields]: All primary key fields of the primary entity must be included in the field list.");
            }
        }

        if (TIMER) {
            timer.timerString(2, "[UIScreenSection.getDisplayFields] End");
        }

        return uiFields;
    }

    /**
     * DOCUMENT ME!
     *
     * @param uiFields 
     *
     * @return 
     */
    public static List getDisplayLabels(List uiFields) {
        List fields = new ArrayList();

        for (int i = 0; i < uiFields.size(); i++) {
            UIFieldInfo fldInfo = (UIFieldInfo) uiFields.get(i);
            fields.add(fldInfo.getDisplayLabel());
        }

        return fields;
    }

    /**
     * DOCUMENT ME!
     *
     * @param uiFields 
     *
     * @return 
     */
    public static int getRowWidth(List uiFields) {
        int width = 0;

        for (int i = 0; i < uiFields.size(); i++) {
            UIFieldInfo fldInfo = (UIFieldInfo) uiFields.get(i);

            if (fldInfo.getIsVisible()) {
                width += fldInfo.getDisplayLength();
            }
        }

        return width;
    }

    /**
     * DOCUMENT ME!
     *
     * @param action 
     * @param defaultTitle 
     *
     * @return 
     */
    public String getFreeFormSectionTitle(String action, String defaultTitle) {
        if (action.equals(ACTION_SHOW_INSERT) ||
                action.equals(ACTION_SHOW_COPY) ||
                action.equals(ACTION_DELETE)) {
            //			return "New " + getUiScreenSectionEntity(0).getUiEntity().getDescription();
            return defaultTitle + " New";
        } else if (action.equals(ACTION_SHOW_QUERY)) {
            //			return getUiScreenSectionEntity(0).getUiEntity().getDescription() + " Query";
            return defaultTitle + " Query";
        } else {
            return defaultTitle;
        }
    }

    /**
     * DOCUMENT ME!
     *
     * @param action 
     *
     * @return 
     */
    public String getNextAction(String action) {

        String nextAction = "";

        if (action.equals(ACTION_INSERT)) {
            // A record was just inserted.  The screen will be displayed in read only mode this time, so the Save
            // button won't be visible.  No action will be required for the Save button.
            nextAction = ACTION_NONE;
        } else if (action.equals(ACTION_DELETE)) {
            // A record was just deleted.  The screen will be displayed in insert mode this time,
            // so next time Save is pushed, need to insert a new record, and then show the screen in update mode.
            nextAction = ACTION_INSERT;
        } else if (action.equals(ACTION_QUERY)) {
            // A query was just executed.  The screen will be displayed in read only mode this time, so the Save
            // button won't be visible.  No action will be required for the Save button.
            nextAction = ACTION_NONE;
        } else if (action.equals(ACTION_QUERY_UPDATE)) {
            // A query was just executed.  The screen will be displayed in update mode this time,
            // so next time Save is pushed, need to update and then show the screen in update mode the next time.
            nextAction = ACTION_UPDATE;
        } else if (action.equals(ACTION_SHOW_COPY)) {
            // The Copy button was just pushed.  The screen will be displayed in insert mode this time,
            // so next time Save is pushed, need to insert a new record, and then show the screen in update mode.
            nextAction = ACTION_INSERT;
        } else if (action.equals(ACTION_SHOW_INSERT)) {
            // The Insert button was just pushed.  The screen will be displayed in insert mode this time,
            // so next time Save is pushed, need to insert a new record, and then show the screen in update mode.
            nextAction = ACTION_INSERT;
        } else if (action.equals(ACTION_SHOW_QUERY)) {
            // The Query button was just pushed.  The screen will be displayed in query mode this time,
            // so next time Save is pushed, need to execute the query, and show the query results in read only mode.
            nextAction = ACTION_QUERY;
        } else if (action.equals(ACTION_SHOW_QUERY_REPORT)) {
            // The menu item for a report was just pushed.  The screen will be displayed in query_report mode this time,
            // and the Save button will submit the form with a next action of ACTION_SHOW_REPORT to show the report results.
            nextAction = ACTION_SHOW_REPORT;
        } else if (action.equals(ACTION_SHOW_REPORT)) {
            // A report was just displayed.  The screen will be displayed in query report mode again this time so the user
            // can change the criteria and re-submit the report.  The Save button will submit the form with a next action
            // of ACTION_SHOW_REPORT to show the report results again next time.
            nextAction = ACTION_SHOW_REPORT;
        } else if (action.equals(ACTION_SHOW_SELECT)) {
            // The Select button was just pushed.  The screen will be displayed in select mode this time,
            // so next time Save is pushed, need to update and then show screen in select mode again.
            nextAction = ACTION_UPDATE_SELECT;
        } else if (action.equals(ACTION_SHOW_UPDATE)) {
            // The screen will be displayed in update mode this time,
            // so next time Save is pushed, need to update and then show the screen in update mode the next time.
            nextAction = ACTION_UPDATE;
        } else if (action.equals(ACTION_UPDATE)) {
            // A record was just updated.  The screen will be displayed in read only mode this time, so the Save
            // button won't be visible.  No action will be required for the Save button.
            nextAction = ACTION_NONE;
        } else if (action.equals(ACTION_UPDATE_SELECT)) {
            // Select list was saved last time.  The screen will be displayed in select mode this time.
            // If the user pushes Save next time, need to update and put screen in select mode again.
            nextAction = ACTION_UPDATE_SELECT;
        }

        return nextAction;
    }

    /**
     * DOCUMENT ME!
     *
     * @param action 
     *
     * @return 
     */
    public boolean getProtect(String action) {
        if (action.equals(ACTION_SHOW) || action.equals(ACTION_INSERT) ||
                action.equals(ACTION_UPDATE) || action.equals(ACTION_QUERY) ||
                action.equals("") || (action == null)) {
            return true;
        } else {
            return false;
        }
    }
}

⌨️ 快捷键说明

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