|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTable
org.jdesktop.swingx.JXTable
org.tbee.swing.table.JTable
public class JTable
This is an extended JTable that provides a.o. alternating row colors and a focus handling patch. This table is based upon JXTable, if the provided TableModel is not a TableSorter, the JXTable autosorting is activated. TBEE 2007-02-09: JTableAutoSizer may resize columns, if it does, for some reason the following editCellAt is not done correctly. Even though the JTable itself firmly believes it is editing. Repeating the edit cell instruction works around this problem. http://forum.java.sun.com/thread.jspa?threadID=5134899
| Nested Class Summary | |
|---|---|
protected static class |
JTable.OnFocusStopEditHandler
|
| Nested classes/interfaces inherited from class org.jdesktop.swingx.JXTable |
|---|
org.jdesktop.swingx.JXTable.BooleanEditor, org.jdesktop.swingx.JXTable.GenericEditor, org.jdesktop.swingx.JXTable.NumberEditor, org.jdesktop.swingx.JXTable.TableAdapter |
| Nested classes/interfaces inherited from class javax.swing.JTable |
|---|
JTable.AccessibleJTable, JTable.DropLocation, JTable.PrintMode |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected JTable.OnFocusStopEditHandler |
iFocusLostHandler
|
protected JTableColumnResizer |
iJTableColumnResizer
|
protected JTableRowResizer |
iJTableRowResizer
|
static String |
SORTERCHANGED_PROPERTYID
|
static String |
SOURCECODE_VERSION
Standard variable for determining version of a class file. |
| Fields inherited from class org.jdesktop.swingx.JXTable |
|---|
compoundHighlighter, dataAdapter, editorRemover, FOCUS_NEXT_COMPONENT, FOCUS_PREVIOUS_COMPONENT, HORIZONTALSCROLL_ACTION_COMMAND, isXTableRowHeightSet, MATCH_HIGHLIGHTER, PACKALL_ACTION_COMMAND, PACKSELECTED_ACTION_COMMAND, resetDefaultTableCellRendererHighlighter, searchable, UIPREFIX, USE_DTCR_COLORMEMORY_HACK |
| 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 | |
|---|---|
JTable()
|
|
JTable(int numRows,
int numColumns)
|
|
JTable(Object[][] rowData,
Object[] columnNames)
|
|
JTable(TableModel data)
|
|
JTable(TableModel data,
TableColumnModel columns)
|
|
JTable(TableModel dm,
TableColumnModel cm,
ListSelectionModel sm)
|
|
JTable(Vector rowData,
Vector columnNames)
|
|
| Method Summary | |
|---|---|
void |
cancelEdit()
Cancel the edit |
void |
changeSelection(int row,
int column,
boolean toggle,
boolean extend)
Prevent resizing of the columns to change the selection |
void |
changeSelectionForced(int row,
int column,
boolean toggle,
boolean extend)
Prevent resizing of the columns to change the selection |
void |
columnAdded(TableColumnModelEvent e)
Tells listeners that a column was added to the model. |
void |
columnMarginChanged(ChangeEvent e)
For monitoring preference related changes with auto save |
void |
columnMoved(TableColumnModelEvent e)
a column move must abort the edit |
void |
columnRemoved(TableColumnModelEvent e)
Tells listeners that a column was removed from the model. |
Color |
getAlternateRowColor()
|
boolean |
getAlternatingRowColor()
|
boolean |
getAutoSavePreferences()
|
TableCellEditor |
getCellEditor(int row,
int column)
allow for per cell editors (this does not take sorting into account) |
TableCellRenderer |
getCellRenderer(int row,
int column)
allow for per cell renderer (this does not take sorting into account) |
TableCellEditor |
getColumnEditor(int column)
|
TableCellRenderer |
getColumnRenderer(int column)
|
boolean |
getColumnsAreResizable()
turn resizing on/of |
boolean |
getDisabledTableShowsCellsAsDisabled()
DisabledTableShowsCellsAsDisabled |
String |
getNameForPreferences()
|
boolean |
getResizableRowsAreAllSameHeight()
|
boolean |
getRowHeightAutomatical()
allow rows to size to a single size value |
boolean |
getRowHeightIndividualAutomatical()
allow individual rows to size |
boolean |
getRowsAreResizable()
turn resizing on/of |
Color |
getSecondAlternateRowColor()
|
boolean |
getShowValueExceptionsInDialog()
|
boolean |
getSwallowSetValueExceptions()
|
TableModel |
getTableModel()
wrapped to cast the model to TBEE's model |
String |
getToolipAt(int row,
int column)
Show get value exceptions |
boolean |
getUneditableCellsShowAsDisabled()
UneditableCellsShowAsDisabled |
boolean |
getUneditableTableShowsCellsAsDisabled()
UneditableTableShowsCellsAsDisabled |
Object |
getValueAt(int row,
int column)
Show get value exceptions |
String |
getValueAtAsString(int row,
int col)
Convert cell values to string (needed by JTableMultipleCellsCopyAdapter). |
protected boolean |
isGetValueAtForEditor()
is the current getValueAt for an editor or a renderer |
boolean |
isPrinting()
is the table currently being printed? |
Component |
prepareEditor(TableCellEditor editor,
int row,
int column)
auto set row height |
Component |
prepareRenderer(TableCellRenderer renderer,
int row,
int col)
Set the background of the component |
void |
print(Graphics g)
Remember if we are being printed |
void |
printBindings()
|
void |
repaintTableHeader()
Force a repaint on the column headers |
protected void |
resetDefaultTableCellRendererColors(Component renderer,
int row,
int column)
Method to apply a hack around DefaultTableCellRenderer "color memory" (Issue #258-swingx). |
void |
restoreAutoSavePreferences()
restore the "autosave" setting itself |
void |
restoreColumnOrderPreferences()
|
void |
restoreColumnVisiblePreferences()
|
void |
restoreColumnWidthPreferences()
|
void |
restorePreferences()
restore all preferences |
void |
saveAutoSavePreferences()
remember the "autosave" setting itself |
void |
saveColumnOrderPreferences()
|
void |
saveColumnVisiblePreferences()
|
void |
saveColumnWidthPreferences()
|
void |
savePreferences()
save all preferences |
void |
setAlternateRowColor(Color value)
the color to use for the alternating background color for rows |
void |
setAlternatingRowColor(boolean value)
alternate the background color for rows |
void |
setAutoResizeMode(int v)
For monitoring preference related changes with auto save |
void |
setAutoSavePreferences(boolean value)
AutoSavePreferences |
void |
setCellEditor(int row,
int column,
TableCellEditor tableCellEditor)
|
void |
setCellRenderer(int row,
int column,
TableCellRenderer tableCellRenderer)
|
void |
setColumnEditor(int column,
TableCellEditor cellEditor)
set a editor for a whole column |
void |
setColumnRenderer(int column,
TableCellRenderer renderer)
set a renderer for a whole column |
void |
setColumnsAreResizable(boolean value)
|
void |
setDisabledTableShowsCellsAsDisabled(boolean value)
|
void |
setEditable(boolean editable)
must repaint because cells may be shown disabled |
void |
setEnabled(boolean editable)
must repaint because cells may be shown disabled |
void |
setModel(TableModel m)
Determine if we use inner sorting or by JXTable |
void |
setName(String value)
Upon setting the name, any preferences are restored |
void |
setNameForPreferences(String value)
NameForPreferences; name is also used for other things, like the SwingEventDispatcher |
void |
setResizableRowsAreAllSameHeight(boolean value)
|
void |
setRowHeight(int row,
int height)
PCE changes to row heights |
void |
setRowHeightAutomatical(boolean value)
|
void |
setRowHeightIndividualAutomatical(boolean value)
|
void |
setRowsAreResizable(boolean value)
|
void |
setRowSorter(RowSorter<? extends TableModel> sorter)
install a table header renderer that shows multiple sort icons when using JDK6 sorting |
void |
setSecondAlternateRowColor(Color value)
the second color to use for the alternating background color for rows |
void |
setShowValueExceptionsInDialog(boolean value)
if an exception occurs during getValue or setValue, show a dialog |
void |
setSwallowSetValueExceptions(boolean value)
if an exception occurs during getValue or setValue, log it and then make it go away |
void |
setUneditableCellsShowAsDisabled(boolean value)
|
void |
setUneditableTableShowsCellsAsDisabled(boolean value)
|
void |
setValueAt(Object aValue,
int row,
int column)
Show set value exceptions |
void |
setValueAtAsString(String value,
int row,
int col)
Convert cell values to string (needed by JTableMultipleCellsCopyAdapter). |
void |
sorterChanged(RowSorterEvent e)
If the sorter is changed, our view changed, so we need to inform our listeners: mimick a PCE (The event is fired by the TableRowSorter class; we could expect our listeners to subscribe to that, but I feel this also is a JTable behavior.) |
void |
stopEdit()
Stop the edit by either accepting or cancelling |
void |
tableChanged(TableModelEvent e)
Cancel edits if the model changed |
JTable |
withDisabledTableShowsCellsAsDisabled(boolean value)
|
JTable |
withNameForPreferences(String value)
|
JTable |
withUneditableCellsShowAsDisabled(boolean value)
|
JTable |
withUneditableTableShowsCellsAsDisabled(boolean value)
|
| Methods inherited from class org.jdesktop.swingx.JXTable |
|---|
addHighlighter, adjustComponentOrientation, adminSetRowHeight, columnPropertyChange, columnSelectionChanged, configureColumnControl, configureEnclosingScrollPane, configureSorterProperties, createDefaultColumnControl, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultEditors, createDefaultRenderers, createDefaultRowSorter, createDefaultStringValueRegistry, createDefaultTableHeader, createHighlighterChangeListener, createLinkController, createRolloverProducer, doFind, doLayout, editCellAt, getAutoCreateColumnsFromModel, getAutoCreateRowSorter, getColumn, getColumnControl, getColumnCount, getColumnExt, getColumnExt, getColumnFactory, getColumnMargin, getColumns, getColumns, getComponentAdapter, getComponentAdapter, getCompoundHighlighter, getControlsSorterProperties, getHighlighterChangeListener, getHighlighters, getLinkController, getNewDefaultRenderer, getPreferredScrollableViewportSize, getRowFilter, getScrollableTracksViewportWidth, getSearchable, getSelectionMode, getSortController, getSortedColumn, getSortOrder, getSortOrder, getSortOrderCycle, getSortsOnUpdates, getStringAt, getStringValueRegistry, getUIString, getUIString, getVisibleColumnCount, getVisibleRowCount, hasSortController, initializeColumnPreferredWidth, initializeColumnWidths, isAutoStartEditOnKeyStroke, isCellEditable, isColumnControlVisible, isDataChanged, isEditable, isFocusCycleRoot, isHorizontalScrollEnabled, isRolloverEnabled, isRowHeightEnabled, isSortable, isSortable, isSortable, isStructureChanged, isTerminateEditOnFocusLost, isUpdate, packAll, packColumn, packColumn, packSelected, packTable, removeEditor, removeHighlighter, removeNotify, resetSortOrder, rowAtPoint, scrollCellToVisible, scrollColumnToVisible, scrollRowToVisible, setAutoCreateRowSorter, setAutoStartEditOnKeyStroke, setColumnControl, setColumnControlVisible, setColumnFactory, setColumnMargin, setColumnModel, setColumnSequence, setComponentOrientation, setDefaultRenderer, setFillsViewportHeight, setGridColor, setHighlighters, setHorizontalScrollEnabled, setLocale, setPreferredScrollableViewportSize, setRolloverEnabled, setRowFilter, setRowHeight, setRowHeightEnabled, setSearchable, setSelectionBackground, setSelectionForeground, setShowGrid, setShowGrid, setSortable, setSortOrder, setSortOrder, setSortOrderCycle, setSortsOnUpdates, setTerminateEditOnFocusLost, setVisibleColumnCount, setVisibleRowCount, toggleSortOrder, toggleSortOrder, transferFocus, transferFocusBackward, unconfigureColumnControl, unconfigureEnclosingScrollPane, updateColumnControlUI, updateColumnUI, updateHighlighterUI, updateHorizontalAction, updateLocaleActionState, updateLocaleState, updateRowHeightUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String SOURCECODE_VERSION
protected JTableColumnResizer iJTableColumnResizer
protected JTableRowResizer iJTableRowResizer
public static final String SORTERCHANGED_PROPERTYID
protected JTable.OnFocusStopEditHandler iFocusLostHandler
| Constructor Detail |
|---|
public JTable()
public JTable(TableModel data)
public JTable(TableModel data,
TableColumnModel columns)
public JTable(TableModel dm,
TableColumnModel cm,
ListSelectionModel sm)
public JTable(int numRows,
int numColumns)
public JTable(Vector rowData,
Vector columnNames)
public JTable(Object[][] rowData,
Object[] columnNames)
| Method Detail |
|---|
public TableModel getTableModel()
public void setShowValueExceptionsInDialog(boolean value)
public boolean getShowValueExceptionsInDialog()
public void setSwallowSetValueExceptions(boolean value)
public boolean getSwallowSetValueExceptions()
public void setAlternatingRowColor(boolean value)
public boolean getAlternatingRowColor()
public void setAlternateRowColor(Color value)
public Color getAlternateRowColor()
public void setSecondAlternateRowColor(Color value)
public Color getSecondAlternateRowColor()
public Component prepareRenderer(TableCellRenderer renderer,
int row,
int col)
prepareRenderer in class org.jdesktop.swingx.JXTablepublic boolean getUneditableCellsShowAsDisabled()
public void setUneditableCellsShowAsDisabled(boolean value)
public JTable withUneditableCellsShowAsDisabled(boolean value)
public boolean getDisabledTableShowsCellsAsDisabled()
public void setDisabledTableShowsCellsAsDisabled(boolean value)
public JTable withDisabledTableShowsCellsAsDisabled(boolean value)
public boolean getUneditableTableShowsCellsAsDisabled()
public void setUneditableTableShowsCellsAsDisabled(boolean value)
public JTable withUneditableTableShowsCellsAsDisabled(boolean value)
public void setEditable(boolean editable)
setEditable in class org.jdesktop.swingx.JXTablepublic void setEnabled(boolean editable)
setEnabled in class JComponent
public Component prepareEditor(TableCellEditor editor,
int row,
int column)
prepareEditor in class org.jdesktop.swingx.JXTableprotected boolean isGetValueAtForEditor()
public void columnMoved(TableColumnModelEvent e)
columnMoved in interface TableColumnModelListenercolumnMoved in class JTablepublic void columnAdded(TableColumnModelEvent e)
columnAdded in interface TableColumnModelListenercolumnAdded in class org.jdesktop.swingx.JXTablepublic void columnRemoved(TableColumnModelEvent e)
columnRemoved in interface TableColumnModelListenercolumnRemoved in class JTablepublic boolean getColumnsAreResizable()
public void setColumnsAreResizable(boolean value)
public boolean getResizableRowsAreAllSameHeight()
public void setResizableRowsAreAllSameHeight(boolean value)
public boolean getRowsAreResizable()
public void setRowsAreResizable(boolean value)
public void changeSelection(int row,
int column,
boolean toggle,
boolean extend)
changeSelection in class JTable
public void changeSelectionForced(int row,
int column,
boolean toggle,
boolean extend)
public void setRowHeight(int row,
int height)
setRowHeight in class JTablepublic boolean getRowHeightIndividualAutomatical()
public void setRowHeightIndividualAutomatical(boolean value)
public boolean getRowHeightAutomatical()
public void setRowHeightAutomatical(boolean value)
public void setColumnRenderer(int column,
TableCellRenderer renderer)
public TableCellRenderer getColumnRenderer(int column)
public void setColumnEditor(int column,
TableCellEditor cellEditor)
public TableCellEditor getColumnEditor(int column)
public TableCellRenderer getCellRenderer(int row,
int column)
getCellRenderer in class org.jdesktop.swingx.JXTable
public void setCellRenderer(int row,
int column,
TableCellRenderer tableCellRenderer)
public TableCellEditor getCellEditor(int row,
int column)
getCellEditor in class JTable
public void setCellEditor(int row,
int column,
TableCellEditor tableCellEditor)
public void setModel(TableModel m)
setModel in class org.jdesktop.swingx.JXTablepublic void print(Graphics g)
print in class JComponentpublic boolean isPrinting()
public String getValueAtAsString(int row,
int col)
public Object getValueAt(int row,
int column)
getValueAt in class JTable
public void setValueAt(Object aValue,
int row,
int column)
setValueAt in class org.jdesktop.swingx.JXTable
public void setValueAtAsString(String value,
int row,
int col)
public String getToolipAt(int row,
int column)
public void setNameForPreferences(String value)
public String getNameForPreferences()
public JTable withNameForPreferences(String value)
public void setAutoSavePreferences(boolean value)
public boolean getAutoSavePreferences()
public void savePreferences()
public void restorePreferences()
public void setName(String value)
setName in class Componentpublic void columnMarginChanged(ChangeEvent e)
columnMarginChanged in interface TableColumnModelListenercolumnMarginChanged in class org.jdesktop.swingx.JXTablepublic void setAutoResizeMode(int v)
setAutoResizeMode in class org.jdesktop.swingx.JXTablepublic void saveColumnWidthPreferences()
public void restoreColumnWidthPreferences()
public void saveColumnOrderPreferences()
public void restoreColumnOrderPreferences()
public void saveColumnVisiblePreferences()
public void restoreColumnVisiblePreferences()
public void saveAutoSavePreferences()
public void restoreAutoSavePreferences()
public void repaintTableHeader()
public void setRowSorter(RowSorter<? extends TableModel> sorter)
setRowSorter in class org.jdesktop.swingx.JXTablepublic void printBindings()
public void stopEdit()
public void cancelEdit()
public void tableChanged(TableModelEvent e)
tableChanged in interface TableModelListenertableChanged in class org.jdesktop.swingx.JXTablepublic void sorterChanged(RowSorterEvent e)
sorterChanged in interface RowSorterListenersorterChanged in class JTable
protected void resetDefaultTableCellRendererColors(Component renderer,
int row,
int column)
USE_DTCR_COLORMEMORY_HACK having the value of
Boolean.TRUE, does nothing otherwise. The property is
true by default.
The hack consists of applying a specialized Highlighter to
force reset the color "memory" of DefaultTableCellRenderer.
Note that the hack is applied always, that is even if there are no custom
Highlighters.
Client code which solves the problem at the core (that is in a
well-behaved DefaultTableCellRenderer) can disable the hack by removing
the client property or by subclassing and override this to do nothing.
resetDefaultTableCellRendererColors in class org.jdesktop.swingx.JXTablerenderer - the TableCellRenderer to hackrow - the row of the cell to rendercolumn - the column index of the cell to renderprepareRenderer(TableCellRenderer, int, int),
JXTable.USE_DTCR_COLORMEMORY_HACK,
org.jdesktop.swingx.decorator.ResetDTCRColorHighlighter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||