📄 jbprofilemenu.java
字号:
/*
* OPIAM Suite
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package opiam.admin.faare.struts.service.beans;
import java.util.HashMap;
import java.util.Map;
/**
* This element corresponds to the "profile" element of the menus_conf.xml file.<br>
* It allows to associate a profile with a set of menus.
*
*/
public class JBProfileMenu
{
/** Profile name. */
private String name;
/** Profile menus (Key = menu name, value = JBMenu). */
private Map menusMap = new HashMap();
/**
* Returns the profile name.
* @return name
*/
public String getName()
{
return name;
}
/**
* Sets the profile name.
* @param aname The name to set
*/
public void setName(String aname)
{
this.name = aname;
}
/**
* Adds a menu to the profile.
*
* @param menu menu to add
*/
public void addMenu(JBMenu menu)
{
menusMap.put(menu.getName().trim().toLowerCase(), menu);
}
/**
* Gets a menu from its name.
*
* @param aname menu name
*
* @return menu
*/
public JBMenu findMenuByName(String aname)
{
String key;
// rendre case insensitive en mettant le param en lowercase
key = aname.trim().toLowerCase();
return (JBMenu) menusMap.get(key);
}
/**
* Returns the menus associated with the profile.
* @return Map with key = menu name, value = JBMenu
*/
public Map getMenusMap()
{
return menusMap;
}
/**
* Displays the per profile menus.
*
* @return String formatted menus configuration.
*/
public String toString()
{
StringBuffer buf = new StringBuffer();
java.util.Iterator it = null;
buf.append("name = ");
buf.append(name);
buf.append(System.getProperty("line.separator"));
if (menusMap != null)
{
buf.append("Map components of menusMap = ");
buf.append(System.getProperty("line.separator"));
it = menusMap.keySet().iterator();
Object key;
while (it.hasNext())
{
buf.append("...");
key = it.next();
buf.append(key);
buf.append(" = ");
buf.append(menusMap.get(key));
buf.append(System.getProperty("line.separator"));
}
}
return buf.toString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -