file_type.setIdentifier(UIConstants.SHARED_LIST_FILE_TYPE_COLUMN_ID);
file_type.setModelIndex(SharedFilesTableModel.TYPE);
file_type.setVisible(_pref.isColumnVisible(UIConstants.SHARED_LIST_FILE_TYPE_COLUMN_ID));
file_type.setHeaderValue("Type");
file_type.setCellRenderer(new FileTypeTableCellRenderer());
file_type.setComparator(new Comparator() {
public int compare(Object o1, Object o2) {
String file_type1 = FileFormatter.formatMimeType(((SharedFile)o1).getMimeType());
String file_type2 = FileFormatter.formatMimeType(((SharedFile)o2).getMimeType());
return Misc.compareAllObjects(file_type1, file_type2, "toString", true);
}
});
table_columns.add(file_type);
JMTableColumn file_hash = new JMTableColumn();
file_hash.setIdentifier(UIConstants.SHARED_LIST_FILE_ID_COLUMN_ID);
file_hash.setModelIndex(SharedFilesTableModel.HASH);
file_hash.setVisible(_pref.isColumnVisible(UIConstants.SHARED_LIST_FILE_ID_COLUMN_ID));
file_hash.setHeaderValue("Hash");
file_hash.setCellRenderer(new FileHashTableCellRenderer());
file_hash.setComparator(new GeneralComparator("getFileHash"));
table_columns.add(file_hash);
JMTableColumn completed = new JMTableColumn();
completed.setIdentifier(UIConstants.SHARED_LIST_COMPLETED_COLUMN_ID);
completed.setModelIndex(SharedFilesTableModel.COMPLETED);
completed.setVisible(_pref.isColumnVisible(UIConstants.SHARED_LIST_COMPLETED_COLUMN_ID));
completed.setHeaderValue("Completed");
completed.setCellRenderer(new CompletedTableCellRenderer());
completed.setComparator(new GeneralComparator("getPercentCompleted"));
completed.setComparator(new Comparator() {
public int compare(Object o1, Object o2) {
double completed1 = 100;
double completed2 = 100;
SharedFile shared_file1 = (SharedFile)o1;
SharedFile shared_file2 = (SharedFile)o2;