📄 permistargetaccesspolicy.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.Font;
import java.awt.GridLayout;
import java.util.ResourceBundle;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.util.StringTokenizer;
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.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.netbeans.lib.awtextra.AbsoluteConstraints;
import org.netbeans.lib.awtextra.AbsoluteLayout;
/**
* Classname: PermisTargetAccessPolicy
*
* Description: This class creates the Target Access 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 PermisTargetAccessPolicy extends PermisPolicyPanel implements ActionListener, FocusListener
{
private static final String EDIT_ACTION = "edit";
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 ADD_ACTION = "add";
private static final String REMOVE_ACTION = "remove";
private static final String ADD1_ACTION = "add1";
private static final String REMOVE1_ACTION = "remove1";
private static final String OK_ACTION = "ok";
private static final String CANCEL_ACTION = "cancel";
private static final String CLOSE1_ACTION = "close1";
protected static final String ID = "ID";
private DefaultListModel targetAccessActionListModel;
private DefaultListModel targetAccessDomainListModel;
private DefaultListModel targetAccessRoleListModel;
private DefaultListModel targetAccessViewListModel;
private JButton targetAccessCancelButton;
private JButton targetAccessCloseButton;
private JButton targetAccessCloseButton1;
private JButton targetAccessDeleteButton;
private JButton targetAccessEditButton;
private JButton targetAccessOkButton;
private JButton targetActionAddButton;
private JButton targetActionRemoveButton;
private JButton targetRoleAddButton;
private JButton targetRoleRemoveButton;
protected static JComboBox targetAccessActionComboBox;
private JComboBox targetAccessViewComboBox;
private JComboBox targetDomainComboBox;
private JComboBox targetRoleComboBox;
private JInternalFrame targetAccessInternalFrame;
private JList targetAccessActionList;
private JList targetAccessRoleList;
private JList targetAccessViewList;
private JPanel targetAccessActionsPanel;
private JPanel targetAccessActionListPanel;
private JPanel targetAccessIDPanel;
private JPanel targetAccessDomainPanel;
private JPanel targetAccessRolePanel;
private JPanel targetAccessRolesListPanel;
private JPanel targetAccessRolesPanel;
private JPanel targetActionPanel;
private JPanel targetAddRemovePanel;
private JPanel targetAddRemovePanel1;
private JPanel targetButtonPanel;
private JPanel targetCreatePanel;
private JPanel targetSubjectPanel;
private JPanel targetViewEditPanel;
private JPanel targetViewPanel;
private JScrollPane targetAccessViewScrollPane;
private JScrollPane targetActionListScrollPane;
private JScrollPane targetRoleListScrollPane;
private JTabbedPane targetAccessTabbedPane;
private JTextField targetAccessIDTextField;
private PermisPolicyLoader loader;
private PermisPolicyEditorButton parent;
protected boolean editPressed = false;
boolean removeId = false;
/**************************************************************************\
* Constructor *
\**************************************************************************/
/**
* Constructor
*/
public PermisTargetAccessPolicy(PermisPolicyEditorButton parent)
{
this.parent = parent;
this.loader = parent.getLoader();
}
public void setEditPressed(boolean set)
{
this.editPressed = set;
}
/**************************************************************************\
* createTargetAccessPolicy *
\**************************************************************************/
/**
* This method creates an instance of the class and initilaises all the
* relevant variables
*
* @return A JInternalFrame containing the Target Access Policy
* windows
*
*/
public JInternalFrame createPolicy()
{
targetAccessActionListModel = new DefaultListModel();
targetAccessRoleListModel = new DefaultListModel();
targetAccessViewListModel = new DefaultListModel();
targetAccessEditButton = new JButton();
targetAccessDeleteButton = new JButton();
targetAccessCloseButton1 = new JButton();
targetRoleRemoveButton = new JButton();
targetRoleAddButton = new JButton();
targetAccessOkButton = new JButton();
targetAccessCancelButton = new JButton();
targetAccessCloseButton = new JButton();
targetActionAddButton = new JButton();
targetActionRemoveButton = new JButton();
targetAccessActionComboBox = new JComboBox();
targetAccessViewComboBox = new JComboBox();
targetDomainComboBox = new JComboBox();
targetRoleComboBox = new JComboBox();
targetAccessInternalFrame = new JInternalFrame();
targetAccessViewList = new JList(targetAccessViewListModel);
targetAccessActionList = new JList(targetAccessActionListModel);
targetAccessRoleList = new JList(targetAccessRoleListModel);
targetAccessActionListPanel = new JPanel();
targetAccessActionsPanel = new JPanel();
targetAccessDomainPanel = new JPanel();
targetAccessIDPanel = new JPanel();
targetAccessRolePanel = new JPanel();
targetAccessRolesListPanel = new JPanel();
targetAccessRolesPanel = new JPanel();
targetActionPanel = new JPanel();
targetAddRemovePanel = new JPanel();
targetAddRemovePanel1 = new JPanel();
targetButtonPanel = new JPanel();
targetCreatePanel = new JPanel();
targetSubjectPanel = new JPanel();
targetViewPanel = new JPanel();
targetViewEditPanel = new JPanel();
targetAccessViewScrollPane = new JScrollPane();
targetActionListScrollPane = new JScrollPane();
targetRoleListScrollPane = new JScrollPane();
targetAccessTabbedPane = new JTabbedPane();
targetAccessIDTextField = new JTextField();
setLayout(new BorderLayout());
targetAccessInternalFrame.getContentPane().setLayout(
new AbsoluteLayout());
targetAccessInternalFrame.setTitle(ResourceBundle.getBundle(
"issrg/editor/gui/Editor_GUI_i18n").getString("tar_acc_pol_frm_title"));
targetAccessInternalFrame.setPreferredSize(new Dimension(300, 300));
//tar
targetViewPanel.setBorder(new TitledBorder(
null,
ResourceBundle.getBundle(
"issrg/editor/gui/Editor_GUI_i18n").getString("tar_acc_pol_available"),
TitledBorder.DEFAULT_JUSTIFICATION,
TitledBorder.DEFAULT_POSITION,
new Font("Dialog", 1, 11)));
targetViewPanel.setLayout(new AbsoluteLayout());
targetAccessViewScrollPane.setViewportView(targetAccessViewList);
targetViewPanel.add(targetAccessViewScrollPane,
new AbsoluteConstraints(36, 85, 440, 350));
targetAccessEditButton.setMnemonic('e');
targetAccessEditButton.setText(ResourceBundle.getBundle(
"issrg/editor/gui/Editor_GUI_i18n").getString("rol_hie_btn_edit"));
targetAccessEditButton.setToolTipText(ResourceBundle.getBundle(
"issrg/editor/gui/Editor_GUI_i18n").getString("tar_acc_pol_tt_btn_v_edit"));
targetAccessEditButton.setMaximumSize(new Dimension(80, 26));
targetAccessEditButton.setMinimumSize(new Dimension(80, 26));
targetAccessEditButton.setPreferredSize(new Dimension(80, 26));
targetAccessEditButton.setActionCommand(EDIT_ACTION);
targetAccessEditButton.addActionListener(this);
targetViewEditPanel.add(targetAccessEditButton);
targetAccessDeleteButton.setMnemonic('D');
targetAccessDeleteButton.setText(ResourceBundle.getBundle(
"issrg/editor/gui/Editor_GUI_i18n").getString("sub_pol_btn_cm_delete"));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -