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

📄 baserollermenu.java

📁 这个weblogging 设计得比较精巧
💻 JAVA
字号:
package org.roller.presentation.tags.menu;import java.util.ArrayList;import java.util.Arrays;import java.util.Iterator;import java.util.List;import javax.servlet.http.HttpServletRequest;import org.roller.RollerException;import org.roller.config.RollerConfig;import org.roller.presentation.RollerRequest;import org.roller.util.Utilities;/** * Base class for Roller menu objects. * @author Dave Johnson */public abstract class BaseRollerMenu{    protected String mName = null;    protected String mEnabledProperty = null;    protected String mDisabledProperty = null;    protected List mRoles = new ArrayList();        public BaseRollerMenu() {}        public BaseRollerMenu(String name) { mName = name; }        /** Name of menu */     public void setName( String v ) { mName = v; }    /** Name of menu */    public String getName() { return mName; }        /** Roles allowed to use menu, comma separated */     public void setRoles( String roles )     {        mRoles = Arrays.asList(Utilities.stringToStringArray(roles,","));    }        /** Name of property that enables menu (or null if always enabled) */    public void setEnabledProperty(String enabledProperty)    {        mEnabledProperty = enabledProperty;    }    /** Name of property that disable menu (or null if always enabled) */    public void setDisabledProperty(String disabledProperty)    {        mDisabledProperty = disabledProperty;    }        /** Determine if menu  should be shown to use of specified request */    public boolean isPermitted(HttpServletRequest req) throws RollerException    {        if (mEnabledProperty != null)         {            String enabledProp = RollerConfig.getProperty(mEnabledProperty);            if (enabledProp != null && enabledProp.equalsIgnoreCase("false"))            {                return false;            }        }        if (mDisabledProperty != null)         {            String disabledProp = RollerConfig.getProperty(mDisabledProperty);            if (disabledProp != null && disabledProp.equalsIgnoreCase("true"))            {                return false;            }        }        if (mRoles != null && mRoles.size() > 0)        {            Iterator roles = mRoles.iterator();            while (roles.hasNext())            {                RollerRequest rreq = RollerRequest.getRollerRequest(req);                String role = (String)roles.next();                if (req.isUserInRole(role))                 {                    return true;                }                else if (role.equals("admin") && rreq.isAdminUser())                 {                    return true;                }            }            return false;        }        return true;    }}

⌨️ 快捷键说明

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