1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package com.atlassian.theplugin.idea.crucible.tree;
17
18 import com.atlassian.theplugin.crucible.model.CrucibleReviewListModel;
19 import com.atlassian.theplugin.idea.ui.tree.paneltree.AbstractTreeNode;
20 import com.atlassian.theplugin.idea.ui.tree.paneltree.SelectableLabel;
21
22 import javax.swing.*;
23
24
25
26
27 public class CrucibleMyReviewsTreeNode extends AbstractTreeNode {
28 private static final String NAME = "All My Reviews";
29 private final CrucibleReviewListModel reviewListModel;
30
31 public CrucibleMyReviewsTreeNode(CrucibleReviewListModel reviewListModel) {
32 super(NAME, null, null);
33 this.reviewListModel = reviewListModel;
34 }
35
36 public String toString() {
37 int cnt = reviewListModel.getPredefinedFiltersReviewCount();
38 String txt = NAME;
39 if (cnt > -1) {
40 txt += " (" + cnt + ")";
41 }
42 return txt;
43 }
44
45 public JComponent getRenderer(JComponent c, boolean selected, boolean expanded, boolean hasFocus) {
46 String txt = selected ? "<html>" + toString() : NAME;
47 return new SelectableLabel(selected, c.isEnabled(), c.getFont(), txt, ICON_HEIGHT);
48 }
49
50 public void onSelect() {
51 }
52 }