⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 permissoapolicy.java

📁 一个完整的XACML工程,学习XACML技术的好例子!
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
/*
* 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.PermisDomainTree;
import issrg.editor.PermisSoaTree;

import issrg.utils.LDAP_DIT;
import issrg.utils.DITSelectionListener;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusListener;
import java.awt.event.FocusEvent;

import java.util.ArrayList;
import java.util.ResourceBundle;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.util.StringTokenizer;

import javax.swing.border.TitledBorder;
import javax.swing.text.DefaultHighlighter;
import javax.swing.text.SimpleAttributeSet;
import javax.naming.Context;
import javax.naming.directory.InitialDirContext;

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.JTree;


import javax.swing.tree.DefaultTreeModel; 
import javax.swing.tree.DefaultMutableTreeNode;
                        

import org.netbeans.lib.awtextra.AbsoluteConstraints;
import org.netbeans.lib.awtextra.AbsoluteLayout;


/**
 * Classname:   PermisSoaPolicy
 * 
 * Description  This class creates the Subject Policy windows, its 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 PermisSoaPolicy extends PermisPolicyPanel implements ActionListener, 
                                                                FocusListener,
                                                             DITSelectionListener
{
    private static final String VIEW_ACTION = "view";
    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 ADD_ACTION = "add";
    private static final String DELETE1_ACTION = "delete1";
    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 SOA_SPEC = "SOASpec";
    protected static final String ID      = "ID";
    private ArrayList idArrayList;
    private DefaultListModel soaViewListModel;
    
    private JButton soaAddButton;
    private JButton soaDeleteButton;
    private JButton soaPolicyCancelButton;
    private JButton soaPolicyCloseButton;
    private JButton soaPolicyCloseButton1;
    private JButton soaPolicyDeleteButton;
    private JButton soaPolicyEditButton;
    private JButton soaPolicyOkButton;
    
    private JComboBox soaViewComboBox;
    
    private JInternalFrame soaInternalFrame;
    
    private JLabel soaLdapDirectorLabel;
    private JLabel soaLdapDnLabel;
    
    protected static JList soaViewList;
    
    private JPanel soaAddButtonPanel;
    private JPanel soaButtonPanel;
    private JPanel soaCreatePanel;
    private JPanel soaGroupPanel;
    private JPanel soaIDPanel;
    private JPanel soaViewAvailablePanel;
    private JPanel soaViewButtonPanel;
    private JPanel soaViewPanel;
    
    private JScrollPane soaLDAPScrollPane;
    private JScrollPane soaTreeScrollPane;
    private JScrollPane soaViewScrollPane;
    
    private JTabbedPane soaTabbedPane;
    
    private JTextField soaDnTextField;
    private JTextField soaIDTextField;
    
    private JTree soaTree;
    private JTree treeSoa;
    private JTree soaLDAPTree;
    
    private PermisPolicyLoader loader;
    private PermisDomainTree permisPolicySoa;


    private PermisPolicyEditorButton parent;
    
    private LDAP_DIT ldap_dit;
    int number = 0;
    private String idString = "Untitled";
     protected boolean editPressed = false;
    
    /**
     * Constructor
     */
    public PermisSoaPolicy(PermisPolicyEditorButton parent) 
    {
        this.parent = parent;
         loader = parent.getLoader();
    }
    

    /**
     * This method creates an instance of the classs and initilaises all the 
     * relevant variables 
     *
     * @return          A JInternalFrame containing the SOA Policy windows
     */
    public JInternalFrame createPolicy() 
    {
        soaViewListModel= new DefaultListModel();
        
        soaAddButton = new JButton();
        soaDeleteButton = new JButton();
        soaPolicyCancelButton = new JButton();
        soaPolicyCloseButton = new JButton();
        soaPolicyCloseButton1 = new JButton();
        soaPolicyDeleteButton = new JButton();
        soaPolicyEditButton = new JButton();
        soaPolicyOkButton = new JButton();
        
        soaViewComboBox = new JComboBox();
        
        soaInternalFrame = new JInternalFrame();
        
        soaLdapDirectorLabel = new JLabel();
        soaLdapDnLabel = new JLabel();
        
        soaViewAvailablePanel = new JPanel();
        soaViewButtonPanel = new JPanel();
        soaViewPanel = new JPanel();
        
        soaViewList = new JList(soaViewListModel);
        
        soaAddButtonPanel = new JPanel();
        soaButtonPanel = new JPanel();
        soaCreatePanel = new JPanel();
        soaGroupPanel = new JPanel();
        soaIDPanel = new JPanel();
        
        soaLDAPScrollPane = new JScrollPane();
        soaTreeScrollPane = new JScrollPane();
        soaViewScrollPane = new JScrollPane();
        
        soaDnTextField = new JTextField();
        soaIDTextField = new JTextField();
        
        soaTabbedPane = new JTabbedPane();
        
        setLayout(new BorderLayout());
        soaInternalFrame.getContentPane().setLayout(new AbsoluteLayout());
        soaInternalFrame.setTitle(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("soa_pol_frm_title"));
        soaInternalFrame.setPreferredSize(new Dimension(300, 300));
        soaViewPanel.setLayout(new AbsoluteLayout());
        soaViewAvailablePanel.setLayout(new AbsoluteLayout());
        soaViewAvailablePanel.setBorder(new TitledBorder(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("soa_pol_brd_avail_soas")));
        soaViewList.setToolTipText(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("sub_pol_sub_vlist"));
        soaViewScrollPane.setViewportView(soaViewList);
        soaViewAvailablePanel.add(soaViewScrollPane, 
                                    new AbsoluteConstraints(30, 110, 320, 170));
        soaViewComboBox.setBackground(new Color(255, 255, 204));
        soaViewComboBox.setToolTipText(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("soa_pol_combo_desc"));
        soaViewComboBox.setActionCommand(VIEW_ACTION);
        soaViewComboBox.addActionListener(this);
        
        soaViewAvailablePanel.add(soaViewComboBox, 
                                      new AbsoluteConstraints(30, 40, 320, -1));
        soaViewPanel.add(soaViewAvailablePanel, 
                                     new AbsoluteConstraints(70, 40, 380, 310));
        soaPolicyEditButton.setMnemonic('E');
        soaPolicyEditButton.setText(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("sub_pol_btn_edit"));
        soaPolicyEditButton.setToolTipText(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("soa_pol_tt_btn_v_edit"));
        soaPolicyEditButton.setMaximumSize(new Dimension(73, 26));
        soaPolicyEditButton.setMinimumSize(new Dimension(73, 26));
        soaPolicyEditButton.setPreferredSize(new Dimension(73, 26));
        soaPolicyEditButton.setActionCommand(EDIT_ACTION);
        soaPolicyEditButton.addActionListener(this);

        soaViewButtonPanel.add(soaPolicyEditButton);
        
        soaPolicyDeleteButton.setMnemonic('D');
        soaPolicyDeleteButton.setText(
                   ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                   getString("sub_pol_btn_v_del"));
        soaPolicyDeleteButton.setToolTipText(
                   ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                   getString("sub_pol_tt_btn_v_del"));

        soaPolicyDeleteButton.setActionCommand(DELETE_ACTION);
        soaPolicyDeleteButton.addActionListener(this);
        soaViewButtonPanel.add(soaPolicyDeleteButton);
        
        soaPolicyCloseButton1.setMnemonic('l');
        soaPolicyCloseButton1.setText(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("pol_num_btn_close"));
        soaPolicyCloseButton1.setToolTipText(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("pol_num_tt_btn_close"));
        soaPolicyCloseButton1.setMaximumSize(new Dimension(73, 26));
        soaPolicyCloseButton1.setMinimumSize(new Dimension(73, 26));
        soaPolicyCloseButton1.setPreferredSize(new Dimension(73, 26));
        soaPolicyCloseButton1.setActionCommand(CLOSE_ACTION);
        soaPolicyCloseButton1.addActionListener(this);
        soaViewButtonPanel.add(soaPolicyCloseButton1);
        
        soaViewPanel.add(soaViewButtonPanel, 
                                     new AbsoluteConstraints(60, 450, 410, 40));
        soaTabbedPane.addTab(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("sub_pol_tab_v"), soaViewPanel);
        soaCreatePanel.setLayout(new AbsoluteLayout());
        soaGroupPanel.setLayout(new AbsoluteLayout());
        soaGroupPanel.setBorder(new TitledBorder(
                         null, 
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("soa_pol_brd_cm_b"), 
                         TitledBorder.DEFAULT_JUSTIFICATION, 
                         TitledBorder.DEFAULT_POSITION, 
                         new Font("Dialog", 1, 14)));
        //soaGroupPanel.add(soaLDAPScrollPane, 
          //                          new AbsoluteConstraints(30, 120, 190, 210));
        
        initLDAP_DIT();
        
        soaGroupPanel.add(ldap_dit, 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -