public class ClassColorTableModel extends AbstractTableModel
Modifier and Type | Field and Description |
---|---|
private Color[] |
classColors |
private String[] |
classNames |
private boolean[] |
classSelected |
static int |
COLOR_COLUMN_INDEX |
private static String[] |
columnTitles |
static int |
NAME_COLUMN_INDEX |
static int |
SELECT_COLUMN_INDEX |
private boolean |
selectionAllowed |
private static long |
serialVersionUID |
listenerList
Constructor and Description |
---|
ClassColorTableModel() |
ClassColorTableModel(String[] names,
Color[] colors) |
Modifier and Type | Method and Description |
---|---|
static BufferedImage |
asBufferedImage(ClassColorTableModel theModel) |
static BufferedImage |
asBufferedImage(ClassColorTableModel theModel,
boolean showAllRows) |
static JTable |
createColorLegendTable(ClassColorTableModel theModel)
Creates a ColorLegendTable to be used with the required default listeners added.
|
private static void |
fixColumnWidth(JTable table,
int columnIndex,
boolean setMin,
boolean setMax) |
String |
getClassName(int row) |
String[] |
getClassNames() |
Color |
getColor(int row) |
Color[] |
getColors() |
Class<?> |
getColumnClass(int columnIndex) |
int |
getColumnCount() |
String |
getColumnName(int columnIndex) |
String |
getLongestName() |
int |
getRowCount() |
String[] |
getSelectedClasses() |
int[] |
getSelectedClassIndices() |
Object |
getValueAt(int rowIndex,
int columnIndex) |
boolean |
isAllSelected() |
boolean |
isCellEditable(int rowIndex,
int columnIndex) |
boolean |
isSelectionAllowed() |
static void |
main(String[] args) |
void |
setAllSelected(boolean selected) |
void |
setColumnName(int columnIndex,
String name) |
void |
setSelected(int[] selectedClassIndices) |
void |
setSelected(int rowIndex,
boolean selected) |
void |
setSelectionAllowed(boolean selectionAllowed) |
void |
setValueAt(Object aValue,
int rowIndex,
int columnIndex) |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
private static final long serialVersionUID
public static final int NAME_COLUMN_INDEX
public static final int COLOR_COLUMN_INDEX
public static final int SELECT_COLUMN_INDEX
private static String[] columnTitles
private final Color[] classColors
private final String[] classNames
private final boolean[] classSelected
private boolean selectionAllowed
public void setAllSelected(boolean selected)
public void setSelected(int rowIndex, boolean selected)
public int getRowCount()
public int getColumnCount()
public String getColumnName(int columnIndex)
getColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
public void setColumnName(int columnIndex, String name)
public Class<?> getColumnClass(int columnIndex)
getColumnClass
in interface TableModel
getColumnClass
in class AbstractTableModel
public boolean isCellEditable(int rowIndex, int columnIndex)
isCellEditable
in interface TableModel
isCellEditable
in class AbstractTableModel
public Object getValueAt(int rowIndex, int columnIndex)
public void setValueAt(Object aValue, int rowIndex, int columnIndex)
setValueAt
in interface TableModel
setValueAt
in class AbstractTableModel
public static void main(String[] args)
public static JTable createColorLegendTable(ClassColorTableModel theModel)
theModel
- the ClassColorTableModel
private static void fixColumnWidth(JTable table, int columnIndex, boolean setMin, boolean setMax)
public boolean isAllSelected()
public String[] getSelectedClasses()
public int[] getSelectedClassIndices()
public Color[] getColors()
public Color getColor(int row)
public String[] getClassNames()
public String getClassName(int row)
public String getLongestName()
public boolean isSelectionAllowed()
public void setSelectionAllowed(boolean selectionAllowed)
public static BufferedImage asBufferedImage(ClassColorTableModel theModel)
public static BufferedImage asBufferedImage(ClassColorTableModel theModel, boolean showAllRows)
theModel
- The model to paintshowAllRows
- paint all rows or just selectedpublic void setSelected(int[] selectedClassIndices)