|
JClass DesktopViews 6.3.0 API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JTable | +--com.klg.jclass.util.swing.JCSortableTable
JCSortableTable
class.
Nested Class Summary | |
static interface |
JCSortableTable.SortableColumnHeader
Interface required by the column header component (if not a JLabel or JButton ) to allow setting of the
sort icon. |
protected class |
JCSortableTable.SortableHeaderRenderer
Renderer/editor that has two components: the label and the sort order icon, which is stored in a button. |
protected class |
JCSortableTable.SortableTableColumn
Overridden version of TableColumn that returns
SortableColumnRenderer instead of the normal default. |
class |
JCSortableTable.SortIcon
Internal sorting icon class. |
protected class |
JCSortableTable.TableHeaderMouseListener
MouseAdapter for the table header. |
Nested classes inherited from class javax.swing.JTable |
JTable.AccessibleJTable |
Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
protected Icon |
downIcon
|
protected com.klg.jclass.util.swing.JCRowSortTableModel |
sortModel
|
protected MouseListener |
tableHeaderMouseListener
|
protected Icon |
upIcon
|
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
JCSortableTable()
JCSortableTable is a subclass of JTable that
internally wraps any TableModel it is given with a
JCRowSortTableModel and provides a Comparator
that has a configureable list of the column indexes that it uses for sorting. |
|
JCSortableTable(int numRows,
int numColumns)
JCSortableTable is a subclass of JTable that
internally wraps any TableModel it is given with a
JCRowSortTableModel and provides a Comparator
that has a configureable list of the column indexes that it uses for sorting. |
|
JCSortableTable(Object[][] rowData,
Object[] columnNames)
JCSortableTable is a subclass of JTable that
internally wraps any TableModel it is given with a
JCRowSortTableModel and provides a Comparator
that has a configureable list of the column indexes that it uses for sorting. |
|
JCSortableTable(TableModel dm)
JCSortableTable is a subclass of JTable that
internally wraps any TableModel it is given with a
JCRowSortTableModel and provides a Comparator
that has a configureable list of the column indexes that it uses for sorting. |
|
JCSortableTable(TableModel dm,
TableColumnModel cm)
JCSortableTable is a subclass of JTable that
internally wraps any TableModel it is given with a
JCRowSortTableModel and provides a Comparator
that has a configureable list of the column indexes that it uses for sorting. |
|
JCSortableTable(TableModel dm,
TableColumnModel cm,
ListSelectionModel sm)
JCSortableTable is a subclass of JTable that
internally wraps any TableModel it is given with a
JCRowSortTableModel and provides a Comparator
that has a configureable list of the column indexes that it uses for sorting. |
|
JCSortableTable(Vector rowData,
Vector columnNames)
JCSortableTable is a subclass of JTable that
internally wraps any TableModel it is given with a
JCRowSortTableModel and provides a Comparator
that has a configureable list of the column indexes that it uses for sorting. |
Method Summary | |
protected void |
addTableHeaderMouseListener()
Adds a MouseListener to the table header. |
protected boolean |
checkColumnModel(TableColumnModel cm)
Makes sure passed in column model will work with JCSortableTable . |
protected void |
clearSortIcons()
Removes sorting icons from the column headers. |
protected void |
configureEnclosingScrollPane()
Overwrites the default implementation to remove a MouseListener
from the table header. |
void |
createDefaultColumnsFromModel()
Overridden from superclass to allow autocreation of our own column model. |
TableColumn |
createSortableTableColumn(int column)
This method creates a TableColumn for use in
JCSorttableTable . |
protected MouseAdapter |
createTableHeaderMouseListener()
Creates a new table header mouse listener. |
String |
getAbout()
Returns vendor information. |
boolean |
getAutoSort()
Returns whether the data is automatically sorted when it changes according the current comparator. |
TableCellEditor |
getCellEditor(int row,
int column)
Gets the cell editor for a given cell. |
TableCellRenderer |
getCellRenderer(int row,
int column)
Gets the cell renderer for a given cell. |
Icon |
getDownIcon()
Gets the icon used for reverse sorting. |
int[] |
getKeyColumns(int column)
Returns the key columns used to sort the table model when clicking on the specified column. |
Dimension |
getPreferredSize()
Override this method to allow a different default preferred size for design time. |
int |
getSortedRow(int row)
Returns the unsorted row index of specified sorted row. |
protected MouseListener |
getTableHeaderMouseListener()
Gets the current table header mouse listener. |
int |
getUnsortedRow(int sortedRow)
Returns the unsorted row index of specified sorted row. |
Icon |
getUpIcon()
Gets the icon used for forward sorting. |
protected void |
reLayoutColumnRenderers()
Iterate through the columns to get the renderer so that we can reset the horizontal alignment on JCCellRenderers. |
protected void |
removeTableHeaderMouseListener()
Removes a MouseListener from the table header. |
void |
setAbout(String s)
Provided for Beans property editors - has no effect. |
void |
setAutoSort(boolean autoSort)
Sets whether the data should be automatically sorted when it changes. |
void |
setColumnModel(TableColumnModel columnModel)
This JTable method is overridden to check and see if the passed
in column model is compatible with JCSortableTable . |
protected static void |
setComponentOrientation(Component c,
ComponentOrientation o,
boolean force)
Set component orientation on component c to the passed in orientation if its different. |
void |
setComponentOrientation(ComponentOrientation o)
Override so that the layout on the header renderers can be redone. |
void |
setDownIcon(Icon downIcon)
Sets the icon used for reverse sorting. |
void |
setKeyColumns(int column,
int[] keyColumns)
Sets the key columns used to sort the table model when clicking on specified column. |
void |
setModel(TableModel newModel)
Sets the data model for this table to newModel and registers
for listner notifications from the new data model. |
protected void |
setSortIcon(Component renderer,
Icon sortIcon)
Looks at the renderer (and possibly its children) and sets the sort icon on any JLabel s or JButton s that are found. |
protected void |
setSortIcon(int column)
Sets or removes the sorting icon. |
protected void |
setSortIcon(int column,
int order)
Sets or removes the sorting icon. |
void |
setTableHeader(JTableHeader newHeader)
Overwrites the default implementation to add a MouseListener
to the new table header. |
protected void |
setTableHeaderMouseListener(MouseListener l)
Sets the table header mouse listener. |
void |
setUpIcon(Icon upIcon)
Sets the icon used for forward sorting. |
void |
sort(int column)
Sorts rows using the quicksort algorithm. |
void |
tableChanged(TableModelEvent e)
Overrides super class method to check for a change in sorting. |
void |
unsort()
Restores the unsorted order. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Icon upIcon
protected Icon downIcon
protected com.klg.jclass.util.swing.JCRowSortTableModel sortModel
protected MouseListener tableHeaderMouseListener
Constructor Detail |
public JCSortableTable()
JCSortableTable
is a subclass of JTable
that
internally wraps any TableModel
it is given with a
JCRowSortTableModel
and provides a Comparator
that has a configureable list of the column indexes that it uses for sorting.
Clicking on a column header invokes the sorting behavior tied to that column,
clicking again reverses the sort.
public JCSortableTable(TableModel dm)
JCSortableTable
is a subclass of JTable
that
internally wraps any TableModel
it is given with a
JCRowSortTableModel
and provides a Comparator
that has a configureable list of the column indexes that it uses for sorting.
Clicking on a column header invokes the sorting behavior tied to that column,
clicking again reverses the sort.
dm
- the data model for the tablepublic JCSortableTable(TableModel dm, TableColumnModel cm)
JCSortableTable
is a subclass of JTable
that
internally wraps any TableModel
it is given with a
JCRowSortTableModel
and provides a Comparator
that has a configureable list of the column indexes that it uses for sorting.
Clicking on a column header invokes the sorting behavior tied to that column,
clicking again reverses the sort.
dm
- the data model for the tablecm
- the column model for the tablepublic JCSortableTable(TableModel dm, TableColumnModel cm, ListSelectionModel sm)
JCSortableTable
is a subclass of JTable
that
internally wraps any TableModel
it is given with a
JCRowSortTableModel
and provides a Comparator
that has a configureable list of the column indexes that it uses for sorting.
Clicking on a column header invokes the sorting behavior tied to that column,
clicking again reverses the sort.
dm
- the data model for the tablecm
- the column model for the tablesm
- the row selection model for the tablepublic JCSortableTable(int numRows, int numColumns)
JCSortableTable
is a subclass of JTable
that
internally wraps any TableModel
it is given with a
JCRowSortTableModel
and provides a Comparator
that has a configureable list of the column indexes that it uses for sorting.
Clicking on a column header invokes the sorting behavior tied to that column,
clicking again reverses the sort.
numRows
- the number of rows the table holdsnumColumns
- the number of columns the table holdsDefaultTableModel
public JCSortableTable(Vector rowData, Vector columnNames)
JCSortableTable
is a subclass of JTable
that
internally wraps any TableModel
it is given with a
JCRowSortTableModel
and provides a Comparator
that has a configureable list of the column indexes that it uses for sorting.
Clicking on a column header invokes the sorting behavior tied to that column,
clicking again reverses the sort.
rowData
- the data for the new tablecolumnNames
- the names of each columnpublic JCSortableTable(Object[][] rowData, Object[] columnNames)
JCSortableTable
is a subclass of JTable
that
internally wraps any TableModel
it is given with a
JCRowSortTableModel
and provides a Comparator
that has a configureable list of the column indexes that it uses for sorting.
Clicking on a column header invokes the sorting behavior tied to that column,
clicking again reverses the sort.
rowData
- the data for the new tablecolumnNames
- the names of each columnMethod Detail |
public Dimension getPreferredSize()
getPreferredSize
in class JComponent
public void setAbout(String s)
s
- the about Stringpublic String getAbout()
public void setModel(TableModel newModel)
newModel
and registers
for listner notifications from the new data model.
It wraps the TableModel
with a JCRowSortTableModel
and adds a mouse listener to the new table header.
setModel
in class JTable
newModel
- the new data model for the tablepublic int getSortedRow(int row)
row
- the unsorted row index
public int getUnsortedRow(int sortedRow)
sortedRow
- the sorted row index
public boolean getAutoSort()
autoSort
public void setAutoSort(boolean autoSort)
autoSort
- the new value of autoSort
public void setKeyColumns(int column, int[] keyColumns)
column
- index of columns in TableModel
keyColumns
- columns to use as keys to sort when sorting on the
specified columnpublic int[] getKeyColumns(int column)
column
- the column for which the key columns are required
public Icon getUpIcon()
public void setUpIcon(Icon upIcon)
upIcon
- the new icon used for forward sortingpublic Icon getDownIcon()
public void setDownIcon(Icon downIcon)
downIcon
- the new icon used for reverse sortingpublic void setTableHeader(JTableHeader newHeader)
MouseListener
to the new table header.
setTableHeader
in class JTable
newHeader
- the new table headerpublic TableCellEditor getCellEditor(int row, int column)
getCellEditor
in class JTable
row
- the row index of the specified cellcolumn
- the column index of the specified cell
public TableCellRenderer getCellRenderer(int row, int column)
getCellRenderer
in class JTable
row
- the row index of the specified cellcolumn
- the column index of the specified cell
protected void configureEnclosingScrollPane()
MouseListener
from the table header.
configureEnclosingScrollPane
in class JTable
protected void addTableHeaderMouseListener()
MouseListener
to the table header.
protected void removeTableHeaderMouseListener()
MouseListener
from the table header.
protected MouseListener getTableHeaderMouseListener()
protected void setTableHeaderMouseListener(MouseListener l)
l
- the new table header mouse listenerprotected MouseAdapter createTableHeaderMouseListener()
public void sort(int column)
column
- the column to sort onpublic void unsort()
public void tableChanged(TableModelEvent e)
tableChanged
in interface TableModelListener
tableChanged
in class JTable
e
- the event that caused the table to changepublic void createDefaultColumnsFromModel()
createDefaultColumnsFromModel
in class JTable
JTable.createDefaultColumnsFromModel()
protected boolean checkColumnModel(TableColumnModel cm)
JCSortableTable
.
cm
- the column model
JCSortableTable
public void setColumnModel(TableColumnModel columnModel)
JTable
method is overridden to check and see if the passed
in column model is compatible with JCSortableTable
.
setColumnModel
in class JTable
columnModel
- the new column modelpublic TableColumn createSortableTableColumn(int column)
TableColumn
for use in
JCSorttableTable
. Override it in subclasses to easily change
which type of Column is created by default.
column
- the column for which the TableColumn
is to be
created
TableColumn
protected void clearSortIcons()
protected void setSortIcon(int column)
column
- the column on which the sort icon is to be setprotected void setSortIcon(Component renderer, Icon sortIcon)
JLabel
s or JButton
s that are found.
renderer
- the renderer on which the sortIcon
is to be setsortIcon
- the new sortIcon
to be used for the rendererprotected void setSortIcon(int column, int order)
column
- the column on which the sort icon is to be setorder
- Determines whether the up or down icon is to be used. Possible
values are JCRowSortModel.FORWARD
and
JCRowSortModel.REVERSE
. Any other values causes no icon to
be used.protected static void setComponentOrientation(Component c, ComponentOrientation o, boolean force)
c
- The component whose orientation may be set.o
- The new orientationforce
- If true, force an orientation change, even if it has been
explicitly set before.public void setComponentOrientation(ComponentOrientation o)
Note: Due to problems with column ordering in JTable, JCSortableTable and JCTreeTable will not behave properly for a right to left orientation for JDKs prior to 1.4.0.
setComponentOrientation
in class Component
o
- The new component orientation.protected void reLayoutColumnRenderers()
|
Copyright © 2004 Quest Software Inc.. All rights reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |