View Javadoc

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   * Created by IntelliJ IDEA.
11   * User: lguminski
12   * Date: Jun 20, 2008
13   * Time: 2:35:21 PM
14   * To change this template use File | Settings | File Templates.
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  }