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.text.SimpleDateFormat;
8   import java.util.Comparator;
9   
10  /**
11   * Created by IntelliJ IDEA.
12   * User: lguminski
13   * Date: Jun 19, 2008
14   * Time: 7:56:37 AM
15   * To change this template use File | Settings | File Templates.
16   */
17  public class VCommentCreateDateColumn extends TableColumnInfo {
18  	private static final int COL_WIDTH = 120;
19  	public static final SimpleDateFormat FORMATTER = new SimpleDateFormat("d MMM yyyy, HH:mm Z");
20  
21  	public String getColumnName() {
22  		return "Created";
23  	}
24  
25  	public Object valueOf(Object o) {
26  		return FORMATTER.format(((VersionedComment) o).getCreateDate());
27  	}
28  
29  	public Class getColumnClass() {
30  		return String.class;
31  	}
32  
33  	public Comparator getComparator() {
34  		return new Comparator() {
35  			public int compare(Object o, Object o1) {
36  				return ((VersionedComment) o).getCreateDate().compareTo(((VersionedComment) o1).getCreateDate());
37  			}
38  		};
39  	}
40  
41  	public int getPrefferedWidth() {
42  		return COL_WIDTH;
43  	}
44  
45  }