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

📄 permissoapolicy.java

📁 一个完整的XACML工程,学习XACML技术的好例子!
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                                   new AbsoluteConstraints(30, 120, 190, 210));
        soaLdapDirectorLabel.setText(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("soa_pol_lbl_LDAPDir"));
        soaGroupPanel.add(soaLdapDirectorLabel, 
                                       new AbsoluteConstraints(30, 90, -1, 20));
        soaAddButton.setMnemonic('A');
        soaAddButton.setText(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("soa_pol_btn_add"));
        soaAddButton.setToolTipText(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("soa_pol_tt_btn_Add")); 
        soaAddButton.setMaximumSize(new Dimension(70, 26));
        soaAddButton.setMinimumSize(new Dimension(70, 26));
        soaAddButton.setPreferredSize(new Dimension(70, 26));
        soaAddButton.setActionCommand(ADD_ACTION);
        soaAddButton.addActionListener(this);
        soaAddButtonPanel.add(soaAddButton);
        
        soaDeleteButton.setMnemonic('d');
        soaDeleteButton.setText(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("sub_pol_btn_cm_delete"));
        soaDeleteButton.setToolTipText(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("sub_pol_tt_btn_cm_delete"));
        soaDeleteButton.setActionCommand(DELETE1_ACTION);
        soaDeleteButton.addActionListener(this);
        soaAddButtonPanel.add(soaDeleteButton);
        
        soaGroupPanel.add(soaAddButtonPanel, 
                                    new AbsoluteConstraints(220, 120, 90, 110));
        soaGroupPanel.add(soaTreeScrollPane, 
                                   new AbsoluteConstraints(310, 120, 180, 210));
        soaDnTextField.setToolTipText(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("soa_pol_tt_tf_ldapdn"));
        soaGroupPanel.add(soaDnTextField, 
                                     new AbsoluteConstraints(120, 50, 360, 20));
        soaLdapDnLabel.setText("LDAP DN");
        soaGroupPanel.add(soaLdapDnLabel, 
                                       new AbsoluteConstraints(30, 50, 60, 20));
        soaCreatePanel.add(soaGroupPanel, 
                                    new AbsoluteConstraints(10, 100, 500, 350));
        soaPolicyOkButton.setMnemonic('o');
        soaPolicyOkButton.setText(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("pol_num_btn_ok"));
        soaPolicyOkButton.setToolTipText(                                     
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("pol_num_tt_btn_ok"));
        soaPolicyOkButton.setMaximumSize(new Dimension(73, 26));
        soaPolicyOkButton.setMinimumSize(new Dimension(73, 26));
        soaPolicyOkButton.setPreferredSize(new Dimension(73, 26));
        soaPolicyOkButton.setActionCommand(OK_ACTION);
        soaPolicyOkButton.addActionListener(this);
        soaButtonPanel.add(soaPolicyOkButton);
        
        soaPolicyCancelButton.setMnemonic('c');
        soaPolicyCancelButton.setText(                         
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("pol_num_btn_cancel"));
        soaPolicyCancelButton.setToolTipText(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("pol_num_tt_btn_cancel"));
        soaPolicyCancelButton.setActionCommand(CANCEL_ACTION);
        soaPolicyCancelButton.addActionListener(this);
        soaButtonPanel.add(soaPolicyCancelButton);
        
        soaPolicyCloseButton.setMnemonic('l');
        soaPolicyCloseButton.setText(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("pol_num_btn_close"));
        soaPolicyCloseButton.setToolTipText(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("pol_num_tt_btn_close"));
        soaPolicyCloseButton.setMaximumSize(new Dimension(73, 26));
        soaPolicyCloseButton.setMinimumSize(new Dimension(73, 26));
        soaPolicyCloseButton.setPreferredSize(new Dimension(73, 26));
        soaPolicyCloseButton.setActionCommand(CLOSE1_ACTION);
        soaPolicyCloseButton.addActionListener(this);
        soaButtonPanel.add(soaPolicyCloseButton);
        
        soaCreatePanel.add(soaButtonPanel, 
                                     new AbsoluteConstraints(60, 460, 410, 40));
        soaIDPanel.setLayout(new AbsoluteLayout());
        soaIDPanel.setBorder(new TitledBorder(
                         null, 
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("Soa_ID"), 
                         TitledBorder.DEFAULT_JUSTIFICATION, 
                         TitledBorder.DEFAULT_POSITION, 
                         new Font("Dialog", 1, 11)));
        soaIDPanel.setForeground(new Color(204, 204, 204));
        soaIDTextField.setToolTipText(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("soa_pol_tt_tf_domainid"));
        highLighter(soaIDTextField);
       soaIDTextField.addFocusListener(this);

        soaIDPanel.add(soaIDTextField, 
                                     new AbsoluteConstraints(110, 20, 360, 20));
        soaCreatePanel.add(soaIDPanel, 
                                      new AbsoluteConstraints(10, 20, 500, 60));
        soaTabbedPane.addTab(
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("soa_pol_tab_cm"), soaCreatePanel);
        soaInternalFrame.getContentPane().add(soaTabbedPane, 
                                       new AbsoluteConstraints(0, 0, 520, 540));
        add(soaInternalFrame, BorderLayout.CENTER);
        permisPolicySoa = new PermisDomainTree(soaTree);
        treeSoa = permisPolicySoa.initNodes("SOAPolicy");
        soaTreeScrollPane.setViewportView(treeSoa); 
        PermisSoaTree soaLDAP = new PermisSoaTree(soaLDAPTree);
        JTree soaNewLeftTree = soaLDAP.initNodes("c=gb");
        soaLDAPScrollPane.setViewportView(soaNewLeftTree);
        soaInternalFrame.show();
        setSize(530, 679);
        soaInternalFrame.setBounds(255, 50, 530, 570);
        add(soaInternalFrame);
        setBackground(new Color(153, 153, 204));
        setLocation(150, 45);
        
        return soaInternalFrame;
    }
    
    public void initLDAP_DIT()
    {
      ldap_dit = parent.getLDAP_dit();
      ldap_dit.setSelectionListener(this);
      soaDnTextField.setText("");
      soaGroupPanel.add(ldap_dit, 
                                   new AbsoluteConstraints(30, 120, 190, 210));
    }
    
    
    
    /** 
     * Closes the SOA Policy window.
     *
     * @param evt   Close button operated
     */
    
    private void soaPolicyCloseButtonActionPerformed() 
    {
        soaInternalFrame.setVisible(false);
    }
    
    /**************************************************************************\
     *                           soaPolicyCancelButtonActionPerformed         *
    \**************************************************************************/
    
    /** 
     * Clears the data entered by the user from all data entry points
     *
     * @param evt   Cancel button operated
     */
    
    private void soaPolicyCancelButtonActionPerformed() 
    {
        if(editPressed){
            soaPolicyEditButtonActionPerformed();
        }
        else{
        
        String answer = PermisPolicyEditorMenu.dialog.confirmDialog(
                   ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                   getString("sub_pol_warn_msg_a") 
                   + "\n" +
                   ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                   getString("sub_pol_warn_msg_b"), "Warning");
        if (answer.equals("No")){
            return;
        }
        else {
           clearBoxes();
        }
        }
    }

    /** 
     * Collects the data entered by the use and writes it to the Document
     * Object Model (DOM), the PERMIS Policy, in memory. Informs the user of the
     * outcome of the operation.
     *
     * @param evt   OK button operated
     */
    
    private void soaPolicyOkButtonActionPerformed() 
    {
        
        // Check to see if the Tree has children and display error if not
        DefaultTreeModel treeModel = (DefaultTreeModel)treeSoa.getModel();
        DefaultMutableTreeNode top = (DefaultMutableTreeNode)treeModel.
                                                                      getRoot();
        if (top.getChildCount() < 1) {
            PermisPolicyEditorMenu.dialog.showOkDialog(                                                 
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("sub_pol_err_msg_c") + 
                         "\n" +
                         ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("sub_pol_msg_warn_b"));
            return;
        }
        else{
            ArrayList idsArrayList = getSoaID();
            String[] idArray = new String[idsArrayList.size()];
            idArrayList.toArray(idArray);
            for (int i =0; i < idArray.length; i++){
                String id = idArray[i];
                
            if( loader.isID(SOA_SPEC, id)){
              PermisPolicyEditorMenu.permisXmlDom.deleteNode(SOA_SPEC, id);
            }
            }
        PermisPolicyEditorMenu.permisXmlDom.addDomFromTree( treeSoa, 
                                                            SOA_SPEC, 
                                                            ID, 
                                                            "LDAPDN");
        
        //refresh the ReadablePolicy view
            if(parent.getPermisParent().getMenuItems().
                                                   getReadablePolicy() != null){
                    parent.getPermisParent().getMenuItems().getReadablePolicy().
                                                   comboBoxSetSelectedIndex(3);
            }
        PermisPolicyEditorMenu.permisXmlDom.showMessage();
        
        String button = "roleAssignmentButton";
        parent.controlButton(button, true);
        clearBoxes();    
        performRefresh();
        
        soaInternalFrame.setVisible(false);
        }
    }
    
    /** 
     * Deletes the selected node from the SOA Policy JTree.
     *
     * @param evt   Delete button operated
     */
    
    private void soaDeleteButtonActionPerformed() 
    {
        permisPolicySoa.removeCurrentNode();
    }
    
    
    /** 
     * Adds the entered data as a node under the root node of the SOA
     * JTree/DefaultTreeModel.
     *
     * @param evt   Add button operated
     */    
    private void soaAddButtonActionPerformed() 
    {
        Character ch = null;
         //number += 1;
       String s = getIDInitialization();
       //checks if the ID already exists in the policy
       if (parent.getIdHashtable(soaIDTextField.getText())){
            PermisPolicyEditorMenu.dialog.showOkDialog(
           ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                   getString("pol_err_msg_id") +" "+
                   getString(soaIDTextField.getText())+" "+
                   ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                   getString("pol_err_msg_id_exist"));
           return;
       }
       //checks if the users has not replaced the default text
       else if (soaIDTextField.getText().equals(s)){
            PermisPolicyEditorMenu.dialog.showOkDialog(
                  ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("sub_pol_err_msg_c") + " "+
                   ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("pol_id_text_err_msg") );
            soaIDTextField.requestFocus();
            soaIDTextField.selectAll();
            return;
        }
       //checks if the Textbox is lefet empty
       else  if ( soaIDTextField.getText().equals("") ){
             PermisPolicyEditorMenu.dialog.showOkDialog(
                   ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                   getString("sub_pol_err_msg_c") + " "+
                   ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                   getString("Soa_ID")+
                   ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                   getString("soa_pol_err_msg_a") + "\n");
            soaIDTextField.requestFocus();
            soaIDTextField.selectAll();
            return;
        }
          //check if the first character is not digit
       else if ( ch.isDigit(soaIDTextField.getText().charAt(0))){
               PermisPolicyEditorMenu.dialog.showOkDialog(
                   ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                   getString("sub_pol_err_msg_c") + " "+
                   ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                   getString("Soa_ID")+ " " +
                   ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                         getString("sub_pol_err_msg_b"));
                soaIDTextField.requestFocus();
                soaIDTextField.selectAll();
               return;
            
        }
        else if(!validateID(soaIDTextField.getText().trim())){
           soaIDTextField.requestFocus();
            return ;

⌨️ 快捷键说明

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