|
||||||||||
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
public class JXTable
A JXTable is a JTable with built-in support for row sorting, filtering, and
highlighting, column visibility and a special popup control on the column
header for quick access to table configuration. You can instantiate a JXTable
just as you would a JTable, using a TableModel. However, a JXTable
automatically wraps TableColumns inside a TableColumnExt instance.
TableColumnExt supports visibility, sortability, and prototype values for
column sizing, none of which are available in TableColumn. You can retrieve
the TableColumnExt instance for a column using getColumnExt(Object)
or getColumnExt(int colnumber)
.
A JXTable is, by default, sortable by clicking on column headers; each
subsequent click on a header reverses the order of the sort, and a sort arrow
icon is automatically drawn on the header. Sorting can be disabled using
setSortable(boolean)
. Sorting on columns is handled by a Sorter
instance which contains a Comparator used to compare values in two rows of a
column. You can replace the Comparator for a given column by using
getColumnExt("column").getSorter().setComparator(customComparator)
Columns can be hidden or shown by setting the visible property on the
TableColumnExt using TableColumnExt.setVisible(boolean)
. Columns can
also be shown or hidden from the column control popup.
The column control popup is triggered by an icon drawn to the far right of
the column headers, above the table's scrollbar (when installed in a
JScrollPane). The popup allows the user to select which columns should be
shown or hidden, as well as to pack columns and turn on horizontal scrolling.
To show or hide the column control, use the
setColumnControlVisible(boolean show)
method.
Rows can be filtered from a JXTable using a Filter class and a
FilterPipeline. One assigns a FilterPipeline to the table using
setFilters(FilterPipeline)
. Filtering hides, but does not delete or
permanently remove rows from a JXTable. Filters are used to provide sorting
to the table--rows are not removed, but the table is made to believe rows in
the model are in a sorted order.
One can automatically highlight certain rows in a JXTable by attaching
Highlighters in the setHighlighters(HighlighterPipeline)
method. An
example would be a Highlighter that colors alternate rows in the table for
readability; AlternateRowHighlighter does this. Again, like Filters,
Highlighters can be chained together in a HighlighterPipeline to achieve more
interesting effects.
You can resize all columns, selected columns, or a single column using the
methods like packAll()
. Packing combines several other aspects of a
JXTable. If horizontal scrolling is enabled using
setHorizontalScrollEnabled(boolean)
, then the scrollpane will allow
the table to scroll right-left, and columns will be sized to their preferred
size. To control the preferred sizing of a column, you can provide a
prototype value for the column in the TableColumnExt using
TableColumnExt.setPrototypeValue(Object)
. The prototype is used as
an indicator of the preferred size of the column. This can be useful if some
data in a given column is very long, but where the resize algorithm would
normally not pick this up.
Last, you can also provide searches on a JXTable using the Searchable property.
Keys/Actions registered with this component:
JXTable#HORIZONTAL_ACTION_COMMAND
- toggle the horizontal scrollbar
PACKSELECTED_ACTION_COMMAND
- resize the selected column to fit the widest
cell content
PACKALL_ACTION_COMMAND
- resize all columns to fit the widest
cell content in each column
Key bindings.
Client Properties.
MATCH_HIGHLIGHTER
- set to Boolean.TRUE to
use a SearchHighlighter to mark a cell as matching.
Nested Class Summary | |
---|---|
static class |
JXTable.BooleanRenderer
|
static class |
JXTable.DateRenderer
|
static class |
JXTable.DoubleRenderer
|
static class |
JXTable.IconRenderer
|
static class |
JXTable.LinkController
listens to rollover properties. |
static class |
JXTable.NumberRenderer
|
protected static class |
JXTable.TableAdapter
|
class |
JXTable.TableSearchable
|
Nested classes/interfaces inherited from class javax.swing.JTable |
---|
javax.swing.JTable.AccessibleJTable, javax.swing.JTable.PrintMode |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected ComponentAdapter |
dataAdapter
The ComponentAdapter for model data access. |
static java.lang.String |
EXECUTE_BUTTON_ACTIONCOMMAND
|
protected FilterPipeline |
filters
The FilterPipeline for the table. |
protected HighlighterPipeline |
highlighters
The HighlighterPipeline for the table. |
static java.lang.String |
HORIZONTALSCROLL_ACTION_COMMAND
Constant string for horizontal scroll actions, used in JXTable's Action Map. |
protected boolean |
isXTableRowHeightSet
temporary hack: rowheight will be internally adjusted to font size on instantiation and in updateUI if the height has not been set explicitly by the application. |
static java.lang.String |
MATCH_HIGHLIGHTER
key for client property to use SearchHighlighter as match marker. |
static java.lang.String |
PACKALL_ACTION_COMMAND
Constant string for packing all columns, used in JXTable's Action Map. |
static java.lang.String |
PACKSELECTED_ACTION_COMMAND
Constant string for packing selected columns, used in JXTable's Action Map. |
protected Searchable |
searchable
|
static java.lang.String |
UIPREFIX
The prefix marker to find component related properties in the resourcebundle. |
Fields inherited from class javax.swing.JTable |
---|
AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS, autoCreateColumnsFromModel, autoResizeMode, cellEditor, cellSelectionEnabled, columnModel, dataModel, defaultEditorsByColumnClass, defaultRenderersByColumnClass, editingColumn, editingRow, editorComp, gridColor, preferredViewportSize, rowHeight, rowMargin, rowSelectionAllowed, selectionBackground, selectionForeground, selectionModel, showHorizontalLines, showVerticalLines, tableHeader |
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 | |
---|---|
JXTable()
Instantiates a JXTable with a default table model, no data. |
|
JXTable(int numRows,
int numColumns)
Instantiates a JXTable for a given number of columns and rows. |
|
JXTable(java.lang.Object[][] rowData,
java.lang.Object[] columnNames)
Instantiates a JXTable with data in a array or rows and column names. |
|
JXTable(javax.swing.table.TableModel dm)
Instantiates a JXTable with a specific table model. |
|
JXTable(javax.swing.table.TableModel dm,
javax.swing.table.TableColumnModel cm)
Instantiates a JXTable with a specific table model. |
|
JXTable(javax.swing.table.TableModel dm,
javax.swing.table.TableColumnModel cm,
javax.swing.ListSelectionModel sm)
Instantiates a JXTable with a specific table model, column model, and selection model. |
|
JXTable(java.util.Vector rowData,
java.util.Vector columnNames)
Instantiates a JXTable with data in a vector or rows and column names. |
Method Summary | |
---|---|
void |
addHighlighter(Highlighter highlighter)
Adds a Highlighter. |
protected void |
adjustComponentOrientation(java.awt.Component stamp)
adjusts the Component's orientation to JXTable's CO if appropriate. |
protected void |
adminSetRowHeight(int rowHeight)
calling setRowHeight for internal reasons. |
void |
columnRemoved(javax.swing.event.TableColumnModelEvent e)
|
void |
columnSelectionChanged(javax.swing.event.ListSelectionEvent e)
Notifies the table that a new column has been selected. |
protected void |
configureEnclosingScrollPane()
overridden to addionally configure the upper right corner of an enclosing scrollpane with the ColumnControl. |
protected void |
configureViewportBackground()
set's the viewports background to this.background. |
int |
convertRowIndexToModel(int row)
Convert row index from view coordinates to model coordinates accounting for the presence of sorters and filters. |
int |
convertRowIndexToView(int row)
Convert row index from model coordinates to view coordinates accounting for the presence of sorters and filters. |
protected javax.swing.table.TableColumn |
createAndConfigureColumn(javax.swing.table.TableModel model,
int modelColumn)
|
protected javax.swing.table.TableColumnModel |
createDefaultColumnModel()
? |
void |
createDefaultColumnsFromModel()
|
protected void |
createDefaultEditors()
? |
protected void |
createDefaultRenderers()
Creates default cell renderers for objects, numbers, doubles, dates, booleans, icons, and links. |
protected javax.swing.table.JTableHeader |
createDefaultTableHeader()
? |
protected JXTable.LinkController |
createLinkController()
|
protected PipelineListener |
createPipelineListener()
creates the listener for changes in filters. |
protected RolloverProducer |
createRolloverProducer()
creates and returns the RolloverProducer to use. |
javax.swing.JComponent |
getColumnControl()
returns the component for column control. |
int |
getColumnCount(boolean includeHidden)
returns the number of TableColumns including hidden if the parameter is set to true. |
TableColumnExt |
getColumnExt(int viewColumnIndex)
Returns the TableColumnExt object for the column in the
table whose column index is equal to viewColumnIndex |
TableColumnExt |
getColumnExt(java.lang.Object identifier)
Returns the TableColumnExt object for the column in the
table whose identifier is equal to identifier , when
compared using equals . |
protected ColumnFactory |
getColumnFactory()
|
int |
getColumnMargin()
Returns the margin between columns. |
java.util.List |
getColumns()
returns a list of all visible TableColumns. |
java.util.List |
getColumns(boolean includeHidden)
returns a list of TableColumns including hidden if the parameter is set to true. |
protected ComponentAdapter |
getComponentAdapter()
|
protected PipelineListener |
getFilterPipelineListener()
returns the listener for changes in filters. |
FilterPipeline |
getFilters()
Returns the FilterPipeline for the table. |
HighlighterPipeline |
getHighlighters()
Returns the HighlighterPipeline assigned to the table, null if none. |
protected JXTable.LinkController |
getLinkController()
|
javax.swing.table.TableCellRenderer |
getNewDefaultRenderer(java.lang.Class columnClass)
Returns a new instance of the default renderer for the specified class. |
java.awt.Dimension |
getPreferredScrollableViewportSize()
|
int |
getRowCount()
Returns the row count in the table; if filters are applied, this is the filtered row count. |
protected SizeSequenceMapper |
getRowModelMapper()
|
Searchable |
getSearchable()
|
protected SelectionMapper |
getSelectionMapper()
temporaryly exposed for testing... |
int |
getSelectionMode()
Returns the selection mode used by this table's selection model. |
Sorter |
getSorter(int columnIndex)
Returns the interactive sorter if it is set from the given column. |
java.lang.Object |
getValueAt(int row,
int column)
|
int |
getVisibleRowCount()
? |
protected void |
init()
Initializes the table for use. |
protected void |
initializeColumnPreferredWidth(javax.swing.table.TableColumn column)
Initialize the preferredWidth of the specified column based on the column's prototypeValue property. |
boolean |
isCellEditable(int row,
int column)
Overridden to account for row index mapping and to respect TableColumnExt.isEditable() property. |
boolean |
isColumnControlVisible()
returns visibility flag of column control. |
boolean |
isHierarchical(int column)
|
boolean |
isRolloverEnabled()
Returns the rolloverEnabled property. |
boolean |
isRowHeightEnabled()
|
boolean |
isSortable()
Returns true if the table is sortable. |
void |
packAll()
This resizes all columns to fit the viewport; if horizontal scrolling is enabled, all columns will get their preferred width. |
void |
packColumn(int column,
int margin)
Packs an indivudal column in the table. |
void |
packColumn(int column,
int margin,
int max)
Packs an indivual column in the table to less than or equal to the maximum witdth. |
void |
packSelected()
This resizes selected columns to fit the viewport; if horizontal scrolling is enabled, selected columns will get their preferred width. |
void |
packTable(int margin)
Packs all the columns to their optimal size. |
java.awt.Component |
prepareEditor(javax.swing.table.TableCellEditor editor,
int row,
int column)
Overridden to adjust the editor's component orientation if appropriate. |
java.awt.Component |
prepareRenderer(javax.swing.table.TableCellRenderer renderer,
int row,
int column)
Returns the decorated Component used as a stamp to render
the specified cell. |
protected void |
removeColumns()
Remove all columns, make sure to include hidden. |
void |
removeHighlighter(Highlighter highlighter)
Removes the Highlighter. |
protected void |
resetSorter()
Removes the interactive sorter. |
int |
rowAtPoint(java.awt.Point point)
workaround bug in JTable. |
void |
setAutoResizeMode(int mode)
overridden to update the show horizontal scrollbar action's selected state. |
void |
setColumnControlVisible(boolean showColumnControl)
bound property to flag visibility state of column control. |
void |
setColumnMargin(int value)
Sets the margin between columns. |
void |
setColumnSequence(java.lang.Object[] identifiers)
reorders the columns in the sequence given array. |
void |
setComponentOrientation(java.awt.ComponentOrientation o)
Hack around core swing JScrollPane bug: can't cope with corners when changing component orientation at runtime. |
void |
setDefaultLinkVisitor(java.awt.event.ActionListener linkVisitor)
If the default editor for LinkModel.class is of type LinkRenderer enables link visiting with the given linkVisitor. |
void |
setFilters(FilterPipeline pipeline)
Sets the FilterPipeline for filtering table rows. |
void |
setHighlighters(HighlighterPipeline pipeline)
Assigns a HighlighterPipeline to the table. |
void |
setHorizontalScrollEnabled(boolean enabled)
Controls horizontal scrolling in the viewport, and works in coordination with column sizing. |
void |
setModel(javax.swing.table.TableModel newModel)
|
void |
setRolloverEnabled(boolean rolloverEnabled)
Property to enable/disable rollover support. |
void |
setRowHeight(int rowHeight)
Changes the row height for all rows in the table. |
void |
setRowHeight(int row,
int rowHeight)
|
void |
setRowHeightEnabled(boolean enabled)
sets enabled state of individual rowHeight support. |
void |
setSearchable(Searchable searchable)
sets the Searchable for this editor. |
void |
setSelectionModel(javax.swing.ListSelectionModel newModel)
Overridden to update selectionMapper |
void |
setSortable(boolean sortable)
Sets "sortable" property indicating whether or not this table supports sortable columns. |
protected void |
setSorter(int columnIndex)
request to sort the column at columnIndex in view coordinates. |
void |
setValueAt(java.lang.Object aValue,
int row,
int column)
|
void |
setVisibleRowCount(int visibleRowCount)
? |
void |
tableChanged(javax.swing.event.TableModelEvent e)
additionally updates filtered state. |
protected void |
updateHighlighters()
|
protected void |
updateOnFilterContentChanged()
method called on change notification from filterpipeline. |
void |
updateUI()
bug fix: super doesn't update all renderers/editors. |
protected void |
updateViewSizeSequence()
Called if individual row height mapping need to be updated. |
Methods inherited from class javax.swing.JTable |
---|
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, convertColumnIndexToModel, convertColumnIndexToView, createDefaultDataModel, createDefaultSelectionModel, createScrollPaneForTable, doLayout, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoResizeMode, getCellEditor, getCellEditor, getCellRect, getCellRenderer, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getEditingColumn, getEditingRow, getEditorComponent, getGridColor, getIntercellSpacing, getModel, getPrintable, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, initializeLocalVars, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, print, print, print, print, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, selectAll, setAutoCreateColumnsFromModel, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setEditingColumn, setEditingRow, setGridColor, setIntercellSpacing, setPreferredScrollableViewportSize, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setSelectionBackground, setSelectionForeground, setSelectionMode, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, sizeColumnsToFit, sizeColumnsToFit, unconfigureEnclosingScrollPane, valueChanged |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String EXECUTE_BUTTON_ACTIONCOMMAND
public static final java.lang.String HORIZONTALSCROLL_ACTION_COMMAND
public static final java.lang.String PACKALL_ACTION_COMMAND
public static final java.lang.String PACKSELECTED_ACTION_COMMAND
public static final java.lang.String UIPREFIX
public static final java.lang.String MATCH_HIGHLIGHTER
protected FilterPipeline filters
protected HighlighterPipeline highlighters
protected ComponentAdapter dataAdapter
protected boolean isXTableRowHeightSet
protected Searchable searchable
Constructor Detail |
---|
public JXTable()
public JXTable(javax.swing.table.TableModel dm)
dm
- The model to use.public JXTable(javax.swing.table.TableModel dm, javax.swing.table.TableColumnModel cm)
dm
- The model to use.public JXTable(javax.swing.table.TableModel dm, javax.swing.table.TableColumnModel cm, javax.swing.ListSelectionModel sm)
dm
- The table model to use.cm
- The colomn model to use.sm
- The list selection model to use.public JXTable(int numRows, int numColumns)
numRows
- Count of rows to accomodate.numColumns
- Count of columns to accomodate.public JXTable(java.util.Vector rowData, java.util.Vector columnNames)
rowData
- Row data, as a Vector of Objects.columnNames
- Column names, as a Vector of Strings.public JXTable(java.lang.Object[][] rowData, java.lang.Object[] columnNames)
rowData
- Row data, as a two-dimensional Array of Objects (by row, for
column).columnNames
- Column names, as a Array of Strings.Method Detail |
---|
protected void init()
public void setRolloverEnabled(boolean rolloverEnabled)
rolloverEnabled
- protected JXTable.LinkController getLinkController()
protected JXTable.LinkController createLinkController()
protected RolloverProducer createRolloverProducer()
public boolean isRolloverEnabled()
true
if rollover is enabledpublic void setDefaultLinkVisitor(java.awt.event.ActionListener linkVisitor)
linkVisitor
- protected void configureEnclosingScrollPane()
configureEnclosingScrollPane
in class javax.swing.JTable
protected void configureViewportBackground()
PENDING: need to repeat on background changes to this!
public void setComponentOrientation(java.awt.ComponentOrientation o)
setComponentOrientation
in class java.awt.Component
public boolean isColumnControlVisible()
Note: if the table is not inside a JScrollPane the column control is not shown even if this returns true. In this case it's the responsibility of the client code to actually show it.
public javax.swing.JComponent getColumnControl()
public void setColumnControlVisible(boolean showColumnControl)
showColumnControl
- public void packAll()
public void packSelected()
public void setHorizontalScrollEnabled(boolean enabled)
enabled
- If true, the scrollpane will allow the table to scroll
horizontally, and columns will resize to their preferred
width. If false, columns will resize to fit the viewport.public void columnSelectionChanged(javax.swing.event.ListSelectionEvent e)
columnSelectionChanged
in interface javax.swing.event.TableColumnModelListener
columnSelectionChanged
in class javax.swing.JTable
public void setAutoResizeMode(int mode)
setAutoResizeMode
in class javax.swing.JTable
public int getRowCount()
getRowCount
in class javax.swing.JTable
public boolean isHierarchical(int column)
public int convertRowIndexToModel(int row)
row
- row index in view coordinates
public int convertRowIndexToView(int row)
row
- row index in model coordinates
public java.lang.Object getValueAt(int row, int column)
getValueAt
in class javax.swing.JTable
public void setValueAt(java.lang.Object aValue, int row, int column)
setValueAt
in class javax.swing.JTable
public boolean isCellEditable(int row, int column)
TableColumnExt.isEditable()
property.
isCellEditable
in class javax.swing.JTable
public void setSelectionModel(javax.swing.ListSelectionModel newModel)
setSelectionModel
in class javax.swing.JTable
public void setModel(javax.swing.table.TableModel newModel)
setModel
in class javax.swing.JTable
public void tableChanged(javax.swing.event.TableModelEvent e)
tableChanged
in interface javax.swing.event.TableModelListener
tableChanged
in class javax.swing.JTable
protected void updateViewSizeSequence()
protected SelectionMapper getSelectionMapper()
public FilterPipeline getFilters()
public void setFilters(FilterPipeline pipeline)
protected PipelineListener getFilterPipelineListener()
protected PipelineListener createPipelineListener()
protected void updateOnFilterContentChanged()
public void setSortable(boolean sortable)
sortable
is
true
then sorting will be enabled on all columns whose
sortable
property is true
. If
sortable
is false
then sorting will be
disabled for all columns, regardless of each column's individual
sorting
property. The default is true
.
sortable
- boolean indicating whether or not this table supports sortable
columnsTableColumnExt.isSortable()
public boolean isSortable()
protected void resetSorter()
public void columnRemoved(javax.swing.event.TableColumnModelEvent e)
columnRemoved
in interface javax.swing.event.TableColumnModelListener
columnRemoved
in class javax.swing.JTable
protected void setSorter(int columnIndex)
public Sorter getSorter(int columnIndex)
columnIndex
- the column index in view coordinates.
protected void removeColumns()
public java.util.List getColumns()
public java.util.List getColumns(boolean includeHidden)
includeHidden
-
public int getColumnCount(boolean includeHidden)
includeHidden
-
public void setColumnSequence(java.lang.Object[] identifiers)
columnNames
- array of logical column namespublic TableColumnExt getColumnExt(java.lang.Object identifier)
TableColumnExt
object for the column in the
table whose identifier is equal to identifier
, when
compared using equals
. The returned TableColumn is
guaranteed to be part of the current ColumnModel but may be hidden, that
is
TableColumnExt column = table.getColumnExt(id);
if (column != null) {
int viewIndex = table.convertColumnIndexToView(column.getModelIndex());
assertEquals(column.isVisible(), viewIndex >= 0);
}
identifier
- the identifier object
TableColumnExt
object that matches the
identifier or null if none is found.public TableColumnExt getColumnExt(int viewColumnIndex)
TableColumnExt
object for the column in the
table whose column index is equal to viewColumnIndex
viewColumnIndex
- index of the column with the object in question
TableColumnExt
object that matches the column
index
java.lang.IllegalArgumentException
- if no TableColumn
has this identifierpublic void createDefaultColumnsFromModel()
createDefaultColumnsFromModel
in class javax.swing.JTable
protected javax.swing.table.TableColumn createAndConfigureColumn(javax.swing.table.TableModel model, int modelColumn)
protected ColumnFactory getColumnFactory()
public int getColumnMargin()
public void setColumnMargin(int value)
value
- margin between columns; must be greater than or equal to zero.public int getSelectionMode()
public Searchable getSearchable()
public void setSearchable(Searchable searchable)
searchable
- public void setVisibleRowCount(int visibleRowCount)
public int getVisibleRowCount()
public java.awt.Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize
in interface javax.swing.Scrollable
getPreferredScrollableViewportSize
in class javax.swing.JTable
public void packTable(int margin)
margin
- the margin to apply to each column.public void packColumn(int column, int margin)
column
- The Column index to pack in View Coordinatesmargin
- The Margin to apply to the column width.public void packColumn(int column, int margin, int max)
column
- The Column index to pack in View Coordinatesmargin
- The margin to apply to the columnmax
- The maximum width the column can be resized to. -1 mean any
size.protected void initializeColumnPreferredWidth(javax.swing.table.TableColumn column)
TableColumnExt
or prototypeValue is null
then the preferredWidth is left unmodified.
column
- TableColumn object representing view columnTableColumnExt.setPrototypeValue(java.lang.Object)
protected ComponentAdapter getComponentAdapter()
public HighlighterPipeline getHighlighters()
public void setHighlighters(HighlighterPipeline pipeline)
public void addHighlighter(Highlighter highlighter)
highlighter
- the Highlighter to add - must not be null.
java.lang.NullPointerException
- if highlighter is null.public void removeHighlighter(Highlighter highlighter)
highlighter
- the highlighter to remove.public java.awt.Component prepareRenderer(javax.swing.table.TableCellRenderer renderer, int row, int column)
Component
used as a stamp to render
the specified cell. Overrides superclass version to provide support for
cell decorators.
Adjusts component orientation (guaranteed to happen before applying
Highlighters).
see - https://swingx.dev.java.net/issues/show_bug.cgi?id=145
prepareRenderer
in class javax.swing.JTable
renderer
- the TableCellRenderer
to preparerow
- the row of the cell to render, where 0 is the first rowcolumn
- the column of the cell to render, where 0 is the first column
Component
used as a stamp to render
the specified cellHighlighter
public java.awt.Component prepareEditor(javax.swing.table.TableCellEditor editor, int row, int column)
prepareEditor
in class javax.swing.JTable
protected void adjustComponentOrientation(java.awt.Component stamp)
stamp
- public javax.swing.table.TableCellRenderer getNewDefaultRenderer(java.lang.Class columnClass)
getDefaultRenderer()
in that it returns
a new instance each time so that the renderer may be set and
customized on a particular column.
PENDING: must not return null!
columnClass
- Class of value being rendered
protected void createDefaultEditors()
createDefaultEditors
in class javax.swing.JTable
protected void createDefaultRenderers()
createDefaultRenderers
in class javax.swing.JTable
public void updateUI()
updateUI
in class javax.swing.JTable
protected void updateHighlighters()
public void setRowHeight(int rowHeight)
setRowHeight
in class javax.swing.JTable
public void setRowHeight(int row, int rowHeight)
setRowHeight
in class javax.swing.JTable
public void setRowHeightEnabled(boolean enabled)
enabled
- public boolean isRowHeightEnabled()
protected SizeSequenceMapper getRowModelMapper()
protected void adminSetRowHeight(int rowHeight)
public int rowAtPoint(java.awt.Point point)
rowAtPoint
in class javax.swing.JTable
protected javax.swing.table.JTableHeader createDefaultTableHeader()
createDefaultTableHeader
in class javax.swing.JTable
protected javax.swing.table.TableColumnModel createDefaultColumnModel()
createDefaultColumnModel
in class javax.swing.JTable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |