📄 permisroleassignmentpolicy.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.PermisDataBox;
import issrg.editor.RemoveFromList;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusListener;
import java.awt.event.FocusEvent;
import java.util.ResourceBundle;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import javax.swing.BorderFactory;
import javax.swing.border.BevelBorder;
import javax.swing.border.TitledBorder;
import javax.swing.text.DefaultHighlighter;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JInternalFrame;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import org.w3c.dom.Document;
import org.netbeans.lib.awtextra.AbsoluteConstraints;
import org.netbeans.lib.awtextra.AbsoluteLayout;
/**
* Classname: PermisRoleAssignmentPolicy
*
* Description: This class creates the Role Hierarchy Policy windows, the
* associated buttons and their methods.
* Version 1.0.
*
* Copyright (c) the authors April 2004
*
* @author Professor D.W.Chadwick
* P. Langley
* U. Mbanaso
*/
public class PermisRoleAssignmentPolicy extends PermisPolicyPanel implements ActionListener, FocusListener
{
private static final String REMOVE_ACTION="remove";
private static final String DELETE_ACTION="delete";
private static final String CLOSE_ACTION="close";
private static final String VIEW_ACTION="view";
private static final String OK_ACTION="ok";
private static final String CANCEL_ACTION="cancel";
private static final String CLOSE1_ACTION="close1";
private static final String ADD_ACTION="add";
private static final String REMOVE_SUBJECT_ACTION="remove subject";
private static final String ID = "ID";
private DefaultListModel roleAssignmentListModel;
private DefaultListModel roleAssignmentViewListModel;
private DefaultListModel roleAssignViewListModel;
private JButton roleAssignCloseButton;
private JButton roleAssignmentAddButton;
private JButton roleAssignmentCancelButton;
private JButton roleAssignmentCloseButton;
private JButton roleAssignmentDeleteButton;
private JButton roleAssignmentOkButton;
private JButton roleAssignmentRemoveButton;
private JButton roleAssignmentRemoveSubjectButton;
private JComboBox roleAssignmentComboBox;
private JComboBox roleAssignSoaComboBox;
private JComboBox roleAssignViewComboBox;
private JComboBox roleSubjectComboBox;
private JInternalFrame roleAssignmentInternalFrame;
private JList roleAssignmentList;
private JList roleAssignmentViewList;
private JPanel createAssignmentPanel;
private JPanel roleAssignButtonPanel;
private JPanel roleAssignmentAddRemovePanel;
private JPanel roleAssignmentButonPanel;
private JPanel roleAssignmentDomainListPanel;
private JPanel roleAssignmentDomainPanel;
private JPanel roleAssignmentIDPanel;
private JPanel roleAssignmentPanel;
private JPanel roleAssignmentSoaPanel;
private JPanel roleAssignmentSubjectPanel;
private JPanel roleAssignmentSubjectsPanel;
private JPanel roleAssignViewPanel;
private JTextField roleAssignIDTextField;
private JScrollPane roleAssignmentListScrollPane;
private JScrollPane roleAssignViewScrollPane;
private JTabbedPane roleAssignmentTabbedPane;
private PermisPolicyLoader loader;
private PermisPolicyEditorButton parent;
private Document doc;
protected boolean editPressed = false;
final javax.swing.JCheckBox check = new javax.swing.JCheckBox();
final javax.swing.JCheckBox unlimited = new javax.swing.JCheckBox();
final javax.swing.JTextField depth = new javax.swing.JTextField("1", 2);
/**
* Constructor
*/
public PermisRoleAssignmentPolicy(PermisPolicyEditorButton parent)
{
this.parent = parent;
loader = this.parent.getLoader();
}
public void setEditPressed(boolean set)
{
this.editPressed = set;
}
/**
* This method creates an instance of the class and initilaises all the
* relevant variables
*
* @return A JInternalFrame containing the Role Assignment Policy
* windows
*/
public JInternalFrame createPolicy()
{
roleAssignmentListModel = new DefaultListModel();
roleAssignmentViewListModel = new DefaultListModel();
roleAssignCloseButton = new JButton();
roleAssignmentAddButton = new JButton();
roleAssignmentCancelButton = new JButton();
roleAssignmentCloseButton = new JButton();
roleAssignmentDeleteButton = new JButton();
roleAssignmentOkButton = new JButton();
roleAssignmentRemoveButton = new JButton();
roleAssignmentRemoveSubjectButton = new JButton();
roleAssignmentComboBox = new JComboBox();
roleAssignSoaComboBox = new JComboBox();
roleAssignViewComboBox = new JComboBox();
roleSubjectComboBox = new JComboBox();
roleAssignmentInternalFrame = new JInternalFrame();
roleAssignmentList = new JList(roleAssignmentListModel);
roleAssignmentViewList = new JList(roleAssignmentViewListModel);
roleAssignmentAddRemovePanel = new JPanel();
roleAssignmentIDPanel = new JPanel();
roleAssignViewPanel = new JPanel();
roleAssignButtonPanel = new JPanel();
createAssignmentPanel = new JPanel();
roleAssignmentPanel = new JPanel();
roleAssignmentButonPanel = new JPanel();
roleAssignmentDomainPanel = new JPanel();
roleAssignmentDomainListPanel = new JPanel();
roleAssignmentSoaPanel = new JPanel();
roleAssignmentSubjectPanel = new JPanel();
roleAssignmentSubjectsPanel = new JPanel();
roleAssignmentListScrollPane = new JScrollPane();
roleAssignViewScrollPane = new JScrollPane();
roleAssignmentTabbedPane = new JTabbedPane();
roleAssignIDTextField = new javax.swing.JTextField();
setLayout(new BorderLayout());
roleAssignmentInternalFrame.getContentPane().setLayout(
new AbsoluteLayout());
roleAssignmentInternalFrame.setTitle(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("rol_ass_frm_title"));
roleAssignmentInternalFrame.setPreferredSize(new Dimension(300, 300));
roleAssignmentTabbedPane.setToolTipText("");
roleAssignViewPanel.setLayout(new AbsoluteLayout());
roleAssignViewPanel.setToolTipText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("rol_ass_tt_vpanel"));
roleAssignViewPanel.setBorder(new TitledBorder(
null,
ResourceBundle.getBundle(
"issrg/editor/gui/Editor_GUI_i18n").getString("role_ass_pol_vp_tt"),
javax.swing.border.TitledBorder.CENTER,
javax.swing.border.TitledBorder.DEFAULT_POSITION));
roleAssignViewScrollPane.setViewportView(roleAssignmentViewList);
roleAssignViewPanel.add(roleAssignViewScrollPane,
new AbsoluteConstraints(46, 75, 440, /*360*/330));
roleAssignmentRemoveButton.setMnemonic('E');
roleAssignmentRemoveButton.setText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("sub_pol_btn_edit"));
roleAssignmentRemoveButton.setToolTipText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("rol_ass_tt_btn_edit"));
roleAssignmentRemoveButton.setMaximumSize(new Dimension(70, 26));
roleAssignmentRemoveButton.setMinimumSize(new Dimension(70, 26));
roleAssignmentRemoveButton.setPreferredSize(new Dimension(70, 26));
roleAssignmentRemoveButton.setActionCommand(REMOVE_ACTION);
roleAssignmentRemoveButton.addActionListener(this);
roleAssignButtonPanel.add(roleAssignmentRemoveButton);
roleAssignmentDeleteButton.setMnemonic('D');
roleAssignmentDeleteButton.setText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("sub_pol_btn_v_del"));
roleAssignmentDeleteButton.setToolTipText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("sub_pol_tt_btn_v_del"));
roleAssignmentDeleteButton.setActionCommand(DELETE_ACTION);
roleAssignmentDeleteButton.addActionListener(this);
roleAssignButtonPanel.add(roleAssignmentDeleteButton);
roleAssignCloseButton.setMnemonic('l');
roleAssignCloseButton.setText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("pol_num_btn_close"));
roleAssignCloseButton.setToolTipText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("pol_num_tt_btn_close"));
roleAssignCloseButton.setMaximumSize(new Dimension(70, 26));
roleAssignCloseButton.setMinimumSize(new Dimension(70, 26));
roleAssignCloseButton.setPreferredSize(new Dimension(70, 26));
roleAssignCloseButton.setActionCommand(CLOSE_ACTION);
roleAssignCloseButton.addActionListener(this);
roleAssignButtonPanel.add(roleAssignCloseButton);
roleAssignViewPanel.add(roleAssignButtonPanel,
new AbsoluteConstraints(60, 430, 400, 40));
roleAssignViewComboBox.setBackground(new Color(255, 255, 204));
roleAssignViewComboBox.setToolTipText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("rol_ass_v_combo_desc"));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -