📄 securityconfigpanel.java
字号:
addPermissions(elp, className); } public void setupPanels() { GridBagConstraints cns = new GridBagConstraints(); cns.weightx = 0.0; cns.weighty = 0.0; cns.fill = GridBagConstraints.NONE; cns.anchor = GridBagConstraints.WEST; cns.ipadx = cns.ipady = 3; cns.insets = new Insets(10, 5, 5, 5); setConstraints(cns); Choice choice = new Choice(); choice.addItem(LABEL_FILE_PERMISSION); choice.addItem(LABEL_SOCKET_PERMISSION); choice.addItem(LABEL_AWT_PERMISSION); // + choice.addItem(LABEL_NET_PERMISSION); choice.addItem(LABEL_PROPERTY_PERMISSION); // + choice.addItem(LABEL_REFLECT_PERMISSION); choice.addItem(LABEL_RUNTIME_PERMISSION); choice.addItem(LABEL_SECURITY_PERMISSION); // + choice.addItem(LABEL_SERIALIZABLE_PERMISSION); choice.addItem(LABEL_ALL_PERMISSION); choice.addItem(LABEL_AGLET_PERMISSION); choice.addItem(LABEL_MESSAGE_PERMISSION); choice.addItem(LABEL_CONTEXT_PERMISSION); // - choice.addItem(LABEL_THREAD_PERMISSION); // # choice.addItem(LABEL_ACTIVITY_PERMISSION); choice.addItem(LABEL_AGLET_PROTECTION); choice.addItem(LABEL_MESSAGE_PROTECTION); choice.select(LABEL_FILE_PERMISSION); choice.addItemListener(this); add(choice, GridBagConstraints.REMAINDER, 0.0); cns.weightx = 1.0; cns.weighty = 1.0; cns.fill = GridBagConstraints.BOTH; cns.anchor = GridBagConstraints.CENTER; add(setting_panel, GridBagConstraints.REMAINDER, 1.0); setting_panel.setLayout(layout); BorderPanel filePermPanel = getBorderPanel(LABEL_FILE_PERMISSION); setting_panel.add(LABEL_FILE_PERMISSION, filePermPanel); BorderPanel socketPermPanel = getBorderPanel(LABEL_SOCKET_PERMISSION); setting_panel.add(LABEL_SOCKET_PERMISSION, socketPermPanel); BorderPanel awtPermPanel = getBorderPanel(LABEL_AWT_PERMISSION); setting_panel.add(LABEL_AWT_PERMISSION, awtPermPanel); // + BorderPanel netPermPanel = getBorderPanel(LABEL_NET_PERMISSION); // + setting_panel.add(LABEL_NET_PERMISSION, netPermPanel); BorderPanel propertyPermPanel = getBorderPanel(LABEL_PROPERTY_PERMISSION); setting_panel.add(LABEL_PROPERTY_PERMISSION, propertyPermPanel); // + BorderPanel reflectPermPanel = getBorderPanel(LABEL_REFLECT_PERMISSION); // + setting_panel.add(LABEL_REFLECT_PERMISSION, reflectPermPanel); BorderPanel runtimePermPanel = getBorderPanel(LABEL_RUNTIME_PERMISSION); setting_panel.add(LABEL_RUNTIME_PERMISSION, runtimePermPanel); BorderPanel securityPermPanel = getBorderPanel(LABEL_SECURITY_PERMISSION); setting_panel.add(LABEL_SECURITY_PERMISSION, securityPermPanel); // + BorderPanel serializablePermPanel = getBorderPanel(LABEL_SERIALIZABLE_PERMISSION); // + setting_panel.add(LABEL_SERIALIZABLE_PERMISSION, serializablePermPanel); BorderPanel allPermPanel = getBorderPanel(LABEL_ALL_PERMISSION); setting_panel.add(LABEL_ALL_PERMISSION, allPermPanel); BorderPanel agletPermPanel = getBorderPanel(LABEL_AGLET_PERMISSION); setting_panel.add(LABEL_AGLET_PERMISSION, agletPermPanel); BorderPanel messagePermPanel = getBorderPanel(LABEL_MESSAGE_PERMISSION); setting_panel.add(LABEL_MESSAGE_PERMISSION, messagePermPanel); BorderPanel contextPermPanel = getBorderPanel(LABEL_CONTEXT_PERMISSION); setting_panel.add(LABEL_CONTEXT_PERMISSION, contextPermPanel); // - BorderPanel threadPermPanel = getBorderPanel(LABEL_THREAD_PERMISSION); // - setting_panel.add(LABEL_THREAD_PERMISSION, threadPermPanel); // # BorderPanel activityPermPanel = getBorderPanel(LABEL_ACTIVITY_PERMISSION); // # setting_panel.add(LABEL_ACTIVITY_PERMISSION, activityPermPanel); BorderPanel agletProtPanel = getBorderPanel(LABEL_AGLET_PROTECTION); setting_panel.add(LABEL_AGLET_PROTECTION, agletProtPanel); BorderPanel messageProtPanel = getBorderPanel(LABEL_MESSAGE_PROTECTION); setting_panel.add(LABEL_MESSAGE_PROTECTION, messageProtPanel); // - setupFilePermissionPanel(filePermPanel); // - setupSocketPermissionPanel(socketPermPanel); // - setupAWTPermissionPanel(awtPermPanel); // - setupNetPermissionPanel(netPermPanel); // - setupPropertyPermissionPanel(propertyPermPanel); // - setupReflectPermissionPanel(reflectPermPanel); // - setupRuntimePermissionPanel(runtimePermPanel); // - setupSecurityPermissionPanel(securityPermPanel); // - setupSerializablePermissionPanel(serializablePermPanel); // - setupSerializablePermissionPanel(allPermPanel); // - setupAgletPermissionPanel(agletPermPanel); // - setupMessagePermissionPanel(messagePermPanel); // - setupContextPermissionPanel(contextPermPanel); // - setupThreadPermissionPanel(threadPermPanel); // # //- setupActivityPermissionPanel(activityPermPanel); // - setupAgletProtectionPanel(agletProtPanel); // - setupMessageProtectionPanel(messageProtPanel); setupGeneralPermissionPanel(filePermPanel, _filePermList, _filePermEditor, CLASSNAME_FILE_PERMISSION); setupGeneralPermissionPanel(socketPermPanel, _socketPermList, _socketPermEditor, CLASSNAME_SOCKET_PERMISSION); setupGeneralPermissionPanel(awtPermPanel, _awtPermList, _awtPermEditor, CLASSNAME_AWT_PERMISSION); // + setupGeneralPermissionPanel(netPermPanel, _netPermList, _netPermEditor, CLASSNAME_NET_PERMISSION); setupGeneralPermissionPanel(propertyPermPanel, _propertyPermList, _propertyPermEditor, CLASSNAME_PROPERTY_PERMISSION); // + setupGeneralPermissionPanel(reflectPermPanel, _reflectPermList, _reflectPermEditor, CLASSNAME_REFLECT_PERMISSION); setupGeneralPermissionPanel(runtimePermPanel, _runtimePermList, _runtimePermEditor, CLASSNAME_RUNTIME_PERMISSION); setupGeneralPermissionPanel(securityPermPanel, _securityPermList, _securityPermEditor, CLASSNAME_SECURITY_PERMISSION); // + setupGeneralPermissionPanel(serializablePermPanel, _serializablePermList, _serializablePermEditor, CLASSNAME_SERIALIZABLE_PERMISSION); setupGeneralPermissionPanel(allPermPanel, _allPermList, _allPermEditor, CLASSNAME_ALL_PERMISSION); setupGeneralPermissionPanel(agletPermPanel, _agletPermList, _agletPermEditor, CLASSNAME_AGLET_PERMISSION); setupGeneralPermissionPanel(messagePermPanel, _messagePermList, _messagePermEditor, CLASSNAME_MESSAGE_PERMISSION); setupGeneralPermissionPanel(contextPermPanel, _contextPermList, _contextPermEditor, CLASSNAME_CONTEXT_PERMISSION); // - setupGeneralPermissionPanel(threadPermPanel, _threadPermList, _threadPermEditor, CLASSNAME_THREAD_PERMISSION); // # setupGeneralPermissionPanel(activityPermPanel, _activityPermList, _activityPermEditor, CLASSNAME_ACTIVITY_PERMISSION); setupGeneralPermissionPanel(agletProtPanel, _agletProtList, _agletProtEditor, CLASSNAME_AGLET_PROTECTION); setupGeneralPermissionPanel(messageProtPanel, _messageProtList, _messageProtEditor, CLASSNAME_MESSAGE_PROTECTION); } // - /* // - * setup File Permission Panel // - */ // - void setupFilePermissionPanel(BorderPanel panel) { // - setupGeneralPermissionPanel(panel, _filePermList, _filePermEditor, CLASSNAME_FILE_PERMISSION); // - } // - // - /* // - * setup Socket Permission Panel // - */ // - void setupSocketPermissionPanel(BorderPanel panel) { // - setupGeneralPermissionPanel(panel, _socketPermList, _socketPermEditor, CLASSNAME_SOCKET_PERMISSION); // - } // - // - /* // - * setup AWT Permission Panel // - */ // - void setupAWTPermissionPanel(BorderPanel panel) { // - setupGeneralPermissionPanel(panel, _awtPermList, _awtPermEditor, CLASSNAME_AWT_PERMISSION); // - } // - // - /* // - * setup Net Permission Panel // - */ // - void setupNetPermissionPanel(BorderPanel panel) { // - setupGeneralPermissionPanel(panel, _netPermList, _netPermEditor, CLASSNAME_NET_PERMISSION); // - } // - // - /* // - * setup Property Permission Panel // - */ // - void setupPropertyPermissionPanel(BorderPanel panel) { // - setupGeneralPermissionPanel(panel, _propertyPermList, _propertyPermEditor, CLASSNAME_PROPERTY_PERMISSION); // - } // - // - /* // - * setup Reflect Permission Panel // - */ // - void setupReflectPermissionPanel(BorderPanel panel) { // - setupGeneralPermissionPanel(panel, _reflectPermList, _reflectPermEditor, CLASSNAME_REFLECT_PERMISSION); // - } // - // - /* // - * setup Runtime Permission Panel // - */ // - void setupRuntimePermissionPanel(BorderPanel panel) { // - setupGeneralPermissionPanel(panel, _runtimePermList, _runtimePermEditor, CLASSNAME_RUNTIME_PERMISSION); // - } // - // - /* // - * setup Security Permission Panel // - */ // - void setupSecurityPermissionPanel(BorderPanel panel) { // - setupGeneralPermissionPanel(panel, _securityPermList, _securityPermEditor, CLASSNAME_SECURITY_PERMISSION); // - } // - // - /* // - * setup Serializable Permission Panel // - */ // - void setupSerializablePermissionPanel(BorderPanel panel) { // - setupGeneralPermissionPanel(panel, _serializablePermList, _serializablePermEditor, CLASSNAME_SERIALIZABLE_PERMISSION); // - } // - // - /* // - * setup All Other Permission Panel // - */ // - void setupAllPermissionPanel(BorderPanel panel) { // - setupGeneralPermissionPanel(panel, _allPermList, _allPermEditor, CLASSNAME_ALL_PERMISSION); // - } // - // - /* // - * setup Aglet Permission Panel // - */ // - void setupAgletPermissionPanel(BorderPanel panel) { // - setupGeneralPermissionPanel(panel, _agletPermList, _agletPermEditor, CLASSNAME_AGLET_PERMISSION); // - } // - // - /* // - * setup Message Permission Panel // - */ // - void setupMessagePermissionPanel(BorderPanel panel) { // - setupGeneralPermissionPanel(panel, _messagePermList, _messagePermEditor, CLASSNAME_MESSAGE_PERMISSION); // - } // - // - /* // - * setup Aglet Context Permission Panel // - */ // - void setupContextPermissionPanel(BorderPanel panel) { // - setupGeneralPermissionPanel(panel, _contextPermList, _contextPermEditor, CLASSNAME_CONTEXT_PERMISSION); // - } // - // - /* // - * setup Thread Permission Panel // - */ // - void setupThreadPermissionPanel(BorderPanel panel) { // - setupGeneralPermissionPanel(panel, _threadPermList, _threadPermEditor, CLASSNAME_THREAD_PERMISSION); // - } // - // # //- /* // # //- * setup Activity Permission Panel // # //- */ // # //- void setupActivityPermissionPanel(BorderPanel panel) { // # //- setupGeneralPermissionPanel(panel, _activityPermList, _activityPermEditor, CLASSNAME_ACTIVITY_PERMISSION); // # //- } // # //- // - /* // - * setup Aglet Protection Panel // - */ // - void setupAgletProtectionPanel(BorderPanel panel) { // - setupGeneralPermissionPanel(panel, _agletProtList, _agletProtEditor, CLASSNAME_AGLET_PROTECTION); // - } // - // - /* // - * setup Message Protection Panel // - */ // - void setupMessageProtectionPanel(BorderPanel panel) { // - setupGeneralPermissionPanel(panel, _messageProtList, _messageProtEditor, CLASSNAME_MESSAGE_PROTECTION); // - } // - // // // - void restoreDefaults() { // - //- _winWarning.setState(true); // - _filePermList.removeAll(); // - _socketPermList.removeAll(); // - _awtPermList.removeAll(); // - _netPermList.removeAll(); // - _propertyPermList.removeAll(); // - _reflectPermList.removeAll(); // - _runtimePermList.removeAll(); // - _securityPermList.removeAll(); // - _serializablePermList.removeAll(); // - _allPermList.removeAll(); // - _agletPermList.removeAll(); // - _messagePermList.removeAll(); // - _contextPermList.removeAll(); // - _threadPermList.removeAll(); // - //# _activityPermList.removeAll(); // - _agletProtList.removeAll(); // - _messageProtList.removeAll(); // - } /* * */ void updateValues() { // - Resource privilege_res = Resource.getResourceFor("security." + name); // - // - Resource res = Resource.getResourceFor("aglets"); // - /* read */ // - _readPathList.removeAll(); // - String readDirs = privilege_res.getString("file.read"); // - StringTokenizer st = // - new StringTokenizer(readDirs == null ? "" : readDirs, " ,;"); // - while(st.hasMoreTokens()) { // - _readPathList.addItem( st.nextToken() ); // - } // - // - /* write */ // - _writePathList.removeAll(); // - String writeDirs = privilege_res.getString("file.write"); // - st = new StringTokenizer(writeDirs == null ? "" : writeDirs, " ,;"); // - while(st.hasMoreTokens()) { // - _writePathList.addItem( st.nextToken() ); // - } // - // - String s[] = privilege_res.getPersistentResourcesStartsWith("socket.connect."); // - _connectHosts.removeAll(); // - if (s != null && s.length>0) { // - for(int i=0; i<s.length; i++) { // - _connectHosts.addItem(s[i].substring(15)); // - } // - } // - // - s = privilege_res.getPersistentResourcesStartsWith("socket.listen."); // - _listenPorts.removeAll(); // - // - if (s != null && s.length>0) { // - StringBuffer buff = new StringBuffer(); // - for(int i=0; i<s.length; i++) { // - _listenPorts.addItem(s[i].substring(14)); // - } // - } // - // - /* others */ // - _winWarning.setState(privilege_res.getBoolean("window.warning",false)); // - _winOpen.setState(privilege_res.getBoolean("window.open", false)); // - // - _enableJDBC.setState(privilege_res.getBoolean("enable.jdbc",false)); // - _enableRMIClient.setState(privilege_res.getBoolean("enable.rmiclient",false)); // - _enableRMIServer.setState(privilege_res.getBoolean("enable.rmiserver",false)); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -