public class XJTable extends JTable
JTable.setAutoResizeMode(int)
.
Modifier and Type | Class and Description |
---|---|
protected class |
XJTable.ColumnData |
protected class |
XJTable.HeaderMouseListener |
protected class |
XJTable.SortingModel
Handles translations between an indexed data source and a permutation of
itself (like the translations between the rows in sorted table and the
rows in the actual unsorted model).
|
JTable.AccessibleJTable, JTable.DropLocation, JTable.PrintMode
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected boolean |
ascending
is the current sort order ascending (or descending)?
|
protected List<XJTable.ColumnData> |
columnData
A list of
XJTable.ColumnData objects. |
protected ObjectComparator |
defaultComparator |
protected XJTable.HeaderMouseListener |
headerMouseListener |
protected List<TableColumn> |
hiddenColumns
Contains the hidden columns in no particular order.
|
protected boolean |
sortable
Should this table be sortable.
|
protected int |
sortedColumn
The column currently being sorted.
|
protected XJTable.SortingModel |
sortingModel |
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
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
XJTable() |
XJTable(TableModel model) |
Modifier and Type | Method and Description |
---|---|
protected void |
calculatePreferredSize() |
void |
changeSelection(int rowIndex,
int columnIndex,
boolean toggle,
boolean extend) |
void |
columnMarginChanged(ChangeEvent e)
Overridden to fix
//http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4330950:
|
void |
columnMoved(TableColumnModelEvent e)
Overridden to fix
//http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4330950:
|
void |
doLayout() |
Dimension |
getPreferredScrollableViewportSize() |
Dimension |
getPreferredSize() |
boolean |
getScrollableTracksViewportHeight()
Track parent viewport's size if it's larger than the current preferred
height of the table (causes empty tables to fill in the whole area of
a JScrollPane).
|
boolean |
getScrollableTracksViewportWidth()
Overridden to ignore requests for this table to track the width of its
containing viewport in cases where the viewport is narrower than the
minimum size of the table.
|
int |
getSortedColumn() |
int |
getTableRow(int modelRow)
Get the row in the table for a row in the model.
|
void |
hideColumn(int columnIndex)
Hide a column.
|
boolean |
isAscending() |
boolean |
isColumnHidden(int columnIndex)
Gets the hidden state for a column
|
boolean |
isEditCellAsSoonAsFocus()
Returns the state for editing a cell as soon as it gets the focus.
|
boolean |
isEnableHidingColumns()
Returns the state for hiding a column.
|
boolean |
isSortable() |
boolean |
isTabSkipUneditableCell()
Returns the state for enabling tab key to skip uneditable cells.
|
protected void |
newColumns()
Called when the columns have changed.
|
int |
rowAtPoint(Point point) |
int |
rowModelToView(int modelRow)
Converts a row number from the model co-ordinates system to the view's.
|
int |
rowViewToModel(int viewRow)
Converts a row number from the view co-ordinates system to the model's.
|
void |
setAscending(boolean ascending) |
void |
setComparator(int column,
Comparator<?> comparator)
Sets the custom comparator to be used for a particular column.
|
void |
setEditCellAsSoonAsFocus(boolean editCellAsSoonAsFocus)
Set the possibility for a cell to be in editing mode as soon as
it gets the focus.
|
void |
setEnableHidingColumns(boolean enableHidingColumns)
Set the possibility for the user to hide/show a column by right-clicking
on a column header.
|
void |
setModel(TableModel dataModel) |
void |
setSortable(boolean sortable) |
void |
setSortedColumn(int sortColumn) |
void |
setTableHeader(JTableHeader newTableHeader) |
void |
setTabSkipUneditableCell(boolean tabSkipUneditableCell)
Set the possibility for the tab key to skip uneditable cells.
|
void |
showColumn(int columnIndex,
int insertionIndex)
Show a column.
|
void |
tableChanged(TableModelEvent e)
Overridden for efficiency reasons (provides a better calculation of the
dirty region).
|
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, clearSelection, columnAdded, columnAtPoint, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, convertRowIndexToModel, convertRowIndexToView, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createDefaultSelectionModel, createDefaultTableHeader, createScrollPaneForTable, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoCreateRowSorter, getAutoResizeMode, getCellEditor, getCellEditor, getCellRect, getCellRenderer, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getDropLocation, getDropMode, getEditingColumn, getEditingRow, getEditorComponent, getFillsViewportHeight, getGridColor, getIntercellSpacing, getModel, getPrintable, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getRowSorter, getScrollableBlockIncrement, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, getUpdateSelectionOnSort, getValueAt, initializeLocalVars, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareEditor, prepareRenderer, print, print, print, print, print, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, selectAll, setAutoCreateColumnsFromModel, setAutoCreateRowSorter, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setFillsViewportHeight, setGridColor, setIntercellSpacing, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setRowSorter, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setUI, setUpdateSelectionOnSort, setValueAt, sizeColumnsToFit, sizeColumnsToFit, sorterChanged, unconfigureEnclosingScrollPane, updateUI, valueChanged
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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
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, transferFocusDownCycle, validate, validateTree
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, 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, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected XJTable.SortingModel sortingModel
protected ObjectComparator defaultComparator
protected int sortedColumn
protected boolean ascending
protected boolean sortable
protected List<XJTable.ColumnData> columnData
XJTable.ColumnData
objects.protected XJTable.HeaderMouseListener headerMouseListener
protected List<TableColumn> hiddenColumns
public XJTable()
public XJTable(TableModel model)
public void setModel(TableModel dataModel)
protected void newColumns()
public void setTableHeader(JTableHeader newTableHeader)
setTableHeader
in class JTable
public Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize
in interface Scrollable
getPreferredScrollableViewportSize
in class JTable
protected void calculatePreferredSize()
public Dimension getPreferredSize()
getPreferredSize
in class JComponent
public boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth
in interface Scrollable
getScrollableTracksViewportWidth
in class JTable
public boolean getScrollableTracksViewportHeight()
getScrollableTracksViewportHeight
in interface Scrollable
getScrollableTracksViewportHeight
in class JTable
public int rowModelToView(int modelRow)
modelRow
- the row number in the modelrowViewToModel(int)
public boolean isAscending()
public boolean isColumnHidden(int columnIndex)
columnIndex
- index of the column in the table modelpublic void hideColumn(int columnIndex)
columnIndex
- index of the column in the table modelpublic void showColumn(int columnIndex, int insertionIndex)
columnIndex
- index of the column in the table modelinsertionIndex
- index of the view where the colum will be insertedpublic void setAscending(boolean ascending)
ascending
- The ascending to set. True by default.public int rowViewToModel(int viewRow)
viewRow
- the row number in the view.rowModelToView(int)
public void setEnableHidingColumns(boolean enableHidingColumns)
enableHidingColumns
- true if and only if the columns can be hidden.public boolean isEnableHidingColumns()
public boolean isEditCellAsSoonAsFocus()
public void setEditCellAsSoonAsFocus(boolean editCellAsSoonAsFocus)
editCellAsSoonAsFocus
- true if and only if a cell get in editing
mode when it receives the focus.public boolean isTabSkipUneditableCell()
public void setTabSkipUneditableCell(boolean tabSkipUneditableCell)
tabSkipUneditableCell
- true if and only if the tab key skip
uneditable cells.public void setComparator(int column, Comparator<?> comparator)
column
- the column index.comparator
- the comparator to be used.public boolean isSortable()
public void setSortable(boolean sortable)
sortable
- The sortable to set. True by default.public int getSortedColumn()
public void setSortedColumn(int sortColumn)
sortColumn
- The sortColumn to set. None (-1) by default.public int getTableRow(int modelRow)
modelRow
- row in the modelpublic void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)
changeSelection
in class JTable
public int rowAtPoint(Point point)
rowAtPoint
in class JTable
public void tableChanged(TableModelEvent e)
tableChanged
in interface TableModelListener
tableChanged
in class JTable
public void columnMoved(TableColumnModelEvent e)
columnMoved
in interface TableColumnModelListener
columnMoved
in class JTable
public void columnMarginChanged(ChangeEvent e)
columnMarginChanged
in interface TableColumnModelListener
columnMarginChanged
in class JTable
Copyright © 2024 GATE. All rights reserved.