View Javadoc

1   // %1126721330698:hoplugins.transfers.ui%
2   package hoplugins.transfers.ui;
3   
4   import hoplugins.commons.ui.DefaultTableSorter;
5   
6   import java.util.Comparator;
7   
8   import javax.swing.table.TableModel;
9   
10  
11  /***
12   * Sorter for the team transfer table.
13   *
14   * @author <a href=mailto:nethyperon@users.sourceforge.net>Boy van der Werf</a>
15   */
16  public class TeamTransferSorter extends DefaultTableSorter {
17      //~ Constructors -------------------------------------------------------------------------------
18  
19      /***
20       * Create a TransferTypeSorter
21       *
22       * @param model Table model to sort.
23       */
24      public TeamTransferSorter(TableModel model) {
25          super(model);
26      }
27  
28      //~ Methods ------------------------------------------------------------------------------------
29  
30      /***
31       * Method that define Custom Comparator
32       *
33       * @param column column to sort
34       *
35       * @return A custom comparator if any, null if not specified
36       */
37      public final Comparator getCustomComparator(int column) {
38          if ((column == 1) || (column == 2) || (column >= 6)) {
39              return new Comparator() {
40                      public boolean equals(Object arg0) {
41                          return false;
42                      }
43  
44                      public int compare(Object arg0, Object arg1) {
45                          final Integer d1 = (Integer) arg0;
46                          final Integer d2 = (Integer) arg1;
47                          return d1.compareTo(d2);
48                      }
49                  };
50          }
51  
52          return null;
53      }
54  }