Search in sources :

Example 1 with OutlineModel

use of org.netbeans.swing.outline.OutlineModel in project gephi by gephi.

the class ReportPanel method fillIssues.

private void fillIssues(Report report) {
    final List<Issue> issues = new ArrayList<>();
    Iterator<Issue> itr = report.getIssues(ISSUES_LIMIT);
    while (itr.hasNext()) {
        issues.add(itr.next());
    }
    if (issues.isEmpty()) {
        JLabel label = new JLabel(NbBundle.getMessage(getClass(), "ReportPanel.noIssues"));
        label.setHorizontalAlignment(SwingConstants.CENTER);
        tab1ScrollPane.setViewportView(label);
    } else {
        //Busy label
        final BusyUtils.BusyLabel busyLabel = BusyUtils.createCenteredBusyLabel(tab1ScrollPane, "Retrieving issues...", issuesOutline);
        //Thread
        Thread thread = new Thread(fillingThreads, new Runnable() {

            @Override
            public void run() {
                busyLabel.setBusy(true);
                final TreeModel treeMdl = new IssueTreeModel(issues);
                final OutlineModel mdl = DefaultOutlineModel.createOutlineModel(treeMdl, new IssueRowModel(), true);
                SwingUtilities.invokeLater(new Runnable() {

                    @Override
                    public void run() {
                        issuesOutline.setRootVisible(false);
                        issuesOutline.setRenderDataProvider(new IssueRenderer());
                        issuesOutline.setModel(mdl);
                        busyLabel.setBusy(false);
                    }
                });
            }
        }, "Report Panel Issues Outline");
        if (NbPreferences.forModule(ReportPanel.class).getBoolean(SHOW_ISSUES, true)) {
            thread.start();
        }
    }
}
Also used : BusyUtils(org.gephi.ui.components.BusyUtils) Issue(org.gephi.io.importer.api.Issue) ArrayList(java.util.ArrayList) JLabel(javax.swing.JLabel) TreeModel(javax.swing.tree.TreeModel) OutlineModel(org.netbeans.swing.outline.OutlineModel) DefaultOutlineModel(org.netbeans.swing.outline.DefaultOutlineModel)

Aggregations

ArrayList (java.util.ArrayList)1 JLabel (javax.swing.JLabel)1 TreeModel (javax.swing.tree.TreeModel)1 Issue (org.gephi.io.importer.api.Issue)1 BusyUtils (org.gephi.ui.components.BusyUtils)1 DefaultOutlineModel (org.netbeans.swing.outline.DefaultOutlineModel)1 OutlineModel (org.netbeans.swing.outline.OutlineModel)1