/** * Creates and installs a TableComparatorChooser. * * @param table the table with headers that can be clicked on * @param sortedList the sorted list to update * @param strategy an implementations of {@link ca.odell.glazedlists.impl.gui.SortingStrategy}, typically one of * <ul> * <li> {@link ca.odell.glazedlists.gui.AbstractTableComparatorChooser#SINGLE_COLUMN} * <li> {@link ca.odell.glazedlists.gui.AbstractTableComparatorChooser#MULTIPLE_COLUMN_MOUSE} * <li> {@link ca.odell.glazedlists.gui.AbstractTableComparatorChooser#MULTIPLE_COLUMN_KEYBOARD} * <li> {@link ca.odell.glazedlists.gui.AbstractTableComparatorChooser#MULTIPLE_COLUMN_MOUSE_WITH_UNDO} * @param tableFormat the TableFormat providing the columns for the table */ protected TableComparatorChooser(JTable table, SortedList<E> sortedList, Object strategy, TableFormat<? super E> tableFormat) { super(sortedList, tableFormat); validateSortingStrategy(strategy); // save the Swing-specific state this.table = table; this.table.addPropertyChangeListener("model", tableModelHandler); this.table.getTableHeader().addPropertyChangeListener("UI", tableHeaderUIHandler); // wrap the default table header with logic that decorates it with a sorting icon wrapDefaultTableHeaderRenderer(); // listen for events on the specified table table.getModel().addTableModelListener(tableModelHandler); // install the sorting strategy to interpret clicks headerClickHandler = new HeaderClickHandler(table, (SortingStrategy)strategy); }
/** * Creates and installs a TableComparatorChooser. * * @param table the table with headers that can be clicked on * @param sortedList the sorted list to update * @param strategy an implementations of {@link ca.odell.glazedlists.impl.gui.SortingStrategy}, typically one of * <ul> * <li> {@link ca.odell.glazedlists.gui.AbstractTableComparatorChooser#SINGLE_COLUMN} * <li> {@link ca.odell.glazedlists.gui.AbstractTableComparatorChooser#MULTIPLE_COLUMN_MOUSE} * <li> {@link ca.odell.glazedlists.gui.AbstractTableComparatorChooser#MULTIPLE_COLUMN_KEYBOARD} * <li> {@link ca.odell.glazedlists.gui.AbstractTableComparatorChooser#MULTIPLE_COLUMN_MOUSE_WITH_UNDO} * @param tableFormat the TableFormat providing the columns for the table */ protected TableComparatorChooser(JTable table, SortedList<E> sortedList, Object strategy, TableFormat<? super E> tableFormat) { super(sortedList, tableFormat); validateSortingStrategy(strategy); // save the Swing-specific state this.table = table; this.table.addPropertyChangeListener("model", tableModelHandler); this.table.getTableHeader().addPropertyChangeListener("UI", tableHeaderUIHandler); // wrap the default table header with logic that decorates it with a sorting icon wrapDefaultTableHeaderRenderer(); // listen for events on the specified table table.getModel().addTableModelListener(tableModelHandler); // install the sorting strategy to interpret clicks headerClickHandler = new HeaderClickHandler(table, (SortingStrategy)strategy); }
/** * Creates and installs a TableComparatorChooser. * * @param table the table with headers that can be clicked on * @param sortedList the sorted list to update * @param strategy an implementations of {@link ca.odell.glazedlists.impl.gui.SortingStrategy}, typically one of * <ul> * <li> {@link ca.odell.glazedlists.gui.AbstractTableComparatorChooser#SINGLE_COLUMN} * <li> {@link ca.odell.glazedlists.gui.AbstractTableComparatorChooser#MULTIPLE_COLUMN_MOUSE} * <li> {@link ca.odell.glazedlists.gui.AbstractTableComparatorChooser#MULTIPLE_COLUMN_KEYBOARD} * <li> {@link ca.odell.glazedlists.gui.AbstractTableComparatorChooser#MULTIPLE_COLUMN_MOUSE_WITH_UNDO} * @param tableFormat the TableFormat providing the columns for the table */ protected TableComparatorChooser(JTable table, SortedList<E> sortedList, Object strategy, TableFormat<? super E> tableFormat) { super(sortedList, tableFormat); validateSortingStrategy(strategy); // save the Swing-specific state this.table = table; this.table.addPropertyChangeListener("model", tableModelHandler); this.table.getTableHeader().addPropertyChangeListener("UI", tableHeaderUIHandler); // wrap the default table header with logic that decorates it with a sorting icon wrapDefaultTableHeaderRenderer(); // listen for events on the specified table table.getModel().addTableModelListener(tableModelHandler); // install the sorting strategy to interpret clicks headerClickHandler = new HeaderClickHandler(table, (SortingStrategy)strategy); }