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

📄 permispolicyeditorbutton.java

📁 一个完整的XACML工程,学习XACML技术的好例子!
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
            targetAccessPolicyFrame = this.initialiseComponent( targetAccessPolicyFrame, 
                                                          targetAccessPolicy);
            targetAccessPolicy.populateTargetAccess();
             targetAccessPolicy.populateTargetAccess();
            makeFrameVisible(targetAccessPolicyFrame);
        }
        else{
            targetAccessPolicy.populateTargetAccess();
            targetAccessPolicy.performRefresh();
            makeFrameVisible(targetAccessPolicyFrame);
        }
       //targetAccessPolicy.setEditPressed(false);
    }
    
    /**************************************************************************\
     *             actionButtonActionPerformed                                *
    \**************************************************************************/
    
    /** 
     * If the PermisActionPolicy frame does not exist creates it or sets
     * the visible attribute of the frame to true.
     *
     * @param evt     Action button operated.  
     */
        
    private void actionButtonActionPerformed(ActionEvent evt)
    {
        if (  actionPolicy == null){
           
            actionPolicyFrame = this.initialiseComponent( actionPolicyFrame, 
                                                          actionPolicy);
            makeFrameVisible(actionPolicyFrame);
        }
        else{
            actionPolicy.performRefresh();
            actionPolicy.addExistingActions();
            makeFrameVisible(actionPolicyFrame);
        }
        //actionPolicy.setEditPressed(false);
    }
    
    /**************************************************************************\
     *             targetButtonActionPerformed                                *
    \**************************************************************************/
    
    /** 
     * If the PermisTargetPolicy frame does not exist creates it or sets
     * the visible attribute of the frame to true.
     *
     * @param evt       Target button operated.
     */
        
    private void targetButtonActionPerformed(ActionEvent evt)
    {

        if (  targetPolicy == null){
           // targetPolicy = new PermisTargetPolicy(this);
            targetPolicyFrame = this.initialiseComponent( targetPolicyFrame, 
                                                          targetPolicy);
            targetPolicy. initLDAP_DIT();
            makeFrameVisible(targetPolicyFrame);
        }
        else{
            targetPolicy. initLDAP_DIT();
            targetPolicy.performRefresh();
            makeFrameVisible(targetPolicyFrame);
        }  
         //targetPolicy.setEditPressed(false);
    }
    
    /**************************************************************************\
     *             roleAssignmentButtonActionPerformed                        *
    \**************************************************************************/
    
    /** 
     * If the PermisRoleAssignmentPolicy frame does not exist creates it or 
     * sets the visible attribute of the frame to true.
     *
     * @param evt       Role Assignment button operated.
     */
        
    private void roleAssignmentButtonActionPerformed(ActionEvent evt)
    {
       
        if (  roleAssignPolicy == null){
          
           
            roleAssignPolicyFrame = this.initialiseComponent( 
                                                          roleAssignPolicyFrame, 
                                                          roleAssignPolicy);
         // comboBoxSetSelectedIndex( 2);
            roleAssignPolicy.populateRoleAssignment();
            roleAssignPolicy.performRefresh();
            roleAssignPolicy.refreshBoxes();
            makeFrameVisible(roleAssignPolicyFrame);
        }
        else{
             roleAssignPolicy.refreshBoxes();
            roleAssignPolicy.performRefresh();
            makeFrameVisible(roleAssignPolicyFrame);
        } 
    }
    
    /**************************************************************************\
     *             roleHierarchyButtonActionPerformed                         *
    \**************************************************************************/
    
    /** 
     * If the PermisRoleHierarchyPolicy frame does not exist creates it or sets
     * the visible attribute of the frame to true.
     *
     * @param evt       Role Hierarchy button operated.
     */
        
    private void roleHierarchyButtonActionPerformed(ActionEvent evt)
    {
       
        if (  rolePolicy == null){
            
           
            rolePolicyFrame = this.initialiseComponent(rolePolicyFrame,
                                                       rolePolicy);
            makeFrameVisible(rolePolicyFrame);
            
          
        }
        else{
            rolePolicy.performRefresh();
            rolePolicy.setEditPressed(true);
            makeFrameVisible(rolePolicyFrame);
        }
        
         
    }
    
    /**************************************************************************\
     *             soaButtonActionPerformed                                   *
    \**************************************************************************/
    
    /** 
     * If the PermisSoaPolicy frame does not exist creates it or sets the
     * visible attribute of the frame to true.
     *
     * @param evt       SOA button operated.
     */
        
    private void soaButtonActionPerformed(ActionEvent evt)
    {
        if (  soaPolicy == null){
            
           // soaPolicy = new PermisSoaPolicy(this);
            soaPolicyFrame = this.initialiseComponent(soaPolicyFrame, 
                                                      soaPolicy);
           getTargetPolicy().resetLdap();
            soaPolicy. initLDAP_DIT();
            soaPolicy.performRefresh();
            makeFrameVisible(soaPolicyFrame);
            
        }
        else{
            getTargetPolicy().resetLdap();
            soaPolicy. initLDAP_DIT();
            soaPolicy.performRefresh();
            makeFrameVisible(soaPolicyFrame);
        }
        //soaPolicy.setEditPressed(false);
    }
    
    /**************************************************************************\
     *             subjectButtonActionPerformed                               *
    \**************************************************************************/
    
    /**
     * If the PermisSubjectPolicy frame does not exist creates it or sets the
     * visible attribute of the frame to true.
     *
     * @param evt       Subject button operated.
     */
        
    private void subjectButtonActionPerformed(ActionEvent evt)
    {

        if ( subjectPolicy == null){
           // subjectPolicy = new PermisSubjectPolicy(this);
            subjectPolicyFrame = this.initialiseComponent( subjectPolicyFrame, 
                                                           subjectPolicy);
            getTargetPolicy().resetLdap();
            subjectPolicy. initLDAP_DIT();
            makeFrameVisible(subjectPolicyFrame);
        }
        else{
            getTargetPolicy().resetLdap(); 
            subjectPolicy. initLDAP_DIT();
            subjectPolicy.performRefresh();
            makeFrameVisible(subjectPolicyFrame);
        }
        //subjectPolicy.setEditPressed(false);
    }
    
    /**************************************************************************\
     *             policyButtonActionPerformed                                *
    \**************************************************************************/
    
    /** 
     * If the PermisPolicyNumber frame does not exist creates it or sets the
     * visible attribute of the frame to true.
     *
     * @param evt       Policy button operated.
     */
        
    private void policyButtonActionPerformed(ActionEvent evt)
    {
        if (  policyNumber == null){
            
            policyNumberFrame = this.initialiseComponent( policyNumberFrame, 
                                                           policyNumber);
            makeFrameVisible(policyNumberFrame);
        }
        else{
           policyNumber.performRefresh();
            makeFrameVisible(policyNumberFrame);
        }
        //policyNumber.setPressed(true);
    }
    
    /**************************************************************************\
     *             makeFrameVisible                                                           *
    \**************************************************************************/
    
    /** 
     * Sets the Visible attribute of the frame to true and sets the visible
     * attribute of all the other frames to false.
     *
     * @param frame     Thr JInternal frame to be made visible.
     */
        
    protected static void makeFrameVisible(JInternalFrame frame)
    {
        JInternalFrame[] frameArray = new JInternalFrame[frameArrayList.size()];
        frameArrayList.toArray(frameArray);
        
        for (int i = 0; i < frameArray.length; i++){
            
            if (frameArray[i] != frame){
                frameArray[i].setVisible(false);
            }
        }
        frame.setVisible(true);
    }
    
      
    /**************************************************************************\
     *             controlButton                                              *
    \**************************************************************************/
    
    /** 
     * Makes the button visible.
     *
     * @param button        The JButton to be made visible.
     * @param visible       True - make button visible.
     */
        
    protected void controlButton( String button,
                                         boolean visible)
    {
        if ( button.equals("targetAccessButton") ){
            targetAccessButton.setEnabled(visible);
        }
        else if ( button.equals("roleAssignmentButton") ){
            roleAssignmentButton.setEnabled(visible);
        }
    }
    
    /**************************************************************************\
     *             disableButton                                              *
    \**************************************************************************/
    
    /**
     * Disables the policy editor buttons.
     */
        
    protected void disableButton()
    {
        roleAssignmentButton.setEnabled(false);
        roleHierarchyButton.setEnabled(false);
        targetButton.setEnabled(false);
        soaButton.setEnabled(false);
        policyButton.setEnabled(false);
        targetAccessButton.setEnabled(false);
        actionButton.setEnabled(false);
        subjectButton.setEnabled(false);
    }
    
    /**************************************************************************\
     *             enableButton                                               *
    \**************************************************************************/
    
    /**
     * Enables the policy editor buttons.
     */
        
    protected void enableButton()
    {
        roleHierarchyButton.setEnabled(true);
        targetButton.setEnabled(true);
        soaButton.setEnabled(true);
        policyButton.setEnabled(true);
        actionButton.setEnabled(true);
        subjectButton.setEnabled(true);
    }
    
    protected void refreshComponents()
    {
        targetAccessPolicy = new PermisTargetAccessPolicy(this); 
        targetAccessPolicyFrame = initialiseComponent( targetAccessPolicyFrame,
                                                       targetAccessPolicy);
        
        actionPolicy = new PermisActionPolicy(this); 
        actionPolicyFrame = initialiseComponent( actionPolicyFrame,
                                                 actionPolicy);
        
        targetPolicy = new PermisTargetPolicy(this); 
        targetPolicyFrame = initialiseComponent( targetPolicyFrame,
                                                 targetPolicy);
        
        roleAssignPolicy = new PermisRoleAssignmentPolicy(this); 
        roleAssignPolicyFrame = initialiseComponent( roleAssignPolicyFrame,
                                                     roleAssignPolicy);
        
        policyNumber = new PermisPolicyNumber(this); 
        policyNumberFrame = initialiseComponent( policyNumberFrame,
                                                  policyNumber);
        
        subjectPolicy = new PermisSubjectPolicy(this); 
        subjectPolicyFrame = initialiseComponent( subjectPolicyFrame,
                                                  subjectPolicy);
        
        soaPolicy = new PermisSoaPolicy(this);
        soaPolicyFrame = initialiseComponent( soaPolicyFrame, 
                                              soaPolicy);

        rolePolicy = new PermisRoleHierarchyPolicy(this); 
        rolePolicyFrame = initialiseComponent( rolePolicyFrame,
                                               rolePolicy);
        
    }
    
    public JInternalFrame initialiseComponent( JInternalFrame frame,
                                                PermisPolicyPanel policy)
    {
        if(frame != null)
        {
            frame.setVisible(false);
        }
        frame = policy.createPolicy();
        frameArrayList.add(frame);
        PermisPolicyEditorMain.policyDesktopPane.add(
                                                    frame, 
                                                    JLayeredPane.DEFAULT_LAYER);
        policy.performRefresh();
        frame.setVisible(false);

        return frame;
    }
}

⌨️ 快捷键说明

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