/** * Creates and installs a TableComparatorChooser. * * @deprecated 9/25/06 replaced with {@link #install}, which is functionally * identical but uses a more fitting name to convey the action that is * performed and fixes an API flaw by explicitly requiring the TableFormat. */ public TableComparatorChooser(JTable table, SortedList<E> sortedList, Object strategy) { this(table, sortedList,strategy,((AdvancedTableModel<E>)table.getModel()).getTableFormat()); }
/** * Creates and installs a TableComparatorChooser. * * @deprecated 9/25/06 replaced with {@link #install}, which is functionally * identical but uses a more fitting name to convey the action that is * performed and fixes an API flaw by explicitly requiring the TableFormat. */ public TableComparatorChooser(JTable table, SortedList<E> sortedList, Object strategy) { this(table, sortedList,strategy,((AdvancedTableModel<E>)table.getModel()).getTableFormat()); }
/** * Creates and installs a TableComparatorChooser. * * @deprecated 9/25/06 replaced with {@link #install}, which is functionally * identical but uses a more fitting name to convey the action that is * performed and fixes an API flaw by explicitly requiring the TableFormat. */ @Deprecated public TableComparatorChooser(JTable table, SortedList<E> sortedList, Object strategy) { this(table, sortedList,strategy,((AdvancedTableModel<E>)table.getModel()).getTableFormat()); }
/** * 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 assumes that the JTable is backed by an AdvancedTableModel * and it is from that AdvancedTableModel that the TableFormat should be * extracted. This is, by far, the typical case and so we provide this * simpler install method for convenience. * * @param table the table with headers that can be clicked on * @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) { return install(table, sortedList, strategy, ((AdvancedTableModel<E>)table.getModel()).getTableFormat()); }
/** * 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 assumes that the JTable is backed by an AdvancedTableModel * and it is from that AdvancedTableModel that the TableFormat should be * extracted. This is, by far, the typical case and so we provide this * simpler install method for convenience. * * @param table the table with headers that can be clicked on * @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) { return install(table, sortedList, strategy, ((AdvancedTableModel<E>)table.getModel()).getTableFormat()); }
return install(table, sortedList, strategy, ((AdvancedTableModel<E>)table.getModel()).getTableFormat());
/** * We need to fix this implementation so it looks into the {@link JXTable}'s * {@link TableColumnExt} to find the appropriate column comparator. Failing * that, it could look for an {@link AdvancedTableFormat} and the column's * Comparator. */ private Comparator getComparator(int modelIndex) { AdvancedTableModel tableModel = (AdvancedTableModel) table.getModel(); TableFormat tableFormat = tableModel.getTableFormat(); return new TableColumnComparator(tableFormat, modelIndex); }
/** * We need to fix this implementation so it looks into the {@link JXTable}'s * {@link TableColumnExt} to find the appropriate column comparator. Failing * that, it could look for an {@link AdvancedTableFormat} and the column's * Comparator. */ private Comparator getComparator(int modelIndex) { AdvancedTableModel tableModel = (AdvancedTableModel) table.getModel(); TableFormat tableFormat = tableModel.getTableFormat(); return new TableColumnComparator(tableFormat, modelIndex); }