Package com.iizix.swt

Class TableSorter

  • All Implemented Interfaces:
    org.eclipse.swt.widgets.Listener

    public class TableSorter
    extends java.lang.Object
    implements org.eclipse.swt.widgets.Listener
    Helper class to handle SWT table sorting.
    Author:
    Christopher Mindus
    • Field Summary

      Fields 
      Modifier and TypeFieldDescription
      static java.util.Comparator<java.lang.Object>NUMBER_COMPARATOR
      A number comparator, comparing numbers or strings.
    • Constructor Summary

      Constructors 
      ConstructorDescription
      TableSorter​(org.eclipse.swt.widgets.Table table, java.lang.String... dataKeys)
      Constructs the table sorter and specifies column comparators.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidhandleEvent​(org.eclipse.swt.widgets.Event event)
      Sorts the list on the selected column.
      voidsetComparator​(int index, java.util.Comparator<java.lang.Object> comparator)
      Sets the comparator for a column index.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NUMBER_COMPARATOR

        public static final java.util.Comparator<java.lang.Object> NUMBER_COMPARATOR
        A number comparator, comparing numbers or strings.
    • Constructor Detail

      • TableSorter

        public TableSorter​(org.eclipse.swt.widgets.Table table,
                           java.lang.String... dataKeys)
        Constructs the table sorter and specifies column comparators.
        Parameters:
        table - The table.
    • Method Detail

      • setComparator

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

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