Example usage for javax.swing JTree getModel

List of usage examples for javax.swing JTree getModel

Introduction

In this page you can find the example usage for javax.swing JTree getModel.

Prototype

public TreeModel getModel() 

Source Link

Document

Returns the TreeModel that is providing the data.

Usage

From source file:org.zaproxy.zap.extension.history.PopupMenuExportSelectedURLs.java

private SortedSet<String> getOutputSet(TreePath[] startingPoints) {
    JTree siteTree = extension.getView().getSiteTreePanel().getTreeSite();
    ArrayList<TreePath> startingPts = new ArrayList<TreePath>();

    if (ArrayUtils.isEmpty(startingPoints)) {
        startingPts.add(new TreePath(siteTree.getModel().getRoot()));
    } else {// ww  w  .  java2  s .c om
        startingPts.addAll(Arrays.asList(startingPoints));
    }

    SortedSet<String> outputSet = new TreeSet<String>();
    for (TreePath aPath : startingPts) {
        Enumeration<?> en = (((SiteNode) aPath.getLastPathComponent()).preorderEnumeration());
        while (en.hasMoreElements()) {
            SiteNode node = (SiteNode) en.nextElement();
            if (node.isRoot()) {
                continue;
            }
            HistoryReference nodeHR = node.getHistoryReference();
            if (nodeHR != null && !HistoryReference.getTemporaryTypes().contains(nodeHR.getHistoryType())) {
                outputSet.add(nodeHR.getURI().toString());
            }
        }
    }
    return outputSet;
}

From source file:org.zaproxy.zap.extension.history.PopupMenuExportURLs.java

/**
 * This method initializes this/*from w ww  .  ja  v a2  s . com*/
 * 
 * @return void
 */
private void initialize() {
    this.setText(Constant.messages.getString("exportUrls.popup"));

    this.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent e) {

            JTree site = extension.getView().getSiteTreePanel().getTreeSite();

            File file = getOutputFile();
            if (file == null) {
                return;
            }

            boolean isAppend = true;
            if (file.exists()) {
                int rc = extension.getView()
                        .showYesNoCancelDialog(Constant.messages.getString("file.overwrite.warning"));
                if (rc == JOptionPane.CANCEL_OPTION) {
                    return;
                } else if (rc == JOptionPane.YES_OPTION) {
                    isAppend = false;
                }
            }
            boolean html = file.getName().toLowerCase().endsWith(".htm")
                    || file.getName().toLowerCase().endsWith(".html");

            BufferedWriter fw = null;
            try {
                fw = new BufferedWriter(new FileWriter(file, isAppend));
                exportURLs((SiteNode) site.getModel().getRoot(), fw, html);

            } catch (Exception e1) {
                log.warn(e1.getStackTrace(), e1);
                extension.getView().showWarningDialog(
                        Constant.messages.getString("file.save.error") + file.getAbsolutePath() + ".");
            } finally {
                try {
                    fw.close();
                } catch (Exception e2) {
                    log.warn(e2.getStackTrace(), e2);
                }
            }
        }
    });

}

From source file:results.report.java

/**
 * Private function to generate the application report
 * @param filename//from  ww  w .  j a  v  a  2 s  . co  m
 * @return 
 */
private boolean generateApplicationsReport(String filename) {
    //--Note: generate also a paste to wiki report
    //--Sample..
    //  Multiple Sequence Alignment (MSA)
    // *test - v 1.0 - [http://www.example.com link title]
    try {
        //--The tools tree: easier because it's already shorted
        Toolbox toolbox = new Toolbox();
        JTree applications_tree = toolbox.getApplicationTree();
        DefaultTreeModel mode = (DefaultTreeModel) applications_tree.getModel();
        ToolboxMutableTreeNode treeroot = (ToolboxMutableTreeNode) mode.getRoot();

        //--Exceptions (do not put in the report)
        String[] exception_name = { "Blast Download", "Blast (Web Ncbi)", "Create Local BlastDB", "LocalBlast",
                "dbFetch (Web EBI)", "EB-Eye (Web EBI)", "Ncbi eUtils", "Fetch Sequences Ncbi", "DNAML-Erate",
                "Custom Program _Old_", "Kalign - Custom Program" };
        HashMap<String, Boolean> dict_exception_name = new HashMap<String, Boolean>();
        for (String s : exception_name)
            dict_exception_name.put(s, Boolean.TRUE);

        for (int i = 0; i < treeroot.getChildCount(); i++) {
            ToolboxMutableTreeNode cat = (ToolboxMutableTreeNode) treeroot.getChildAt(i);
            //--Get applications
            if (cat.getProperties().getName().equals("Alignment")) {
                for (int j = 0; j < cat.getChildCount(); j++) {
                    ToolboxMutableTreeNode appli = (ToolboxMutableTreeNode) cat.getChildAt(j);
                    workflow_properties prop = appli.getProperties();
                    if (dict_exception_name.containsKey(prop.getName().trim())) {
                        prop.put("done_report", true);
                    }
                }
            }
        } //--End exception

        //--HTML
        Util report = new Util(filename);
        Util report_wiki = new Util(filename + ".wiki");
        System.out.println(filename);
        report.println(
                "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>");
        report.println(this.generateTopApplicationReport("Included Applications"));
        //--Report style 1
        //-- Table (1)            
        report.println(
                "<table style='text-align: left; width: 100%; font-size: 14px;' border='1' cellpadding='0' cellspacing='0' >"
                        + "<tbody><tr>"
                        + "<td style='background-color: silver; text-align: center; color: black;'><big><span style='font-weight: bold;'>Nucleic or Proteic Sequences</span></big></td>"
                        + "<td style='background-color: silver; text-align: center; color: black;'><big><span style='font-weight: bold;'>Phylogenetic Trees</span></big></td>"
                        + "<td style='background-color: silver; text-align: center; color: black;'><big><span style='font-weight: bold;'>Model of Evolutionary Pressure</span></big></td>");
        report.println("</tr>");

        //--wiki report
        report_wiki.println("<!-- Application report created on " + Util.returnCurrentDateAndTime() + " -->");

        //--Print MSA 
        report.println(
                "<td style='vertical-align: top; text-align: center;'><span style='font-weight: bold; '><br />Multiple Sequence Alignment (MSA)</span><br /><br />");
        report_wiki.println("\nMultiple Sequence Alignment (MSA)\n");
        for (int i = 0; i < treeroot.getChildCount(); i++) {
            ToolboxMutableTreeNode cat = (ToolboxMutableTreeNode) treeroot.getChildAt(i);
            //--Get applications
            if (cat.getProperties().getName().equals("Alignment")) {
                for (int j = 0; j < cat.getChildCount(); j++) {
                    ToolboxMutableTreeNode appli = (ToolboxMutableTreeNode) cat.getChildAt(j);
                    workflow_properties prop = appli.getProperties();
                    prop.put("done_report", true);
                    report.println(pretty_prop(prop));
                    report_wiki.println(pretty_wiki_prop(prop));
                }
            }
        }

        //--Print HGT
        report.println(
                "<span style='font-weight: bold;'><br />Detection of Horizontal Gene Transfers</span><br /><br />");
        report_wiki.println("\nDetection of Horizontal Gene Transfers\n");
        for (int i = 0; i < treeroot.getChildCount(); i++) {
            ToolboxMutableTreeNode cat = (ToolboxMutableTreeNode) treeroot.getChildAt(i);
            //--Get applications
            if (cat.getProperties().getName().startsWith("Horizontal Gene")) {
                for (int j = 0; j < cat.getChildCount(); j++) {
                    ToolboxMutableTreeNode appli = (ToolboxMutableTreeNode) cat.getChildAt(j);
                    workflow_properties prop = appli.getProperties();
                    prop.put("done_report", true);
                    report.println(pretty_prop(prop));
                    report_wiki.println(pretty_wiki_prop(prop));
                }
            }
        }
        report.println("</td>");
        report.println(
                "<td style='vertical-align: top; text-align: center;'><span style='font-weight: bold;'><br />Phylogenetic Trees</span><br /><br />");
        report_wiki.println("\nPhylogenetic Trees\n");
        //--Print Phylogenetic Trees
        for (int i = 0; i < treeroot.getChildCount(); i++) {
            ToolboxMutableTreeNode cat = (ToolboxMutableTreeNode) treeroot.getChildAt(i);
            //--Get applications
            if (cat.getProperties().getName().equals("Tree")) {
                for (int j = 0; j < cat.getChildCount(); j++) {
                    ToolboxMutableTreeNode appli = (ToolboxMutableTreeNode) cat.getChildAt(j);
                    workflow_properties prop = appli.getProperties();
                    if (!prop.getName().contains("Viewer")) {
                        report.println(pretty_prop(prop));
                        report_wiki.println(pretty_wiki_prop(prop));
                        prop.put("done_report", true);
                    }
                }
            }
        }

        report.println(
                "<br><span style='font-style: italic;'><span style='font-style: italic;'></span>Felsenstein's Lab<br /></span><a href='http://evolution.genetics.washington.edu/phylip.html'>Phylip package</a><br /><br />");
        report_wiki.println("\nFelsenstein's Lab [http://evolution.genetics.washington.edu/ link]\n");
        for (int i = 0; i < treeroot.getChildCount(); i++) {
            ToolboxMutableTreeNode cat = (ToolboxMutableTreeNode) treeroot.getChildAt(i);
            //--Get applications
            if (cat.getProperties().getName().startsWith("Tree - Phylip")) {
                for (int j = 0; j < cat.getChildCount(); j++) {
                    ToolboxMutableTreeNode appli = (ToolboxMutableTreeNode) cat.getChildAt(j);
                    workflow_properties prop = appli.getProperties();
                    if (prop.getName().contains("Phylip")) {
                        report.println(pretty_prop(prop));
                        report_wiki.println(pretty_wiki_prop(prop));
                        prop.put("done_report", true);
                    }
                }
            }
        }
        //--Special dnaml-erate...
        report.println(
                "<br><span style='font-style: italic;'>Eddy's Lab</span><br><a href='http://selab.janelia.org/software.html'>DNAML-Erate&nbsp;</a><a href='http://selab.janelia.org/software.html'>v1.0</a><br /></div><br />");
        //--Note--special for Eddy's Lab
        report_wiki.println("\nEddy's Lab\n");
        report_wiki.println("* [http://selab.janelia.org/software.html DNAML-Erate]  v1.0\n");

        report.println("<span style='font-weight: bold;'><br />Tree Distance</span><br /><br />");
        report_wiki.println("\nTree Distance\n");
        for (int i = 0; i < treeroot.getChildCount(); i++) {
            ToolboxMutableTreeNode cat = (ToolboxMutableTreeNode) treeroot.getChildAt(i);
            //--Get applications
            if (cat.getProperties().getName().startsWith("Tree - Distance")) {
                for (int j = 0; j < cat.getChildCount(); j++) {
                    ToolboxMutableTreeNode appli = (ToolboxMutableTreeNode) cat.getChildAt(j);
                    workflow_properties prop = appli.getProperties();
                    prop.put("done_report", true);
                    report.println(pretty_prop(prop));
                    report_wiki.println(pretty_wiki_prop(prop));
                }
            }
        }
        report.println("<span style='font-weight: bold;'><br />Tree Visualization</span><br /><br />");
        report_wiki.println("\nTree Visualization\n");
        for (int i = 0; i < treeroot.getChildCount(); i++) {
            ToolboxMutableTreeNode cat = (ToolboxMutableTreeNode) treeroot.getChildAt(i);
            //--Get applications
            if (cat.getProperties().getName().equals("Tree")) {
                for (int j = 0; j < cat.getChildCount(); j++) {
                    ToolboxMutableTreeNode appli = (ToolboxMutableTreeNode) cat.getChildAt(j);
                    workflow_properties prop = appli.getProperties();
                    if (prop.getName().contains("Viewer")) {
                        prop.put("done_report", true);
                        report.println(pretty_prop(prop));
                        report_wiki.println(pretty_wiki_prop(prop));
                    }
                }
            }
        }
        report.println("</td>");
        // Evolutionnary model
        report.println(
                "<td style='vertical-align: top; text-align: center;'><span style='font-weight: bold;'><br />Evolutionary Model Inference</span><br /><br />");
        report_wiki.println("\nEvolutionary Model Inference\n");
        for (int i = 0; i < treeroot.getChildCount(); i++) {
            ToolboxMutableTreeNode cat = (ToolboxMutableTreeNode) treeroot.getChildAt(i);
            //--Get applications
            if (cat.getProperties().getName().startsWith("Evolutionary Model Testing")) {
                for (int j = 0; j < cat.getChildCount(); j++) {
                    ToolboxMutableTreeNode appli = (ToolboxMutableTreeNode) cat.getChildAt(j);
                    workflow_properties prop = appli.getProperties();
                    prop.put("done_report", true);
                    report.println(pretty_prop(prop));
                    report_wiki.println(pretty_wiki_prop(prop));
                }
            }
        }
        report.println("<span style='font-weight: bold;'><br />Selective Pressure</span><br /><br />");
        report_wiki.println("\nSelective Pressure\n");
        for (int i = 0; i < treeroot.getChildCount(); i++) {
            ToolboxMutableTreeNode cat = (ToolboxMutableTreeNode) treeroot.getChildAt(i);
            //--Get applications
            if (cat.getProperties().getName().startsWith("Selective Pressure")) {
                for (int j = 0; j < cat.getChildCount(); j++) {
                    ToolboxMutableTreeNode appli = (ToolboxMutableTreeNode) cat.getChildAt(j);
                    workflow_properties prop = appli.getProperties();
                    prop.put("done_report", true);
                    report.println(pretty_prop(prop));
                    report_wiki.println(pretty_wiki_prop(prop));
                }
            }
        }
        report.println("<span style='font-weight: bold;'><br />Ancestral Reconstruction</span><br /><br />");
        report_wiki.println("\nAncestral Reconstruction\n");
        for (int i = 0; i < treeroot.getChildCount(); i++) {
            ToolboxMutableTreeNode cat = (ToolboxMutableTreeNode) treeroot.getChildAt(i);
            //--Get applications
            if (cat.getProperties().getName().startsWith("Ancestral Reconstruction")) {
                for (int j = 0; j < cat.getChildCount(); j++) {
                    ToolboxMutableTreeNode appli = (ToolboxMutableTreeNode) cat.getChildAt(j);
                    workflow_properties prop = appli.getProperties();
                    prop.put("done_report", true);
                    report.println(pretty_prop(prop));
                    report_wiki.println(pretty_wiki_prop(prop));
                }
            }
        }
        report.println("<span style='font-weight: bold;'><br />Others</span><br /><br />");
        report_wiki.println("\nOthers\n");
        for (int i = 0; i < treeroot.getChildCount(); i++) {
            ToolboxMutableTreeNode cat = (ToolboxMutableTreeNode) treeroot.getChildAt(i);
            //--Get applications other
            for (int j = 0; j < cat.getChildCount(); j++) {
                ToolboxMutableTreeNode appli = (ToolboxMutableTreeNode) cat.getChildAt(j);
                workflow_properties prop = appli.getProperties();
                if (!prop.getBoolean("done_report") && !prop.getBoolean("InternalArmadilloApplication")
                        && !prop.getName().equalsIgnoreCase("DNAML-Erate")) {
                    //System.out.println(prop.getBoolean("InternalArmadilloApplication"));
                    report.println(pretty_prop(prop));
                    report_wiki.println(pretty_wiki_prop(prop));
                }
            }

        }
        report.println("</td>");
        //--Close the table (1)
        //report.println("</tr></tbody></table></span><a href='included_os.html'>(extented report including OS specific)</a><br /><br />");
        //--Table (2) - static
        // BLAST
        report.println(
                "<table style='text-align: left; width: 100%; font-size: 14px;' border='1' cellpadding='0' cellspacing='0'><tbody><tr>"
                        + "<span style='border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;' class='Apple-style-span'></span><td style='background-color: silver; text-align: center; color: black;'><big><big><span style='font-weight: bold;'>BLAST</span></big></big></td>"
                        + "<span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'></span><td style='vertical-align: top; text-align: center;'><span style='font-weight: bold;'><br /></span>"
                        + "<div style='text-align: left;'><span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'>&nbsp;&nbsp;&nbsp;"
                        + "<a href='http://eutils.ncbi.nlm.nih.gov/'>NCBI** BLAST</a><br />&nbsp;&nbsp;&nbsp; <a href='http://www.ebi.ac.uk/Tools/blastall/index.html'>EBI BLAST</a> &nbsp;&nbsp;&nbsp;<a href='http://www.ebi.ac.uk/inc/help/search_help.html'></a><br />"
                        + "<span style='font-weight: bold;'></span></span><br />"
                        + "<span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'><span style='font-weight: bold;'></span></span></div>"
                        + "</td></tr></tbody></table><br /><br />");
        //--Web database
        report.println(
                "<table style='text-align: left; width: 100%; font-size: 14px;' border='1' cellpadding='0' cellspacing='0'><tbody><tr>"
                        + "<span style='border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;' class='Apple-style-span'></span><td style='background-color: silver; text-align: center; color: black;'><big><big><span style='font-weight: bold;'>Database services</span></big></big></td>"
                        + "<span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'></span><td style='vertical-align: top; text-align: center;'><span style='font-weight: bold;'><br /></span>"
                        + "<div style='text-align: left;'><span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'>&nbsp;&nbsp;&nbsp;"
                        + "<a href='http://eutils.ncbi.nlm.nih.gov/'>NCBI Entrez Programming Utilities</a><br />"
                        + "&nbsp;&nbsp;&nbsp;&nbsp;<a href='http://www.ebi.ac.uk/inc/help/search_help.html'>EBI EB-eye database&nbsp;search services</a><br />"
                        + "&nbsp;&nbsp;&nbsp;<a href='http://www.ebi.ac.uk/cgi-bin/dbfetch'> EBI dbFetch</a> <br />"
                        + "<span style='font-weight: bold;'></span></span><br /><span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'><span style='font-weight: bold;'></span></span></div></td></tr>"
                        + "</tbody></table><br /></div></div><div style='clear: both;'><span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'><span class='Apple-style-span' style='font-family: helvetica,'trebuchet MS',arial,sans-serif; font-size: 11px; text-align: left; white-space: nowrap;'></span></span><span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'><span class='Apple-style-span' style='font-family: helvetica,'trebuchet MS',arial,sans-serif; font-size: 11px; text-align: left; white-space: nowrap;'>*&nbsp;<span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'><span class='Apple-style-span' style='font-family: helvetica,'trebuchet MS',arial,sans-serif; font-size: 11px; text-align: left; white-space: nowrap;'><a target='_top' href='http://www.ebi.ac.uk/' title='European Bioinformatics Institute Home Page' style='color: rgb(64, 64, 64); background-color: rgb(222, 222, 222); text-decoration: underline;'>European            Bioinformatics Institute</a><br /></span></span></span></span><span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'><span class='Apple-style-span' style='font-family: helvetica,'trebuchet MS',arial,sans-serif; font-size: 11px; text-align: left; white-space: nowrap;'>**</span></span> &nbsp;<span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'><span class='Apple-style-span' style='font-family: helvetica,'trebuchet MS',arial,sans-serif; font-size: 11px; text-align: left; white-space: nowrap;'><a target='_top' href='http://www.ncbi.nlm.nih.gov/' title='European Bioinformatics Institute Home Page' style='color: rgb(64, 64, 64); background-color: rgb(222, 222, 222); text-decoration: underline;'>National Center for Biotechnology Information </a></span></span><br /></div></div>");

        report.println(this.foot());
        report.println("</body></html>");
        report.close();
        report_wiki.close();

    } catch (Exception e) {
        e.printStackTrace();
        Config.log("Error in generation application report (1) " + filename + "\n" + e.getMessage() + "\n"
                + e.getLocalizedMessage());
        return false;
    }
    return true;
}

From source file:results.report.java

private boolean generateApplicationsReportComplex(String filename) {
    try {/* w  w  w .j  ava  2 s.  c  om*/
        //--The tools tree: easier beacause it's already shorted
        Toolbox toolbox = new Toolbox();
        JTree applications_tree = toolbox.getApplicationTree();
        DefaultTreeModel mode = (DefaultTreeModel) applications_tree.getModel();
        ToolboxMutableTreeNode treeroot = (ToolboxMutableTreeNode) mode.getRoot();

        //--Exceptions (do not put in the report)
        String[] exception_name = { "Blast Download", "Blast (Web Ncbi)", "Create Local BlastDB", "LocalBlast",
                "dbFetch (Web EBI)", "EB-Eye (Web EBI)", "Ncbi eUtils", "Fetch Sequences Ncbi", "DNAML-Erate",
                "Custom Program _Old_", "Kalign - Custom Program" };
        HashMap<String, Boolean> dict_exception_name = new HashMap<String, Boolean>();
        for (String s : exception_name)
            dict_exception_name.put(s, Boolean.TRUE);

        for (int i = 0; i < treeroot.getChildCount(); i++) {
            ToolboxMutableTreeNode cat = (ToolboxMutableTreeNode) treeroot.getChildAt(i);
            //--Get applications
            if (cat.getProperties().getName().equals("Alignment")) {
                for (int j = 0; j < cat.getChildCount(); j++) {
                    ToolboxMutableTreeNode appli = (ToolboxMutableTreeNode) cat.getChildAt(j);
                    workflow_properties prop = appli.getProperties();
                    if (dict_exception_name.containsKey(prop.getName())) {
                        prop.put("done_report", true);
                    }
                }
            }
        } //--End exception

        //--HTML
        Util report = new Util(filename);
        System.out.println(filename);
        report.println(
                "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>");
        report.println(this.generateTopApplicationReport("Included Applications - (Extended)"));
        //--Report style 1
        //-- Table (1)            
        report.println(
                "<table style='text-align: left; width: 100%;' border='1' cellpadding='0' cellspacing='0'>"
                        + "<tbody><tr>"
                        + "<td style='background-color: silver; text-align: center; color: black;'><big><span style='font-weight: bold;'>Categories</span></big></td>"
                        + "<td style='background-color: silver; text-align: center; color: black;'><big><span style='font-weight: bold;'>Internal</span></big></td>"
                        + "<td style='background-color: silver; text-align: center; color: black;'><big><span style='font-weight: bold;'>Name</span></big></td>"
                        + "<td style='background-color: silver; text-align: center; color: black;'><big><span style='font-weight: bold;'>Version</span></big></td>"
                        + "<td style='background-color: silver; text-align: center; color: black;'><big><span style='font-weight: bold;'>Website</span></big></td>"
                        + "<td style='background-color: silver; text-align: center; color: black;'><big><span style='font-weight: bold;'>Help</span></big></td>"
                        + "<td style='background-color: silver; text-align: center; color: black;'><big><span style='font-weight: bold;'>Sample</span></big></td>"
                        + "<td style='background-color: silver; text-align: center; color: black;'><big><span style='font-weight: bold;'><a title='Description'>Desc</a></span></big></td>"
                        + "<td style='background-color: silver; text-align: center; color: black;'><big><span style='font-weight: bold;'><a title='Publication'>Publ</a></span></big></td>"
                        + "<td style='background-color: silver; text-align: center; color: black;'><big><span style='font-weight: bold;'>Windows</span></big></td>"
                        + "<td style='background-color: silver; text-align: center; color: black;'><big><span style='font-weight: bold;'>MacOSX</span></big></td>"
                        + "<td style='background-color: silver; text-align: center; color: black;'><big><span style='font-weight: bold;'>Linux</span></big></td>");
        report.println("</tr>");

        //--Report style 2
        //report.println("<table border='1'><thead> <TR><TH SCOPE=colgroup COLSPAN=4>Applications</TH><TH SCOPE=colgroup COLSPAN=3>Operating system</TH></TR><TR><TH SCOPE=col ROWSPAN=2>Type</TH><TH SCOPE=col ROWSPAN=2>Name</TH><TH SCOPE=col ROWSPAN=2>Version</TH><TH SCOPE=col ROWSPAN=2>Website</TH>      <TH SCOPE=col>Windows</TH>      <TH SCOPE=col>MAC OSX</TH>      <TH SCOPE=col>Centos (Linux)</TH></TR></thead>");
        //report.println("<tbody>");

        //--Get categories
        if (config.getBoolean("debug"))
            System.out.println("Generating applications reports");
        for (int i = 0; i < treeroot.getChildCount(); i++) {
            ToolboxMutableTreeNode cat = (ToolboxMutableTreeNode) treeroot.getChildAt(i);
            //--Get applications
            if (config.getBoolean("debug"))
                System.out.println(cat.getProperties().getName());

            for (int j = 0; j < cat.getChildCount(); j++) {
                ToolboxMutableTreeNode appli = (ToolboxMutableTreeNode) cat.getChildAt(j);
                workflow_properties prop = appli.getProperties();
                //--Report only the external program for now...

                report.println("<TR style='background-color: white; text-align: center; color: black;'><TD>"
                        + cat.getProperties().getName() + "</TD>" + "<TD>"
                        + (prop.getBoolean("InternalArmadilloApplication") ? "X" : " ") + "</TD>" + "<TD>"
                        + prop.getName() + "</TD>" + "<TD>"
                        + (prop.isSet("Version") ? prop.get("Version")
                                : prop.getBoolean("InternalArmadilloApplication") ? "NA" : "")
                        + "</TD>" + "<TD>"
                        + (prop.getBoolean("InternalArmadilloApplication") ? ""
                                : prop.isSet("Website") ? "<a href='" + prop.get("Website") + "'>web</a>" : "")
                        + "</TD>" + (helpFound(prop) ? "<TD BGCOLOR='lime'>" : "<TD BGCOLOR='red'>")
                        + (helpFound(prop)
                                ? "<a title='" + config.dataPath() + File.separator + "help" + File.separator
                                        + prop.getName() + ".html" + "' href='" + config.dataPath()
                                        + File.separator + "help" + File.separator + prop.getName() + ".html"
                                        + "'>X</a>"
                                : "")
                        + "</TD>" + (sampleWorkflowFound(prop) ? "<TD BGCOLOR='lime'>" : "<TD BGCOLOR='red'>")
                        + (sampleWorkflowFound(prop) ? "<a title='" + prop.get("SampleWorkflow") + "'>X</a>"
                                : "")
                        + "</TD>" + (prop.isSet("Description") ? "<TD BGCOLOR='lime'>" : "<TD BGCOLOR='red'>")
                        + (prop.isSet("Description") ? "<a title='" + prop.get("Description") + "'>X</a>" : "")
                        + "</TD>" + (prop.isSet("Publication") ? "<TD BGCOLOR='lime'>" : "<TD BGCOLOR='red'>")
                        + (prop.isSet("Publication") ? "<a title='" + prop.get("Publication") + "'>X</a>" : "")
                        + "</TD>"
                        + (Util.FileExists(prop.get("Executable")) ? "<TD BGCOLOR='lime'>"
                                : "<TD BGCOLOR='red'>")
                        + (prop.isSet("Executable") ? "<a title='" + prop.get("Executable") + "'>X</a>" : "")
                        + "</TD>"
                        + (Util.FileExists(prop.get("ExecutableMACOSX")) ? "<TD BGCOLOR='lime'>"
                                : "<TD BGCOLOR='red'>")
                        + (prop.isSet("ExecutableMacOSX")
                                ? "<a title='" + prop.get("ExecutableMacOSX") + "'>X</a>"
                                : "")
                        + "</TD>"
                        + (Util.FileExists(prop.get("ExecutableLinux")) ? "<TD BGCOLOR='lime'>"
                                : "<TD BGCOLOR='red'>")
                        + (prop.isSet("ExecutableLinux")
                                ? "<a title='" + prop.get("ExecutableLinux") + "'>X</a>"
                                : "")
                        + "</TD>" + "</TR>");

                if (config.getBoolean("debug"))
                    System.out.println("\t" + appli.getProperties().getName() + "\t"
                            + (prop.isSet("version") ? prop.get("version") : "") + "\t"
                            + (prop.isSet("Website") ? prop.get("Website") : "") + "\t"
                            + (prop.isSet("Executable") ? prop.getExecutable() : ""));
            }
        }
        report.println("</tbody></table></div></div></div>");
        report.println(this.foot());
        report.println("</body></html>");
        report.close();
        report.close();
    } catch (Exception e) {
        e.printStackTrace();
        Config.log("Error in generation application report (2) " + filename + "\n" + e.getMessage() + "\n"
                + e.getLocalizedMessage());
        return false;
    }
    return true;
}

From source file:view.CertificatePropertiesDialog.java

private void expandTree(JTree tree) {
    TreeNode root = (TreeNode) tree.getModel().getRoot();
    expandAll(tree, new TreePath(root));
}

From source file:vista.MainWindow.java

/**
 * Mapeo del cliente para su arbol de directorios.
 *  Me interesa encapsulamiento 'package' para refrescar cuando cree carpetas / ficheros.
 *///from  w  ww  .j  a  va  2 s  .c  o m
static void setArbolCliente() {
    JTree mapeoCliente = new Mapeador().mapear();
    jTreeCliente.setModel(mapeoCliente.getModel());
    jTreeCliente.setSelectionRow(0);
    jTreeCliente.setShowsRootHandles(false);
}

From source file:vista.MainWindow.java

/**
 * Setteo del model del tree de la GUI por el obtenido mediante el mapeo del server.
 * @param treeServer JTree obtenido del server.
 *//*from   www .  j ava  2s. c  o  m*/
private void setArbolServer() {
    try {
        URL url = new URL("ftp://" + user + ": " + "@127.0.0.1:6598");
        JTree tree = Red.setArbolFTP(url);

        this.jTreeServer.setModel(tree.getModel());
        this.jTreeServer.setSelectionRow(0);
        this.jTreeServer.setShowsRootHandles(false);
    } catch (IOException ex) {
        ex.printStackTrace();
    }
}