1 44 45 package org.jfree.ui; 46 47 import javax.swing.table.AbstractTableModel ; 48 49 54 public abstract class SortableTableModel extends AbstractTableModel { 55 56 57 private int sortingColumn; 58 59 60 private boolean ascending; 61 62 65 public SortableTableModel() { 66 this.sortingColumn = -1; 67 this.ascending = true; 68 } 69 70 76 public int getSortingColumn() { 77 return this.sortingColumn; 78 } 79 80 87 public boolean isAscending() { 88 return ascending; 89 } 90 91 97 public void setAscending(final boolean flag) { 98 this.ascending = flag; 99 } 100 101 107 public void sortByColumn(final int column, final boolean ascending) { 108 if (isSortable(column)) { 109 this.sortingColumn = column; 110 } 111 } 112 113 120 public boolean isSortable(final int column) { 121 return false; 122 } 123 124 } 125 | Popular Tags |