Search in sources :

Example 1 with CollapsiblePanel

use of com.android.tools.idea.gradle.structure.configurables.ui.CollapsiblePanel in project android by JetBrains.

the class IssuesViewer method display.

public void display(@NotNull Collection<PsIssue> issues) {
    if (issues.isEmpty()) {
        if (myShowEmptyText) {
            myEmptyIssuesLabel.setVisible(true);
        }
        myIssuesPanel1.setVisible(false);
        myIssuesPanel2.setVisible(false);
        myIssuesPanel3.setVisible(false);
        myIssuesPanel4.setVisible(false);
        revalidateAndRepaintPanels();
        return;
    } else {
        myEmptyIssuesLabel.setVisible(false);
        myIssuesPanel1.setVisible(true);
        myIssuesPanel2.setVisible(true);
        myIssuesPanel3.setVisible(true);
        myIssuesPanel4.setVisible(true);
    }
    Map<PsIssue.Severity, List<PsIssue>> issuesBySeverity = Maps.newHashMap();
    for (PsIssue issue : issues) {
        PsIssue.Severity severity = issue.getSeverity();
        List<PsIssue> currentIssues = issuesBySeverity.get(severity);
        if (currentIssues == null) {
            currentIssues = Lists.newArrayList();
            issuesBySeverity.put(severity, currentIssues);
        }
        currentIssues.add(issue);
    }
    List<PsIssue.Severity> severities = Lists.newArrayList(issuesBySeverity.keySet());
    Collections.sort(severities, (t1, t2) -> t1.getPriority() - t2.getPriority());
    int typeCount = severities.size();
    // There are only 4 types of issues
    assert typeCount < 5;
    // Start displaying from last to first
    int currentIssueIndex = typeCount - 1;
    PsIssue.Severity severity = severities.get(currentIssueIndex);
    List<PsIssue> group = issuesBySeverity.get(severity);
    updateTitle(((CollapsiblePanel) myIssuesPanel4), severity, group);
    renderIssues(group, myIssuesView4);
    currentIssueIndex--;
    if (currentIssueIndex < 0) {
        myIssuesPanel1.setVisible(false);
        myIssuesPanel2.setVisible(false);
        myIssuesPanel3.setVisible(false);
        revalidateAndRepaintPanels();
        return;
    }
    severity = severities.get(currentIssueIndex);
    group = issuesBySeverity.get(severity);
    updateTitle(((CollapsiblePanel) myIssuesPanel3), severity, group);
    renderIssues(group, myIssuesView3);
    currentIssueIndex--;
    if (currentIssueIndex < 0) {
        myIssuesPanel1.setVisible(false);
        myIssuesPanel2.setVisible(false);
        revalidateAndRepaintPanels();
        return;
    }
    severity = severities.get(currentIssueIndex);
    group = issuesBySeverity.get(severity);
    updateTitle(((CollapsiblePanel) myIssuesPanel2), severity, group);
    renderIssues(group, myIssuesView2);
    currentIssueIndex--;
    if (currentIssueIndex < 0) {
        myIssuesPanel1.setVisible(false);
        revalidateAndRepaintPanels();
        return;
    }
    severity = severities.get(currentIssueIndex);
    group = issuesBySeverity.get(severity);
    updateTitle(((CollapsiblePanel) myIssuesPanel1), severity, group);
    renderIssues(group, myIssuesView1);
    revalidateAndRepaintPanels();
}
Also used : List(java.util.List) PsIssue(com.android.tools.idea.gradle.structure.model.PsIssue) CollapsiblePanel(com.android.tools.idea.gradle.structure.configurables.ui.CollapsiblePanel) UiUtil.revalidateAndRepaint(com.android.tools.idea.gradle.structure.configurables.ui.UiUtil.revalidateAndRepaint)

Example 2 with CollapsiblePanel

use of com.android.tools.idea.gradle.structure.configurables.ui.CollapsiblePanel in project android by JetBrains.

the class DependencyInfoPanel method createUIComponents.

private void createUIComponents() {
    myDependencyDetailsPanel = new CollapsiblePanel("Details");
    myIssuesPanel = new JPanel(new BorderLayout());
}
Also used : CollapsiblePanel(com.android.tools.idea.gradle.structure.configurables.ui.CollapsiblePanel)

Example 3 with CollapsiblePanel

use of com.android.tools.idea.gradle.structure.configurables.ui.CollapsiblePanel in project android by JetBrains.

the class IssuesViewer method createUIComponents.

private void createUIComponents() {
    Font font = getTreeFont();
    NavigationHyperlinkListener hyperlinkListener = new NavigationHyperlinkListener();
    myIssuesPanel1 = new CollapsiblePanel();
    myIssuesView1 = new JEditorPane();
    myIssuesView1.setFocusable(false);
    myIssuesView1.addHyperlinkListener(hyperlinkListener);
    setUpAsHtmlLabel(myIssuesView1, font);
    ((CollapsiblePanel) myIssuesPanel1).setContents(myIssuesView1);
    myIssuesPanel2 = new CollapsiblePanel();
    myIssuesView2 = new JEditorPane();
    myIssuesView2.setFocusable(false);
    myIssuesView2.addHyperlinkListener(hyperlinkListener);
    setUpAsHtmlLabel(myIssuesView2, font);
    ((CollapsiblePanel) myIssuesPanel2).setContents(myIssuesView2);
    myIssuesPanel3 = new CollapsiblePanel();
    myIssuesView3 = new JEditorPane();
    myIssuesView3.setFocusable(false);
    myIssuesView3.addHyperlinkListener(hyperlinkListener);
    setUpAsHtmlLabel(myIssuesView3, font);
    ((CollapsiblePanel) myIssuesPanel3).setContents(myIssuesView3);
    myIssuesPanel4 = new CollapsiblePanel();
    myIssuesView4 = new JEditorPane();
    myIssuesView4.setFocusable(false);
    myIssuesView4.addHyperlinkListener(hyperlinkListener);
    setUpAsHtmlLabel(myIssuesView4, font);
    ((CollapsiblePanel) myIssuesPanel4).setContents(myIssuesView4);
}
Also used : CollapsiblePanel(com.android.tools.idea.gradle.structure.configurables.ui.CollapsiblePanel) UIUtil.getTreeFont(com.intellij.util.ui.UIUtil.getTreeFont)

Aggregations

CollapsiblePanel (com.android.tools.idea.gradle.structure.configurables.ui.CollapsiblePanel)3 UiUtil.revalidateAndRepaint (com.android.tools.idea.gradle.structure.configurables.ui.UiUtil.revalidateAndRepaint)1 PsIssue (com.android.tools.idea.gradle.structure.model.PsIssue)1 UIUtil.getTreeFont (com.intellij.util.ui.UIUtil.getTreeFont)1 List (java.util.List)1