📄 simplepermissionsadapter.java
字号:
/*
* SimplePermissionsAdapter.java
*
* Created on April 30, 2002, 1:27 AM
*/
package net.sf.navigator.example;
import java.util.ArrayList;
import net.sf.navigator.menu.MenuComponent;
import net.sf.navigator.menu.PermissionsAdapter;
/**
*
* @author ssayles
*/
public class SimplePermissionsAdapter implements PermissionsAdapter {
//~ Instance fields ========================================================
private ArrayList menuNames;
//~ Constructors ===========================================================
/**
* Creates a new instance of SimplePermissionAdapter
*/
public SimplePermissionsAdapter(String[] theMenuNames) {
menuNames = new ArrayList();
if (theMenuNames != null) {
for (int i = 0; i < theMenuNames.length; i++) {
menuNames.add(theMenuNames[i]);
}
}
}
//~ Methods ================================================================
/**
* If the menu is allowed, this should return true.
*
* @return whether or not the menu is allowed.
*/
public boolean isAllowed(MenuComponent menu) {
return !menuNames.contains(menu.getName());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -