📄 permispolicyeditorbutton.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 java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.lang.Object;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.lang.Throwable;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.ResourceBundle;
import javax.swing.border.TitledBorder;
import javax.swing.border.EtchedBorder;
import javax.swing.JButton;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import issrg.utils.LDAP_DIT;
/**
* Classname: PermisPolicyEditorButton
*
* Description: A class that generates the the policy editor buttons and
* provides methods to change the visibilty of the various edito
* windows.
* Version 1.0.
*
* Copyright (c) the authors April 2004
*
* @author Professor D.W.Chadwick
* P. Langley
* U. Mbanaso
*/
public class PermisPolicyEditorButton extends javax.swing.JPanel
{
protected static ArrayList frameArrayList;
protected static ArrayList IdArrayList;
protected static Hashtable IdHastable;
private JButton actionButton;
private JButton policyButton;
protected static JButton roleAssignmentButton;
private JButton roleHierarchyButton;
private JButton soaButton;
private JButton subjectButton;
protected JButton targetAccessButton;
private JButton targetButton;
private JDesktopPane desktop;
private JInternalFrame actionPolicyFrame;
private JInternalFrame policyNumberFrame;
private JInternalFrame roleAssignPolicyFrame;
private JInternalFrame rolePolicyFrame;
private JInternalFrame soaPolicyFrame;
private JInternalFrame subjectPolicyFrame;
private JInternalFrame targetAccessPolicyFrame;
private JInternalFrame targetPolicyFrame;
private JPanel policyEditorPanel;
private PermisPolicyEditorMain permisParent;
private PermisPolicyEditorButton parentThis;
private PermisActionPolicy actionPolicy;
private PermisPolicyNumber policyNumber;
private PermisRoleAssignmentPolicy roleAssignPolicy;
private PermisRoleHierarchyPolicy rolePolicy;
private PermisSoaPolicy soaPolicy;
private PermisSubjectPolicy subjectPolicy;
private PermisTargetAccessPolicy targetAccessPolicy;
private PermisTargetPolicy targetPolicy ;
private PermisReadablePolicy readablePolicy;
private PermisPolicyLoader loader;
int idKey = 1;
private PermisLdapConnection ldapCon;
private LDAP_DIT ldap_dit;
/**************************************************************************\
* Constructor *
\**************************************************************************/
/**
* Constructor
*/
public PermisPolicyEditorButton(PermisPolicyEditorMain parentIn)
{
this.permisParent = parentIn;
initComponents();
setSize(250, 350);
setBackground(new Color(153, 153, 204));
setLocation(0, 50);
this.loader = new PermisPolicyLoader();
this.soaPolicy = new PermisSoaPolicy(this);
this. subjectPolicy = new PermisSubjectPolicy(this);
this. targetPolicy = new PermisTargetPolicy(this);
this. targetAccessPolicy = new PermisTargetAccessPolicy(this);
this. actionPolicy = new PermisActionPolicy(this);
this.policyNumber = new PermisPolicyNumber(this);
this. roleAssignPolicy = new PermisRoleAssignmentPolicy(this);
this.rolePolicy = new PermisRoleHierarchyPolicy(this);
this.ldapCon = new PermisLdapConnection(this);
//initLDAP_dit();
}
public void initLDAP_dit()
{
String s = this.permisParent.getMenuItems().getLdapParam();
this.ldap_dit = this.ldapCon.initLDAP_DIT( s);
}
public PermisLdapConnection getLdapCon()
{
return this.ldapCon;
}
public LDAP_DIT getLDAP_dit()
{
return this.ldap_dit;
}
public PermisPolicyLoader getLoader()
{
return this.loader;
}
public PermisPolicyEditorMain getPermisParent()
{
return this.permisParent;
}
public PermisSoaPolicy getSoaPolicy()
{
return this.soaPolicy;
}
public PermisSubjectPolicy getSubjectPolicy()
{
return this. subjectPolicy;
}
public PermisTargetPolicy getTargetPolicy()
{
return this. targetPolicy;
}
/**************************************************************************\
* initComponents *
\**************************************************************************/
/**
* Initialises all the components used to creat the button menu.
*/
protected void initComponents()
{
frameArrayList = new ArrayList();
IdHastable = new Hashtable() ;
actionButton = new JButton();
policyButton = new JButton();
roleAssignmentButton = new JButton();
roleHierarchyButton = new JButton();
soaButton = new JButton();
subjectButton = new JButton();
targetButton = new JButton();
targetAccessButton = new JButton();
policyEditorPanel = new JPanel();
disableButton();
setLayout(new BorderLayout());
policyEditorPanel.setLayout(new GridLayout(8, 1));
policyEditorPanel.setBorder(new TitledBorder(new EtchedBorder(),
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("ed_but_brd_pol_ed"),
TitledBorder.DEFAULT_JUSTIFICATION,
TitledBorder.DEFAULT_POSITION,
new Font("Dialog", 1, 14)));
policyButton.setMnemonic('O');
policyButton.setSize(150, 30);
policyButton.setText(
ResourceBundle.getBundle( "issrg/editor/gui/Editor_GUI_i18n").
getString("ed_but_btn_Pol_Num"));
policyButton.setToolTipText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("ed_but_tt_btn_pol_num"));
policyButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
policyButtonActionPerformed(evt);
}
});
policyEditorPanel.add(policyButton);
subjectButton.setMnemonic('U');
subjectButton.setText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("ed_but_btn_users"));
subjectButton.setToolTipText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("ed_but_tt_btn_users"));
subjectButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
subjectButtonActionPerformed(evt);
}
});
policyEditorPanel.add(subjectButton);
soaButton.setMnemonic('A');
soaButton.setText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("ed_but_btn_tru_man"));
soaButton.setToolTipText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("ed_but_tt_btn_tru_man"));
soaButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
soaButtonActionPerformed(evt);
}
});
policyEditorPanel.add(soaButton);
roleHierarchyButton.setMnemonic('R');
roleHierarchyButton.setText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("ed_but_btn_roles"));
roleHierarchyButton.setToolTipText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("ed_but_tt_btn_rol"));
roleHierarchyButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
roleHierarchyButtonActionPerformed(evt);
}
});
policyEditorPanel.add(roleHierarchyButton);
roleAssignmentButton.setMnemonic('D');
roleAssignmentButton.setText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("ed_but_btn_rol_all"));
roleAssignmentButton.setToolTipText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("ed_but_tt_btn_rol_all"));
roleAssignmentButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
roleAssignmentButtonActionPerformed(evt);
}
});
policyEditorPanel.add(roleAssignmentButton);
targetButton.setMnemonic('M');
targetButton.setText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("ed_but_btn_target"));
targetButton.setToolTipText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("ed_but_tt_btn_tar"));
targetButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
targetButtonActionPerformed(evt);
}
});
policyEditorPanel.add(targetButton);
actionButton.setMnemonic('F');
actionButton.setText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("ed_but_btn_act"));
actionButton.setToolTipText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("ed_but_tt_btn_act"));
actionButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
actionButtonActionPerformed(evt);
}
});
policyEditorPanel.add(actionButton);
targetAccessButton.setMnemonic('P');
targetAccessButton.setText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("ed_but_btn_Acc_Con"));
targetAccessButton.setToolTipText(
ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
getString("ed_but_tt_btn_acc_con"));
targetAccessButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
targetAccessButtonActionPerformed(evt);
}
});
policyEditorPanel.add(targetAccessButton);
policyEditorPanel.setBounds(0, 50, 300, 330);
policyEditorPanel.setSize(300, 379);
add(policyEditorPanel, BorderLayout.CENTER);
}
/**************************************************************************\
* getIdHastable *
\**************************************************************************/
/**
*
*/
public boolean getIdHashtable(String idString)
{
return this.IdHastable.containsValue(idString);
}
/**************************************************************************\
* put IdHastable *
\**************************************************************************/
/**
*
*/
public void putIdHashtable(String idString)
{
this.IdHastable.put(idString, idString);
}
/**************************************************************************\
* targetAccessButtonActionPerformed *
\**************************************************************************/
/**
* If the PermisTargetAccessPolicy frame does not exist creates it or sets
* the visible attribute of the frame to true.
*
* @param evt Target Access Button operated.
*/
private void targetAccessButtonActionPerformed(ActionEvent evt)
{
if ( targetAccessPolicy == null){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -