📄 permisrolehierarchypolicy.java
字号:
/*
* Copyright (c) 2000-2005, University of Salford
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of the University of Salford nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package issrg.editor.gui;
import issrg.editor.RemoveFromList;
import issrg.editor.PermisDataBox;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.util.ResourceBundle;
import java.util.Hashtable;
import java.util.Enumeration;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusListener;
import java.awt.event.MouseListener;
import java.awt.event.FocusEvent;
import javax.swing.event.ListDataListener;
import javax.swing.event.ListDataEvent;
import javax.swing.border.TitledBorder;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import org.netbeans.lib.awtextra.AbsoluteConstraints;
import org.netbeans.lib.awtextra.AbsoluteLayout;
import org.w3c.dom.*;
/**
* Classname: PermisRoleHierarchyPolicy
*
* Description: This class creates the Role Hierarchy Policy windows, its
* associated buttons and their methods.
* Version 1.0.
*
* Copyright (c) authors April 2004
*
* @author Professor D.W.Chadwick
* P. Langley
* U. Mbanaso
*
*/
public class PermisRoleHierarchyPolicy extends PermisPolicyPanel implements ActionListener, ListDataListener, FocusListener
{
private static final String ADD_ACTION = "add";
private static final String VIEW_OK_ACTION = "view OK";
private static final String VIEW_PROMOTE_ACTION = "view promote";
private static final String VIEW_CLOSE_ACTION = "view close";
private static final String CANCEL_ACTION = "cancel";
private static final String HIERARCHY_DELETE_ACTION = "hierarchy delete";
private static final String ROLE_VIEW_ACTION = "role view";
private static final String ROLE_EDIT_ACTION = "role edit";
private static final String ROLE_DELETE_ACTION = "role delete";
private static final String CLOSE_ACTION = "close";
private static final String ROLE_SUB_ADD_ACTION = "role sub add";
private static final String ROLE_SUB_REMOVE_ACTION = "role sub remove";
private static final String ROLE_ACTION = "role";
private static final String HIERARCHY_OK_ACTION = "hierarchy ok";
private static final String HIERARCHY_CANCEL_ACTION = "hierarchy cancel";
private static final String HIERARCHY_CLOSE_ACTION = "hierarchy close";
private static final String ROLE_HIERARCHY_POLICY = "RoleHierarchyPolicy";
private static final String ROLE_SPEC = "RoleSpec";
private static final String TYPE = "Type";
private static final String OID = "OID";
private static final String SUP_ROLE = "SupRole";
private static final String SUB_ROLE = "SubRole";
private static final String VALUE = "Value";
private static int STATE = 1;
private DefaultListModel roleListModel;
private DefaultListModel avRoleListModel;
private DefaultListModel subRoleListModel;
private DefaultListModel roleViewListModel;
private JButton addRoleButton;
private JButton hierarchyCancelButton;
private JButton hierarchyCloseButton;
private JButton hierarchyDeleteButton;
private JButton hierarchyEditButton;
private JButton hierarchyOkButton;
private JButton roleSubAddButton;
private JButton roleSubRemoveButton;
private JButton viewOkButton;
private JButton viewCloseButton;
private JButton viewCancelButton;
private JButton viewPromoteButton;
private JButton roleEditButton;
private JButton roleDeleteButton;
private JButton closeButton;
private JButton cancelButton;
private JComboBox roleComboBox;
private JComboBox roleTypeComboBox;
private JComboBox roleViewComboBox;
private JInternalFrame roleHierarchyInternalFrame;
private JLabel roleHierarchyAvailableRoleLabel;
private JLabel roleHierarchyRoleOIDLabel;
private JLabel roleHierarchyRoleTypeLabel;
private JLabel roleHierarchyRoleTypesLabel;
private JLabel roleHierarchyRoleValueLabel;
private JLabel roleHierarchySubRoleLabel;
private JLabel roleHierarchSupRoleLabel;
private JList availableRoleList;
private JList subRoleList;
private JList roleValueList;
private JList roleViewList;
private JPanel hierarchyButtonPanel;
private JPanel hierarchyCreatePanel;
private JPanel hierarchyPromotePanel;
private JPanel roleHierarchyAddButtonPanel;
private JPanel roleHierarchyButtonPanel;
private JPanel roleHierarchyCreatePanel;
private JPanel roleHierarchyEditButtonsPanel;
private JPanel roleHierarchyExistingRolePanel;
private JPanel roleHierarchyRoleOIDPanel;
private JPanel rolehierarchyRoleTypePanel;
private JPanel roleHierarchyRoleValuePanel;
private JPanel viewPanel;
private JPanel viewButtonPanel;
private JPanel roleHierarchViewPanel;
private JPanel rolePolicyAvailableDomainsPanel;
private JPanel rolePolicyButtonPanel;
private JScrollPane roleHierarchyAvailableRolesScrollPane;
private JScrollPane roleHierarchyExistingRolesScrollPane;
private JScrollPane roleHierarchySubordinateRolesScrollPane;
private JScrollPane rolePolicyViewScrollPane;
private JTabbedPane roleHierarchyTabbedPane;
private JTextField roleIDTextField;
private JTextField roleTextField;
private JTextField roleTypeTextField;
private Hashtable deleteSubRolHastable;
private Hashtable deletedHastable;
boolean promtePressed = false;
boolean roleSubAdd = false;
private PermisPolicyLoader loader;
private PermisPolicyEditorButton parent;
private Element selectedSupRole = null;
/**
* Constructor
*/
public PermisRoleHierarchyPolicy(PermisPolicyEditorButton parent)
{
this.parent = parent;
loader = this.parent.getLoader();
}
public void setEditPressed(boolean set)
{
this.promtePressed = set;
}
public void setState(int i)
{
this.STATE = i;
}
public int getState()
{
return this.STATE;
}
/**
* This method creates an instance of the classs and initilaises all the
* relevant variables
*
* @return A JInternalFrame containing the Role Hierarchy Policy
* windows.
*/
public JInternalFrame createPolicy()
{
avRoleListModel= new DefaultListModel();
roleListModel= new DefaultListModel();
subRoleListModel = new DefaultListModel();
roleViewListModel = new DefaultListModel();
addRoleButton = new JButton();
hierarchyCancelButton = new JButton();
hierarchyCloseButton = new JButton();
hierarchyDeleteButton = new JButton();
hierarchyEditButton = new JButton();
hierarchyOkButton = new JButton();
roleSubAddButton = new JButton();
roleSubRemoveButton = new JButton();
viewOkButton = new JButton();
viewCancelButton = new JButton();
viewPromoteButton = new JButton();
viewCloseButton = new JButton();
roleEditButton = new JButton();
roleDeleteButton = new JButton();
closeButton = new JButton();
cancelButton = new JButton();
roleComboBox = new JComboBox();
roleTypeComboBox = new JComboBox();
roleViewComboBox = new JComboBox();
roleHierarchyInternalFrame = new JInternalFrame();
roleHierarchyAvailableRoleLabel = new JLabel();
roleHierarchyRoleOIDLabel = new JLabel();
roleHierarchyRoleValueLabel = new JLabel();
roleHierarchyRoleTypeLabel = new JLabel();
roleHierarchSupRoleLabel = new JLabel();
roleHierarchySubRoleLabel = new JLabel();
roleHierarchyRoleTypesLabel = new JLabel();
availableRoleList = new JList(avRoleListModel);
roleValueList = new JList(roleListModel);
subRoleList = new JList(subRoleListModel);
roleViewList = new JList(roleViewListModel);
hierarchyButtonPanel = new JPanel();
hierarchyCreatePanel = new JPanel();
hierarchyPromotePanel = new JPanel();
roleHierarchyAddButtonPanel = new JPanel();
roleHierarchyButtonPanel = new JPanel();
roleHierarchyCreatePanel = new JPanel();
roleHierarchyEditButtonsPanel = new JPanel();
roleHierarchyExistingRolePanel = new JPanel();
roleHierarchyRoleOIDPanel = new JPanel();
roleHierarchyRoleValuePanel = new JPanel();
rolehierarchyRoleTypePanel = new JPanel();
roleHierarchViewPanel = new JPanel();
rolePolicyButtonPanel = new JPanel();
viewPanel = new JPanel();
viewButtonPanel = new JPanel();
rolePolicyAvailableDomainsPanel = new JPanel();
roleHierarchyAvailableRolesScrollPane = new JScrollPane();
roleHierarchyExistingRolesScrollPane = new JScrollPane();
roleHierarchySubordinateRolesScrollPane = new JScrollPane();
rolePolicyViewScrollPane = new JScrollPane();
roleHierarchyTabbedPane = new JTabbedPane();
roleTypeTextField = new JTextField();
roleTextField = new JTextField();
roleIDTextField = new JTextField();
deletedHastable = new Hashtable();
deleteSubRolHastable = new Hashtable();
setLayout(new BorderLayout());
roleHierarchyInternalFrame.getContentPane().
setLayout(new AbsoluteLayout());
subRoleListModel.addListDataListener(this);
roleHierarchyInternalFrame.setTitle(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("rol_hie_frm_title"));
hierarchyCreatePanel.setLayout(new AbsoluteLayout());
//
roleHierarchyCreatePanel.setLayout(new GridLayout(4,0));
roleHierarchyCreatePanel.setBorder(new TitledBorder(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("rol_hie_brd_create_role")));
roleHierarchyRoleValuePanel.setLayout(new AbsoluteLayout());
roleHierarchyRoleValueLabel.setText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("rol_hie_labl_role_value"));
roleHierarchyRoleValuePanel.add(roleHierarchyRoleValueLabel,
new AbsoluteConstraints(17, 10, 80, 20));
roleTextField.setToolTipText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("rol_hie_tt_tf"));
roleHierarchyRoleValuePanel.add(roleTextField,
new AbsoluteConstraints(120, 10, 320, -1));
roleHierarchyCreatePanel.add(roleHierarchyRoleValuePanel);
rolehierarchyRoleTypePanel.setLayout(new AbsoluteLayout());
roleHierarchyRoleTypeLabel.setText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("rol_hie_btn_role_type"));
rolehierarchyRoleTypePanel.add(roleHierarchyRoleTypeLabel,
new AbsoluteConstraints(17, 10, 80, 20));
roleTypeTextField.setEditable(false);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -