1 package com.atlassian.theplugin.idea.crucible.comments;
2
3 import com.atlassian.theplugin.idea.TableColumnInfo;
4 import com.atlassian.theplugin.commons.crucible.api.model.GeneralComment;
5 import com.atlassian.theplugin.commons.crucible.api.model.VersionedComment;
6
7 import java.util.Comparator;
8
9
10
11
12
13
14
15
16 public class VCommentRepliesColumn extends TableColumnInfo {
17 private static final int COL_WIDTH = 50;
18
19 public String getColumnName() {
20 return "Replies";
21 }
22
23 public Object valueOf(Object o) {
24 return String.valueOf(((VersionedComment) o).getReplies().size());
25 }
26
27 public Class getColumnClass() {
28 return String.class;
29 }
30
31 public Comparator getComparator() {
32 return new Comparator() {
33 public int compare(Object o, Object o1) {
34 return Integer.valueOf(((VersionedComment) o).getReplies().size()).compareTo(
35 ((VersionedComment) o1).getReplies().size()
36 );
37 }
38 };
39 }
40
41 public int getPrefferedWidth() {
42 return COL_WIDTH;
43 }
44 }