ca.odell.glazedlists.swing
Class EventListJXTableSorting

java.lang.Object
  extended by ca.odell.glazedlists.swing.EventListJXTableSorting

public class EventListJXTableSorting
extends Object

Sort a JXTable using SortedList.

Extension: SwingX
This Glazed Lists extension requires the third party library SwingX.
Tested Version:CVS Head, September 18, 2006
Home page:https://swingx.dev.java.net/
License:LGPL

To prepare a JXTable to be sorted using a SortedList:

  • Create a SortedList and EventTableModel that depends on that SortedList.
  • Create a JXTable using the EventTableModel as its model.
  • Run the install(JXTable, ca.odell.glazedlists.SortedList) method to bind the JXTable's headers to the SortedList's Comparator.

    Note that your FilterPipeline will be changed as a consequence of using EventListJXTableSorting. This is due to API limitations in SwingX which will hopefully be eventually resolved. For this reason it is recommended that you not use FilterPipeline with this class. Instead, consider using FilterList for filtering your JXTable.

    Since this class works with the SwingX project, it is likely to change as SwingX continues to evolve and mature. We will attempt to maintain source and binary compatibility as SwingX changes, but it is highly recommended that you test your table sorting each time you update your SwingX jar file.

    The behaviour of multiple column sorting in JXTable is not particularly flexible. For different configuration options, consider using a TableComparatorChooser instead of EventListJXTableSorting. To do this, you'll first need to disable the JXTable's built-in sorting and restore the standard header renderer:

    JXTable table = ...
     table.setSortable(false);
     table.getTableHeader().setDefaultRenderer(new JTableHeader().getDefaultRenderer());

    Author:
    Jesse Wilson

    Method Summary
    static EventListJXTableSorting install(JXTable table, SortedList sortedList)
              Install this EventListJXTableSorting to provide the sorting behaviour for the specified JXTable.
     void setMultipleColumnSort(boolean multipleColumnSort)
              Toggle whether clicked columns will be sorted after other sorted columns (ie.
     void uninstall()
              Remove this EventListJXTableSorting from the JXTable.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Method Detail

    install

    public static EventListJXTableSorting install(JXTable table,
                                                  SortedList sortedList)
    Install this EventListJXTableSorting to provide the sorting behaviour for the specified JXTable.


    setMultipleColumnSort

    public void setMultipleColumnSort(boolean multipleColumnSort)
    Toggle whether clicked columns will be sorted after other sorted columns (ie. break ties), or whether they will be come the exclusive sorted column.

    The default behaviour of JXTable multiple column sorting is that each click appends a column to the sorting columns, reversing that column if it's already sorting. Clearing the sorting columns is done by holding SHIFT and clicking on a column header.

    See Also:
    to change the clear/click behaviour, for a more flexible approach to table sorting

    uninstall

    public void uninstall()
    Remove this EventListJXTableSorting from the JXTable.



    Glazed Lists, Copyright © 2003 publicobject.com, O'Dell Engineering.
    Documentation build by mockbuild at 2013-02-07 9:25