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

📄 cmstemplatecontentlistitem.java

📁 cms是开源的框架
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
            CmsTemplateContentListItem listItem = new CmsTemplateContentListItem();
            listItem.setType(type);
            // create workplace messages key prefix
            StringBuffer keyPrefix = new StringBuffer(8);
            keyPrefix.append("layout.").append(type).append('.').append(displayArea).append('.');
            // determine the collector name to use
            String collector = (String)properties.get(resolver.resolveMacros(PROPERTY_LAYOUT_COLLECTOR));
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(collector)) {
                collector = (String)defaultValues.get(keyPrefix + PARAM_COLLECTOR);
            }
            listItem.setCollector(collector);
            // determine the count of contents to display
            String count = (String)properties.get(resolver.resolveMacros(PROPERTY_LAYOUT_COUNT));
            String defaultCount = (String)defaultValues.get(keyPrefix + PARAM_COUNT);
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(count)) {
                count = defaultCount;
            }
            try {
                listItem.setCount(Integer.parseInt(count));
            } catch (NumberFormatException e) {
                // no valid number specified, use default value
                listItem.setCount(Integer.parseInt(defaultCount));
            }
            // determine the folder which holds the contents
            String folder = (String)properties.get(resolver.resolveMacros(PROPERTY_LAYOUT_FOLDER));
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(folder)) {
                folder = (String)defaultValues.get(keyPrefix + PARAM_FOLDER);
            }
            listItem.setFolder(resolver.resolveMacros(folder));
            // determine the list variation to use
            String variation = (String)properties.get(resolver.resolveMacros(PROPERTY_LAYOUT_VARIATION));
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(variation)) {
                variation = "";
            } else {
                variation = '.' + variation;
            }
            // set the JSP element uri creating the list considering the list variation
            String listElement = (String)defaultValues.get(keyPrefix + PARAM_LISTELEMENT + variation);
            listItem.setListElement(listElement);
            // set the display area of the list
            listItem.setDisplayArea(displayArea);
            return listItem;
        } else {
            // no type specified, return null
            return null;
        }
    }

    /**
     * Returns the collector to use for this list.<p>
     *
     * @return the collector to use for this list
     */
    public String getCollector() {

        return m_collector;
    }

    /**
     * Returns the maximum count of entries for elements.<p>
     *
     * @return the maximum count of entries for elements
     */
    public int getCount() {

        return m_count;
    }

    /**
     * Returns the display area for this XMLContent list.<p>
     * 
     * @return the display area for this XMLContent list
     */
    public String getDisplayArea() {

        return m_displayArea;
    }

    /**
     * Returns the folder which holds the XMLContent.<p>
     *
     * @return the folder which holds the XMLContent
     */
    public String getFolder() {

        return m_folder;
    }

    /**
     * Returns the list element URI to use to display the list.<p>
     * 
     * @return the list element URI to use to display the list
     */
    public String getListElement() {

        return m_listElement;
    }

    /**
     * Returns the XMLContent type.<p>
     *
     * @return the XMLContent type
     */
    public String getType() {

        return m_type;
    }

    /**
     * Returns the list variation.<p>
     *
     * @return the list variation
     */
    public String getVariation() {

        return m_variation;
    }

    /**
     * Includes the list generation JSP and creates the necessary request parameters for the included JSP.<p>
     * 
     * @param jsp the JSP action element
     * @param showPageLinks flag to determine if page links should be shown
     * 
     * @throws JspException if inclusion of the element fails
     */
    public void includeListItem(CmsJspActionElement jsp, boolean showPageLinks) throws JspException {

        Map properties = new HashMap(4);
        properties.put(PARAM_COLLECTOR, getCollector());
        properties.put(PARAM_COUNT, Integer.toString(getCount()));
        if (showPageLinks) {
            properties.put(PARAM_ELEMENTCOUNT, Integer.toString(Integer.MAX_VALUE));
        } else {
            properties.put(PARAM_ELEMENTCOUNT, Integer.toString(getCount()));
        }
        properties.put(PARAM_FOLDER, getFolder());
        jsp.include(getListElement(), null, properties);
    }

    /**
     * Sets the collector to use for this list.<p>
     *
     * @param collector the collector to use for this list
     */
    protected void setCollector(String collector) {

        m_collector = collector;
    }

    /**
     * Sets the maximum count of entries for elements.<p>
     *
     * @param count the maximum count of entries for elements
     */
    protected void setCount(int count) {

        m_count = count;
    }

    /**
     * Sets the display area for this XMLContent list.<p>
     * 
     * @param displayArea the display area for this XMLContent list
     */
    protected void setDisplayArea(String displayArea) {

        m_displayArea = displayArea;
    }

    /**
     * Sets the folder which holds the XMLContent.<p>
     *
     * @param contentFolder the folder which holds the XMLContent
     */
    protected void setFolder(String contentFolder) {

        m_folder = contentFolder;
    }

    /**
     * Sets the list element URI to use to display the list.<p>
     * 
     * @param listElement the list element URI to use to display the list
     */
    protected void setListElement(String listElement) {

        m_listElement = listElement;
    }

    /**
     * Sets the XMLContent type.<p>
     *
     * @param type the XMLContent type to set
     */
    protected void setType(String type) {

        m_type = type;
    }

    /**
     * Sets the list variation.<p>
     *
     * @param variation the list variation to set
     */
    protected void setVariation(String variation) {

        m_variation = variation;
    }
}

⌨️ 快捷键说明

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