Package com.iizix.swt

Class TableSorter

java.lang.Object
com.iizix.swt.TableSorter
All Implemented Interfaces:
Listener

public class TableSorter extends Object implements Listener
Helper class to handle SWT table sorting.
Author:
Christopher Mindus
  • Field Details Link icon

    • NUMBER_COMPARATOR Link icon

      public static final Comparator<Object> NUMBER_COMPARATOR
      A number comparator, comparing numbers or strings.
  • Constructor Details Link icon

    • TableSorter Link icon

      public TableSorter(Table table, String... dataKeys)
      Constructs the table sorter and specifies column comparators.
      Parameters:
      table - The table.
  • Method Details Link icon

    • setComparator Link icon

      public void setComparator(int index, Comparator<Object> comparator)
      Sets the comparator for a column index.
      Parameters:
      index - The column index.
      comparator - The comparator.
    • handleEvent Link icon

      public void handleEvent(Event event)
      Sorts the list on the selected column.
      Specified by:
      handleEvent in interface Listener
      Parameters:
      event -