/** * Installs a new TableComparatorChooser that responds to clicks on the * header of the specified table and uses them to sort the specified * <code>sortedList</code> by delegating to the given <code>strategy</code> * If at any time the table should no longer sort, the behaviour can be * removed calling {@link #dispose()} on the object returned by this method. * * <p>This method makes no assumptions about the TableModel implementation * that backs the JTable. As such, it requires the TableFormat as an explicit * parameter and expects the TableFormat to be constant (i.e. never changes) * for the life of the TableComparatorChooser. * * @param table the table with headers that can be clicked on * @param tableFormat the TableFormat providing the columns for the table * @param sortedList the sorted list to update * @param strategy an implementations of {@link SortingStrategy}, typically one of * <ul> * <li> {@link AbstractTableComparatorChooser#SINGLE_COLUMN} * <li> {@link AbstractTableComparatorChooser#MULTIPLE_COLUMN_MOUSE} * <li> {@link AbstractTableComparatorChooser#MULTIPLE_COLUMN_KEYBOARD} * <li> {@link AbstractTableComparatorChooser#MULTIPLE_COLUMN_MOUSE_WITH_UNDO} * </ul> * @return TableComparatorChooser object that is responsible for translating * mouse clicks on the table header into sorting actions on the sortedList. */ public static <E> TableComparatorChooser<E> install(JTable table, SortedList<E> sortedList, Object strategy, TableFormat<? super E> tableFormat) { return new TableComparatorChooser<E>(table, sortedList, strategy, tableFormat); }
/** * Installs a new TableComparatorChooser that responds to clicks on the * header of the specified table and uses them to sort the specified * <code>sortedList</code> by delegating to the given <code>strategy</code> * If at any time the table should no longer sort, the behaviour can be * removed calling {@link #dispose()} on the object returned by this method. * * <p>This method makes no assumptions about the TableModel implementation * that backs the JTable. As such, it requires the TableFormat as an explicit * parameter and expects the TableFormat to be constant (i.e. never changes) * for the life of the TableComparatorChooser. * * @param table the table with headers that can be clicked on * @param tableFormat the TableFormat providing the columns for the table * @param sortedList the sorted list to update * @param strategy an implementations of {@link SortingStrategy}, typically one of * <ul> * <li> {@link AbstractTableComparatorChooser#SINGLE_COLUMN} * <li> {@link AbstractTableComparatorChooser#MULTIPLE_COLUMN_MOUSE} * <li> {@link AbstractTableComparatorChooser#MULTIPLE_COLUMN_KEYBOARD} * <li> {@link AbstractTableComparatorChooser#MULTIPLE_COLUMN_MOUSE_WITH_UNDO} * </ul> * @return TableComparatorChooser object that is responsible for translating * mouse clicks on the table header into sorting actions on the sortedList. */ public static <E> TableComparatorChooser<E> install(JTable table, SortedList<E> sortedList, Object strategy, TableFormat<? super E> tableFormat) { return new TableComparatorChooser<E>(table, sortedList, strategy, tableFormat); }
return new TableComparatorChooser<E>(table, sortedList, strategy, tableFormat);