cmsnewresourcexmlcontentmodel.java

来自「找了很久才找到到源代码」· Java 代码 · 共 512 行 · 第 1/2 页

JAVA
512
字号
                Long.MAX_VALUE,
                0,
                0,
                0,
                0);
            modelFiles.add(dummy);
            // add the real model files to the list
            modelFiles.addAll(realModelFiles);
            m_collector = new CmsNewResourceXmlContentModelCollector(this, modelFiles);
        }
        return m_collector;
    }

    /**
     * @see org.opencms.workplace.list.A_CmsSelectResourceList#getListTitle()
     */
    public String getListTitle() {

        return key(Messages.GUI_NEWRESOURCE_XMLCONTENT_CHOOSEMODEL_0);
    }

    /**
     * Returns the parameter to check if a ".html" suffix should be added to the new resource name.<p>
     * 
     * @return the parameter to check if a ".html" suffix should be added to the new resource name
     */
    public String getParamAppendSuffixHtml() {

        return m_paramAppendSuffixHtml;
    }

    /**
     * Returns the back link URL used when displaying the dialog in pre editor mode.<p>
     * 
     * @return the back link URL used when displaying the dialog in pre editor mode
     */
    public String getParamBackLink() {

        return m_paramBackLink;
    }

    /**
     * Returns the parameter that specifies the model file name.<p>
     * 
     * @return the parameter that specifies the model file name
     */
    public String getParamModelFile() {

        return m_paramModelFile;
    }

    /**
     * Returns the new resource edit properties flag parameter.<p>
     * 
     * @return the new resource edit properties flag parameter
     */
    public String getParamNewResourceEditProps() {

        return m_paramNewResourceEditProps;
    }

    /**
     * Returns the new resource type parameter.<p>
     * 
     * @return the new resource type parameter
     */
    public String getParamNewResourceType() {

        return m_paramNewResourceType;
    }

    /**
     * @see org.opencms.workplace.list.A_CmsSelectResourceList#nextUrl()
     */
    public String nextUrl() {

        return VFS_PATH_COMMONS + "newresource_xmlcontent.jsp";

    }

    /**
     * Sets the parameter to check if a ".html" suffix should be added to the new resource name.<p>
     * 
     * @param paramAppendSuffixHtml the parameter to check if a ".html" suffix should be added to the new resource name
     */
    public void setParamAppendSuffixHtml(String paramAppendSuffixHtml) {

        m_paramAppendSuffixHtml = paramAppendSuffixHtml;
    }

    /**
     * Sets the back link URL used when displaying the dialog in pre editor mode.<p>
     * 
     * @param paramBackLink the back link URL used when displaying the dialog in pre editor mode
     */
    public void setParamBackLink(String paramBackLink) {

        m_paramBackLink = paramBackLink;
    }

    /**
     * Sets the parameter that specifies the model file name.<p>
     * 
     * @param paramMasterFile the parameter that specifies the model file name
     */
    public void setParamModelFile(String paramMasterFile) {

        m_paramModelFile = paramMasterFile;
    }

    /**
     * Sets the new resource edit properties flag parameter.<p>
     * 
     * @param newResourceEditProps the new resource edit properties flag parameter
     */
    public void setParamNewResourceEditProps(String newResourceEditProps) {

        m_paramNewResourceEditProps = newResourceEditProps;
    }

    /**
     * Sets the new resource type parameter.<p>
     * 
     * @param newResourceType the new resource type parameter
     */
    public void setParamNewResourceType(String newResourceType) {

        m_paramNewResourceType = newResourceType;
    }

    /**
     * Closes the dialog and forwards to the previed page in direct editor mode.<p>
     * 
     * @throws IOException if forwarding fails 
     * @throws ServletException if forwarding fails
     */
    protected void actionClose() throws IOException, ServletException {

        // editor is in direct edit mode
        if (CmsStringUtil.isNotEmpty(getParamBackLink())) {
            // set link to the specified back link target
            setParamCloseLink(getJsp().link(getParamBackLink()));
        } else {
            // set link to the edited resource
            setParamCloseLink(getJsp().link(getParamResource()));
        }
        // save initialized instance of this class in request attribute for included sub-elements
        getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this);
        // load the common JSP close dialog
        sendForward(FILE_DIALOG_CLOSE, new HashMap());
    }

    /**
     * @see org.opencms.workplace.list.A_CmsSelectResourceList#fillDetails(java.lang.String)
     */
    protected void fillDetails(String detailId) {

        // get listed model files
        List modelFiles = getList().getAllContent();
        Iterator i = modelFiles.iterator();
        while (i.hasNext()) {
            CmsListItem item = (CmsListItem)i.next();
            String resName = (String)item.get(LIST_COLUMN_NAME);
            String description = "";
            if (detailId.equals(LIST_DETAIL_DESCRIPTION)) {
                // set description detail
                try {
                    description = getJsp().property(CmsPropertyDefinition.PROPERTY_DESCRIPTION, resName, "");
                } catch (Exception e) {
                    // ignore it, because the dummy file throws an exception in any case
                }
            } else {
                continue;
            }
            item.set(detailId, description);
        }

    }

    /**
     * @see org.opencms.workplace.list.A_CmsListExplorerDialog#isColumnVisible(int)
     */
    protected boolean isColumnVisible(int colFlag) {

        // only show icon, name, title and datelastmodified columns
        if (colFlag == LIST_COLUMN_TYPEICON.hashCode()) {
            return true;
        }
        if (colFlag == LIST_COLUMN_NAME.hashCode()) {
            return true;
        }
        if (colFlag == CmsUserSettings.FILELIST_TITLE) {
            return true;
        }
        if (colFlag == CmsUserSettings.FILELIST_DATE_LASTMODIFIED) {
            return true;
        }
        // other columns are hidden
        return false;
    }

    /**
     * Removes the default "preview file" action from the file name column.<p>
     * 
     * @see org.opencms.workplace.list.A_CmsListExplorerDialog#setColumns(org.opencms.workplace.list.CmsListMetadata)
     */
    protected void setColumns(CmsListMetadata metadata) {

        super.setColumns(metadata);

        Iterator it = metadata.getColumnDefinitions().iterator();
        while (it.hasNext()) {
            CmsListColumnDefinition colDefinition = (CmsListColumnDefinition)it.next();
            if (colDefinition.getId().equals(LIST_COLUMN_NAME)) {

                // remove default "preview file" action from file name column
                colDefinition.removeDefaultAction(LIST_DEFACTION_OPEN);
            } else if (colDefinition.getId().equals(LIST_COLUMN_TYPEICON)) {

                // remove sorting on icon column
                colDefinition.setSorteable(false);

                // remove column name
                colDefinition.setName(org.opencms.workplace.list.Messages.get().container(
                    org.opencms.workplace.list.Messages.GUI_EXPLORER_LIST_COLS_EMPTY_0));
            }
        }

    }

    /**
     * @see org.opencms.workplace.list.A_CmsListExplorerDialog#setIndependentActions(org.opencms.workplace.list.CmsListMetadata)
     */
    protected void setIndependentActions(CmsListMetadata metadata) {

        // create list item detail: description
        CmsListItemDetails modelFileDescription = new CmsListItemDetails(LIST_DETAIL_DESCRIPTION);
        modelFileDescription.setAtColumn(LIST_COLUMN_NAME);
        modelFileDescription.setVisible(false);
        modelFileDescription.setFormatter(new CmsListItemDetailsFormatter(Messages.get().container(
            Messages.GUI_MODELFILES_LABEL_DESCRIPTION_0)));
        modelFileDescription.setShowActionName(Messages.get().container(
            Messages.GUI_MODELFILES_DETAIL_SHOW_DESCRIPTION_NAME_0));
        modelFileDescription.setShowActionHelpText(Messages.get().container(
            Messages.GUI_MODELFILES_DETAIL_SHOW_DESCRIPTION_HELP_0));
        modelFileDescription.setHideActionName(Messages.get().container(
            Messages.GUI_MODELFILES_DETAIL_HIDE_DESCRIPTION_NAME_0));
        modelFileDescription.setHideActionHelpText(Messages.get().container(
            Messages.GUI_MODELFILES_DETAIL_HIDE_DESCRIPTION_HELP_0));

        metadata.addItemDetails(modelFileDescription);

    }

}

⌨️ 快捷键说明

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