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

📄 permishelpcontent.java

📁 一个完整的XACML工程,学习XACML技术的好例子!
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        //helpURL = HelpTest_2.class.getResource(s);
         helpURL = PermisHelpContent.class.getResource(s);
        if (helpURL == null) {
          //  System.err.println("Couldn't open help file: " + s);
        } else if (DEBUG) {
           // System.out.println("Help URL is " + helpURL);
        }

        displayURL(helpURL);
    }

    private void displayURL(URL url) {
        try {
            if (url != null) {
                htmlPane.setPage(url);
            } else { //null url
		htmlPane.setText(ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                      getString("pol_help_content_file_not_found"));
                if (DEBUG) {
                 //   System.out.println("");
                }
            }
        } catch (IOException e) {
           // System.err.println();
        }
    }

    private void createNodes(DefaultMutableTreeNode top) {
        DefaultMutableTreeNode category = null;
        DefaultMutableTreeNode helpNode = null;
         DefaultMutableTreeNode help = null;

        category = new DefaultMutableTreeNode(ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                      getString("pol_help_intro"));
        top.add(category);
        
       helpNode = new DefaultMutableTreeNode(new PermisHelpContents
            (ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                      getString("pol_help_over_gif"),
            "permis_overview.html"));
        category.add(helpNode);
        //Policy Overview
        helpNode = new DefaultMutableTreeNode(new PermisHelpContents
            (ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                      getString("pol_help_over"),
            "permis_help.html"));
        category.add(helpNode);

        //Policy Tutorial
        category = new DefaultMutableTreeNode("Policy Tutorial");
        top.add(category);
        helpNode = new DefaultMutableTreeNode("Table of Contents");
       category.add(helpNode);
        help = new DefaultMutableTreeNode(new PermisHelpContents
            (ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                      getString("pol_help_tutorial"),
            "tutorial.html"));
         helpNode.add(help);
         //Policy Goal
          help = new DefaultMutableTreeNode(new PermisHelpContents
            (ResourceBundle.getBundle("issrg/editor/gui/Editor_GUI_i18n").
                      getString("pol_help_tutorial_goal"),
            "tutorial_goal.html"));
         helpNode.add(help);
         //Requirements
          help = new DefaultMutableTreeNode(new PermisHelpContents
           ("Requirements",
            "tutorial_requirements.html"));
         helpNode.add(help);
         //stay out of policy
          help = new DefaultMutableTreeNode(new PermisHelpContents
           ("You Stay out of the policy",
            "tutorial_stay_out.html"));
         helpNode.add(help);
         //policy OID
          help = new DefaultMutableTreeNode(new PermisHelpContents
           ("Policy Object ID",
            "tutorial_OID.html"));
         helpNode.add(help);
          help = new DefaultMutableTreeNode(new PermisHelpContents
           ("Dirac",
            "tutorial_dirac.html"));
         helpNode.add(help);
          help = new DefaultMutableTreeNode(new PermisHelpContents
           ("Watching, Starting, Stopping simulations",
            "tutorial_start.html"));
         helpNode.add(help);
          help = new DefaultMutableTreeNode(new PermisHelpContents
           ("Chemistry Department Users",
            "tutorial_depart.html"));
         helpNode.add(help);
          help = new DefaultMutableTreeNode(new PermisHelpContents
           ("Guest and Researchers",
            "tutorial_guest.html"));
         helpNode.add(help);
          help = new DefaultMutableTreeNode(new PermisHelpContents
           ("Account Administrator-Arthur Smith",
            "tutorial_admin.html"));
         helpNode.add(help);
        //Help contents    
        category = new DefaultMutableTreeNode("Editor Help Contents");
        top.add(category);

        //VM
        helpNode = new DefaultMutableTreeNode(new PermisHelpContents
            ("Policy Object Identifier OID",
             "policy_id.html"));
        category.add(helpNode);

        //Subject policy
        helpNode = new DefaultMutableTreeNode(new PermisHelpContents
            (" Where Users are from",
             "subject_policy.html"));
        category.add(helpNode);
        //soa policy
         helpNode = new DefaultMutableTreeNode(new PermisHelpContents
            (" Account Administrator",
             "soa_policy.html"));
        category.add(helpNode);
        //role Hierarchy policy
         helpNode = new DefaultMutableTreeNode(new PermisHelpContents
            (" User Roles",
             "role_hierarchy_policy.html"));
        category.add(helpNode);
        
        //Role Assignment
         helpNode = new DefaultMutableTreeNode(new PermisHelpContents
            ("Account Administrator Privilege",
             "role_assignment_policy.html"));
        category.add(helpNode);
        //Target Policy
         helpNode = new DefaultMutableTreeNode(new PermisHelpContents
            ("My Protected Resources",
             "target_policy.html"));
        category.add(helpNode);
        //Action Policy
         helpNode = new DefaultMutableTreeNode(new PermisHelpContents
            (" Resources' Functions",
             "action_policy.html"));
        category.add(helpNode);
        //Target Access Policy
         helpNode = new DefaultMutableTreeNode(new PermisHelpContents
            ("Users' Privilege",
             "target_access_policy.html"));
        category.add(helpNode);
    }

    /** Returns an ImageIcon, or null if the path was invalid. */
    protected static ImageIcon createImageIcon(String path) {
        java.net.URL imgURL = PermisHelpContent.class.getResource(path);
        if (imgURL != null) {
            return new ImageIcon(imgURL);
        } else {
            System.err.println("Couldn't find file: " + path);
            return null;
        }
    }

    private class MyRenderer extends DefaultTreeCellRenderer {
        Icon tutorialIcon;
       Icon parentIcon;
        public MyRenderer(Icon icon) {
            tutorialIcon = icon;
           
        }

        public Component getTreeCellRendererComponent(
                            JTree tree,
                            Object value,
                            boolean sel,
                            boolean expanded,
                            boolean leaf,
                            int row,
                            boolean hasFocus) {

            super.getTreeCellRendererComponent(
                            tree, value, sel,
                            expanded, leaf, row,
                            hasFocus);
          
            if (leaf) {
                setIcon(tutorialIcon);
                setToolTipText("This is Tutorial");
            } else {
               setIcon(parentIcon);
                setToolTipText(null); //no tool tip
            }

            return this;
        }

        protected boolean isTutorialBook(Object value) {
            DefaultMutableTreeNode node =
                    (DefaultMutableTreeNode)value;
            PermisHelpContents nodeInfo = 
                    (PermisHelpContents)(node.getUserObject());
            String title = nodeInfo.helpTextNode;
            if (title.indexOf("Tutorial") >= 0) {
                return true;
            } 

            return false;
        }
    }
    
    /*************************************************************************\
     *                                dialog                                *
    \*************************************************************************/
    /**
     *
     *
     */
   public void dialog(String title, String message)
   {
        javax.swing.JOptionPane.showMessageDialog(this.parent,message,title,
                                                     JOptionPane.ERROR_MESSAGE);
    
   } 
}

⌨️ 快捷键说明

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