📄 permisactionpolicy.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.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ResourceBundle;
import java.util.Hashtable;
import java.util.Enumeration;
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.ListModel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.SwingConstants;
import org.netbeans.lib.awtextra.AbsoluteConstraints;
import org.netbeans.lib.awtextra.AbsoluteLayout;
/**
* Classname: PermisActionPolicy
*
* Description: This class creates the Action 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 PermisActionPolicy extends PermisPolicyPanel
{
private DefaultListModel actionViewListModel;
private DefaultListModel actionPolicyListModel;
private DefaultListModel actionParameterListModel;
private JButton actionAddButton;
private JButton actionAssignButton;
private JButton actionCancelButton;
private JButton actionCloseButton;
private JButton actionCloseButton1;
private JButton actionDeleteButton1;
private JButton actionOkButton;
private JButton actionParameterAddButton;
private JButton actionParameterRemoveButton;
private JButton actionRemoveButton;
private JButton actionViewCloseButton;
private JButton assignmentOkButton;
private JButton deleteActionButton;
private JButton editActionButton;
private JComboBox actionListComboBox;
private JComboBox actionParameterListComboBox;
private JInternalFrame actionPolicyInternalFrame;
private JLabel actionListLabel;
private JLabel actionNameLabel;
private JLabel actionParameterLabel;
private JLabel actionParameterListLabel;
private JList actionNameParameterList;
private JList actionParameterList;
private JList actionPolicyList;
private JList actionViewList;
private JPanel actionAssignPanel;
private JPanel actionAssignmentPanel;
private JPanel actionButtonPanel;
private JPanel actionButtonsPanel;
private JPanel actionCreatePanel;
private JPanel actionListPanel;
private JPanel actionPanel;
private JPanel actionPanel1;
private JPanel actionViewPanel;
private JPanel actionViewAvailablePanel;
private JPanel actionViewButtonPanel;
private JScrollPane actionAddScrollPane;
private JScrollPane actionAssignmentScrollPane;
private JScrollPane actionAvailableScrollPane;
private JScrollPane actionParameterScrollPanel;
private JTabbedPane actionTabbedPane;
private JTextField actionParameterTextField;
private JTextField actionTextField;
private PermisPolicyLoader loader;
private PermisPolicyEditorButton parent;
boolean editPressed = false;
private Hashtable itemsDeletedTable;
/**************************************************************************\
* Constructor *
\**************************************************************************/
/**
*
*/
public PermisActionPolicy(PermisPolicyEditorButton parent)
{
this.parent = parent;
this.loader = parent.getLoader();
}
public void setEditPressed(boolean set)
{
this.editPressed = set;
}
/**************************************************************************\
* createActionPolicy *
\**************************************************************************/
/**
* This method creates an instance of the class and initilaises all the
* relevant variables.
*
* @return A JInternalFrame containing the Action Policy windows
*/
public JInternalFrame createPolicy()
{
actionParameterListModel= new DefaultListModel();
actionPolicyListModel = new DefaultListModel();
actionViewListModel = new DefaultListModel();
actionAddButton = new JButton();
actionAssignButton = new JButton();
actionCancelButton = new JButton();
actionCloseButton = new JButton();
actionCloseButton1 = new JButton();
actionDeleteButton1 = new JButton();
actionOkButton = new JButton();
actionParameterAddButton = new JButton();
actionParameterRemoveButton = new JButton();
actionViewCloseButton = new JButton();
actionRemoveButton = new JButton();
assignmentOkButton = new JButton();
editActionButton = new JButton();
deleteActionButton = new JButton();
actionListComboBox = new JComboBox();
actionParameterListComboBox = new JComboBox();
actionPolicyInternalFrame = new JInternalFrame();
actionListLabel = new JLabel();
actionNameLabel = new JLabel();
actionParameterLabel = new JLabel();
actionParameterListLabel = new JLabel();
actionNameParameterList = new JList();
actionParameterList = new JList(actionParameterListModel);
actionPolicyList = new JList(actionPolicyListModel);
actionViewList = new JList(actionViewListModel);
actionAssignPanel = new JPanel();
actionAssignmentPanel = new JPanel();
actionButtonPanel = new JPanel();
actionButtonsPanel = new JPanel();
actionCreatePanel = new JPanel();
actionListPanel = new JPanel();
actionPanel = new JPanel();
actionPanel1 = new JPanel();
actionViewAvailablePanel = new JPanel();
actionViewButtonPanel = new JPanel();
actionViewPanel = new JPanel();
actionAddScrollPane = new JScrollPane();
actionAssignmentScrollPane = new JScrollPane();
actionAvailableScrollPane = new JScrollPane();
actionParameterScrollPanel = new JScrollPane();
actionTabbedPane = new JTabbedPane();
actionParameterTextField = new JTextField();
actionTextField = new JTextField();
itemsDeletedTable = new Hashtable();
setLayout(new BorderLayout());
actionPolicyInternalFrame.getContentPane().setLayout(
new AbsoluteLayout());
actionPolicyInternalFrame.setTitle(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("act_pol_frm_title"));
actionViewPanel.setLayout(new AbsoluteLayout());
editActionButton.setMnemonic('E');
editActionButton.setText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("sub_pol_btn_edit"));
editActionButton.setToolTipText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("act_pol_tt_btn_edit"));
editActionButton.setMaximumSize(new Dimension(70, 26));
editActionButton.setMinimumSize(new Dimension(70, 26));
editActionButton.setPreferredSize(new Dimension(70, 26));
editActionButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
editActionButtonActionPerformed(evt);
}
});
// set to true to enable this button
editActionButton.setEnabled(false);
actionViewButtonPanel.add(editActionButton);
deleteActionButton.setMnemonic('D');
deleteActionButton.setText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("sub_pol_btn_v_del"));
deleteActionButton.setToolTipText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("act_pol_tt_btn_delete"));
deleteActionButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
deleteActionButtonActionPerformed(evt);
}
});
actionViewButtonPanel.add(deleteActionButton);
actionViewCloseButton.setMnemonic('l');
actionViewCloseButton.setText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("pol_num_btn_close"));
actionViewCloseButton.setToolTipText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("pol_num_tt_btn_close"));
actionViewCloseButton.setMaximumSize(new Dimension(70, 26));
actionViewCloseButton.setMinimumSize(new Dimension(70, 26));
actionViewCloseButton.setPreferredSize(new Dimension(70, 26));
actionViewCloseButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
actionViewCloseButtonActionPerformed(evt);
}
});
actionViewButtonPanel.add(actionViewCloseButton);
actionViewPanel.add(actionViewButtonPanel,
new AbsoluteConstraints(80, 450, 380, 40));
actionViewAvailablePanel.setLayout(new AbsoluteLayout());
actionViewAvailablePanel.setBorder(new TitledBorder(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("act_pol_brd_avail_actions")));
actionViewList.setToolTipText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("act_pol_tt_vlist_acttionview"));
actionAvailableScrollPane.setViewportView(actionViewList);
actionViewAvailablePanel.add(actionAvailableScrollPane,
new AbsoluteConstraints(30, 50, 320, 270));
actionViewPanel.add(actionViewAvailablePanel,
new AbsoluteConstraints(70, 60, 380, 340));
actionTabbedPane.addTab(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("sub_pol_tab_v"), actionViewPanel);
actionCreatePanel.setLayout(new AbsoluteLayout());
actionPanel.setLayout(new AbsoluteLayout());
actionPanel.setBorder(new TitledBorder(
null,
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("act_pol_brd_param_def"),
TitledBorder.DEFAULT_JUSTIFICATION,
TitledBorder.DEFAULT_POSITION,
new Font("Dialog", 1, 11)));
actionParameterAddButton.setText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("soa_pol_btn_add"));
actionParameterAddButton.setToolTipText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("act_pol_tt_btn_param_add"));
actionParameterAddButton.setEnabled(false);
actionParameterAddButton.setMaximumSize(new Dimension(80, 26));
actionParameterAddButton.setMinimumSize(new Dimension(80, 26));
actionParameterAddButton.setPreferredSize(new Dimension(80, 26));
actionParameterAddButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
actionParameterAddButtonActionPerformed(evt);
}
});
actionPanel.add(actionParameterAddButton,
new AbsoluteConstraints(110, 70, -1, -1));
actionParameterLabel.setHorizontalAlignment(SwingConstants.LEFT);
actionParameterLabel.setFont(new Font("Dialog", 1, 11));
actionParameterLabel.setText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("act_pol_lbl_param"));
//comment here to ungray
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -