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

📄 a_cmslistexplorerdialog.java

📁 找了很久才找到到源代码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
     * 
     * @param item the item representing the resource
     * 
     * @return a resource util object
     */
    public CmsResourceUtil getResourceUtil(CmsListItem item) {

        CmsResourceUtil resUtil = getResourceUtil();
        resUtil.setResource(getCollector().getResource(getCms(), item));
        return resUtil;
    }

    /**
     * Sets the Show explorer parameter value.<p>
     *
     * @param showExplorer the Show explorer parameter value to set
     */
    public void setParamShowexplorer(String showExplorer) {

        m_paramShowexplorer = showExplorer;
    }

    /**
     * Applies the column visibilities.<p>
     */
    protected void applyColumnVisibilities() {

        setColumnVisibilities();
        CmsListMetadata metadata = getList().getMetadata();
        metadata.getColumnDefinition(LIST_COLUMN_SITE).setVisible(isColumnVisible(LIST_COLUMN_SITE.hashCode()));
        metadata.getColumnDefinition(LIST_COLUMN_EDIT).setVisible(isColumnVisible(LIST_COLUMN_EDIT.hashCode()));
        metadata.getColumnDefinition(LIST_COLUMN_TYPEICON).setVisible(isColumnVisible(LIST_COLUMN_TYPEICON.hashCode()));
        metadata.getColumnDefinition(LIST_COLUMN_LOCKICON).setVisible(isColumnVisible(LIST_COLUMN_LOCKICON.hashCode()));
        metadata.getColumnDefinition(LIST_COLUMN_PROJSTATEICON).setVisible(
            isColumnVisible(LIST_COLUMN_PROJSTATEICON.hashCode()));
        metadata.getColumnDefinition(LIST_COLUMN_NAME).setVisible(isColumnVisible(LIST_COLUMN_NAME.hashCode()));
        metadata.getColumnDefinition(LIST_COLUMN_TITLE).setVisible(isColumnVisible(CmsUserSettings.FILELIST_TITLE));
        metadata.getColumnDefinition(LIST_COLUMN_TYPE).setVisible(isColumnVisible(CmsUserSettings.FILELIST_TYPE));
        metadata.getColumnDefinition(LIST_COLUMN_SIZE).setVisible(isColumnVisible(CmsUserSettings.FILELIST_SIZE));
        metadata.getColumnDefinition(LIST_COLUMN_PERMISSIONS).setVisible(
            isColumnVisible(CmsUserSettings.FILELIST_PERMISSIONS));
        metadata.getColumnDefinition(LIST_COLUMN_DATELASTMOD).setVisible(
            isColumnVisible(CmsUserSettings.FILELIST_DATE_LASTMODIFIED));
        metadata.getColumnDefinition(LIST_COLUMN_USERLASTMOD).setVisible(
            isColumnVisible(CmsUserSettings.FILELIST_USER_LASTMODIFIED));
        metadata.getColumnDefinition(LIST_COLUMN_DATECREATE).setVisible(
            isColumnVisible(CmsUserSettings.FILELIST_DATE_CREATED));
        metadata.getColumnDefinition(LIST_COLUMN_USERCREATE).setVisible(
            isColumnVisible(CmsUserSettings.FILELIST_USER_CREATED));
        metadata.getColumnDefinition(LIST_COLUMN_DATEREL).setVisible(
            isColumnVisible(CmsUserSettings.FILELIST_DATE_RELEASED));
        metadata.getColumnDefinition(LIST_COLUMN_DATEEXP).setVisible(
            isColumnVisible(CmsUserSettings.FILELIST_DATE_EXPIRED));
        metadata.getColumnDefinition(LIST_COLUMN_STATE).setVisible(isColumnVisible(CmsUserSettings.FILELIST_STATE));
        metadata.getColumnDefinition(LIST_COLUMN_LOCKEDBY).setVisible(
            isColumnVisible(CmsUserSettings.FILELIST_LOCKEDBY));
    }

    /**
     * @see org.opencms.workplace.list.A_CmsListDialog#defaultActionHtmlStart()
     */
    protected String defaultActionHtmlStart() {

        StringBuffer result = new StringBuffer(2048);
        result.append(htmlStart(null));
        result.append(getList().listJs());
        result.append(CmsListExplorerColumn.getExplorerStyleDef());
        result.append(bodyStart("dialog", null));
        result.append(dialogStart());
        result.append(dialogContentStart(getParamTitle()));
        return result.toString();
    }

    /**
     * @see org.opencms.workplace.list.A_CmsListDialog#executeSelectPage()
     */
    protected void executeSelectPage() {

        super.executeSelectPage();
        getSettings().setExplorerPage(getList().getCurrentPage());
    }

    /**
     * @see org.opencms.workplace.list.A_CmsListDialog#fillList()
     */
    protected void fillList() {

        getListState().setPage(getSettings().getExplorerPage());
        super.fillList();
    }

    /**
     * Returns the colVisibilities map.<p>
     *
     * @return the colVisibilities map
     */
    protected Map getColVisibilities() {

        return m_colVisibilities;
    }

    /**
     * @see org.opencms.workplace.list.A_CmsListDialog#getListItems()
     */
    protected List getListItems() throws CmsException {

        return getCollector().getListItems(null);
    }

    /**
     * Returns the list state for initializing the collector.<p>
     * 
     * @return the list state
     */
    protected CmsListState getListStateForCollector() {

        CmsListState lstate = new CmsListState();
        if (getList() != null) {
            lstate = getListState();
        }
        switch (getAction()) {
            //////////////////// ACTION: default actions
            case ACTION_LIST_SEARCH:
                if (getParamSearchFilter() == null) {
                    setParamSearchFilter("");
                }
                if (getParamSearchFilter().equals(lstate.getFilter())) {
                    lstate.setOrder(CmsListOrderEnum.ORDER_DESCENDING);
                } else {
                    lstate.setOrder(CmsListOrderEnum.ORDER_ASCENDING);
                }
                lstate.setFilter(getParamSearchFilter());
                break;
            case ACTION_LIST_SORT:
                lstate.setColumn(getParamSortCol());
                break;
            case ACTION_LIST_SELECT_PAGE:
                int page = Integer.valueOf(getParamPage()).intValue();
                lstate.setPage(page);
                break;
            default:
                // no op
        }
        return lstate;
    }

    /**
     * Returns the project to use as reference.<p>
     * 
     * @return the project to use as reference
     */
    protected CmsProject getProject() {

        return getCms().getRequestContext().currentProject();
    }

    /**
     * @see org.opencms.workplace.CmsWorkplace#initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest)
     */
    protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, HttpServletRequest request) {

        super.initWorkplaceRequestValues(settings, request);
        // this to show first the exlorer view
        if (getShowExplorer()) {
            CmsUUID projectId = getProject().getUuid();
            Map params = new HashMap();
            // set action parameter to initial dialog call
            params.put(CmsDialog.PARAM_ACTION, CmsDialog.DIALOG_INITIAL);
            params.putAll(getToolManager().getCurrentTool(this).getHandler().getParameters(this));

            getSettings().setExplorerProjectId(projectId);
            getSettings().setCollector(getCollector());
            getSettings().setExplorerMode(CmsExplorer.VIEW_LIST);
            try {
                setShowExplorer(true);
                getToolManager().jspForwardPage(this, PATH_DIALOGS + "list-explorer.jsp", params);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        } else {
            setShowExplorer(false);
        }
    }

    /**
     * Returns the visibility flag for a given column.<p>
     * 
     * The default behavior is to show the same columns as the explorer view,
     * but this can be overwritten.<p>
     * 
     * @param colFlag some {@link CmsUserSettings#FILELIST_TITLE} like value 
     *              identifying the column to get the visibility flag for
     *  
     * @return the visibility flag for the given column
     */
    protected boolean isColumnVisible(int colFlag) {

        if (m_colVisibilities.get(new Integer(colFlag)) instanceof Boolean) {
            return ((Boolean)m_colVisibilities.get(new Integer(colFlag))).booleanValue();
        }
        return false;
    }

    /**
     * Adds the standard explorer view columns to the list.<p>
     * 
     * @see org.opencms.workplace.list.A_CmsListDialog#setColumns(org.opencms.workplace.list.CmsListMetadata)
     */
    protected void setColumns(CmsListMetadata metadata) {

        setColumnVisibilities();

        // position 0: icon
        CmsListColumnDefinition typeIconCol = new CmsListColumnDefinition(LIST_COLUMN_TYPEICON);
        typeIconCol.setName(Messages.get().container(Messages.GUI_EXPLORER_LIST_COLS_ICON_0));
        typeIconCol.setHelpText(Messages.get().container(Messages.GUI_EXPLORER_LIST_COLS_ICON_HELP_0));
        typeIconCol.setWidth("20");
        typeIconCol.setAlign(CmsListColumnAlignEnum.ALIGN_CENTER);
        typeIconCol.setListItemComparator(new CmsListItemActionIconComparator());

        // add resource icon action
        CmsListDirectAction resourceTypeIconAction = new CmsListResourceTypeIconAction(LIST_ACTION_TYPEICON);
        resourceTypeIconAction.setEnabled(false);
        typeIconCol.addDirectAction(resourceTypeIconAction);
        metadata.addColumn(typeIconCol);

        // position 1: edit button
        CmsListColumnDefinition editIconCol = new CmsListColumnDefinition(LIST_COLUMN_EDIT);
        editIconCol.setName(Messages.get().container(Messages.GUI_EXPLORER_LIST_COLS_EDIT_0));
        editIconCol.setHelpText(Messages.get().container(Messages.GUI_EXPLORER_LIST_COLS_EDIT_HELP_0));
        editIconCol.setWidth("20");
        editIconCol.setAlign(CmsListColumnAlignEnum.ALIGN_CENTER);

        // add enabled edit action
        CmsListDirectAction editAction = new CmsListEditResourceAction(LIST_ACTION_EDIT, LIST_COLUMN_NAME);
        editAction.setEnabled(true);
        editIconCol.addDirectAction(editAction);
        // add disabled edit action
        CmsListDirectAction noEditAction = new CmsListEditResourceAction(LIST_ACTION_EDIT + "d", LIST_COLUMN_NAME);
        noEditAction.setEnabled(false);
        editIconCol.addDirectAction(noEditAction);
        metadata.addColumn(editIconCol);

⌨️ 快捷键说明

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