JIDE 3.5.15

com.jidesoft.grid
Class JideTable

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JTable
                  extended by com.jidesoft.grid.JideTable
All Implemented Interfaces:
IndexChangeListener, TableAdapter, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, CellEditorListener, ListSelectionListener, RowSorterListener, TableColumnModelListener, TableModelListener, Scrollable
Direct Known Subclasses:
ContextSensitiveTable

public class JideTable
extends JTable
implements TableAdapter, IndexChangeListener

JideTable is an extended version of JTable.

There are several features we added to JideTable.

First, we added CellEditorListener support. You can add a JideCellEditorListener to the table. JideCellEditorListener extends CellEditorListener and added additional methods such as JideCellEditorListener.editingStarting(javax.swing.event.ChangeEvent), JideCellEditorListener.editingStopping(javax.swing.event.ChangeEvent) and CellEditorListener.editingStopped(javax.swing.event.ChangeEvent). You can do things like preventing cell from starting edit or preventing cell from stopping edit.

The second feature is to support Validator. You can add a Validator to the table. The validating() method in the listener will be called before cell stops editing. If the validation failed, the cell editor won't be removed.

The third feature added to JideTable is the support of the listener for row height changes when rows have various height. You can add a listener by calling getRowHeights().addRowHeightChangeListener(listener). A RowHeightChangeEvent will be fired whenever setRowHeight(int, int) is called.

The fourth feature is rowAutoResizes. By default, JTable's row height is determined explicitly. It wouldn't consider the cell content preferred height. There is a problem here if a cell renderer can support multiple lines. So we added a new attribute called rowAutoResizes. By default, it's false which is exactly the same behavior as JTable. If you set to true, the table row will resize automatically when cell renderer's preferred height changes. Please note there is a performance hit if you turned it on as it has to check all cells to find out the preferred row height. So only use it when it's really necessary.

In the future, we will add more features to JideTable as long as we think the feature should be part of the base table class.

Please be noted that, JideTable could NOT support the sorter provided in JTable. The reason is that, JTable contains many private method and fields in that area, which prevents us to inherit its behavior. For sorting feature in JideTable, please use SortableTable instead. There might be some odd behaviors if you invoke JTable#setAutoCreateRowSorter(true).

See Also:
Serialized Form

Nested Class Summary
protected static class JideTable.NonContiguousTransferHandler
          The transfer handler for JDK5 and lower version just for backward compatibility concern.
 
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  boolean _batchProcessing
           
protected  CellChangeEvent _cellChangeEvent
           
protected  int _clickCountToStart
          An integer specifying the number of clicks needed to start editing.
protected  TableColumnAutoResizer _columnAutoResizer
           
protected  TableColumnResizer _columnResizer
           
protected  MouseMotionListener _headerDraggingMouseMotionListener
           
protected  TableCellEditor _rolloverCellEditor
           
protected  CellEditorListener _rolloverCellEditorListener
           
protected  int _rolloverColumn
           
protected  Component _rolloverEditorComp
           
protected  PropertyChangeListener _rolloverEditorRemover
           
protected  int _rolloverRow
           
protected  RowHeights _rowHeights
           
protected  TableRowResizer _rowResizer
           
static String ACTION_NAME_CANCEL_EDITING
           
static int AUTO_RESIZE_ALL_COLUMNS_FILL
          Deprecated. please use AUTO_RESIZE_FILL | AUTO_RESIZE_ALL_COLUMNS instead.
static int AUTO_RESIZE_FILL
          An enhanced auto resize mode.
static int AUTO_RESIZE_LAST_COLUMN_FILL
          Deprecated. please use AUTO_RESIZE_FILL | AUTO_RESIZE_LAST_COLUMN instead.
static int AUTO_RESIZE_NEXT_COLUMN_FILL
          Deprecated. please use AUTO_RESIZE_FILL | AUTO_RESIZE_NEXT_COLUMN instead.
static int AUTO_RESIZE_SUBSEQUENT_COLUMNS_FILL
          Deprecated. please use AUTO_RESIZE_FILL | AUTO_RESIZE_SUBSEQUENT_COLUMNS instead.
static String CLIENT_PROPERTY_LAZY_CALCULATE_ROW_HEIGHT
          This client property only takes effect when isRowAutoResizes() returns true.
static int EDITOR_AUTO_COMPLETION_MODE_COLUMN
           
static int EDITOR_AUTO_COMPLETION_MODE_NONE
           
static int EDITOR_AUTO_COMPLETION_MODE_ROW
           
static int EDITOR_AUTO_COMPLETION_MODE_TABLE
           
static String PROPERTY_CLEAR_SELECTION_ON_TABLE_DATA_CHANGES
          Deprecated. replaced by PROPERTY_LOAD_SELECTION_ON_TABLE_DATA_CHANGES
static String PROPERTY_EDITOR_AUTO_COMPLETION_MODE
           
static String PROPERTY_FILLS_BOTTOM
           
static String PROPERTY_FILLS_GRIDS
           
static String PROPERTY_FILLS_RIGHT
           
static String PROPERTY_LOAD_SELECTION_ON_TABLE_DATA_CHANGES
           
static String PROPERTY_NON_CONTIGUOUS_CELL_SELECTION
           
static String PROPERTY_ROW_AUTO_RESIZES
           
static String PROPERTY_SCROLL_ROW_WHEN_ROW_HEIGHT_CHANGES
           
static String PROPERTY_TABLE_SELECTION_MODEL
           
static String ROW_AUTO_RESIZES_PROPERTY
          Deprecated. renamed to PROPERTY_ROW_AUTO_RESIZES
 
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
JideTable()
           
JideTable(int numRows, int numColumns)
           
JideTable(Object[][] rowData, Object[] columnNames)
           
JideTable(TableModel dm)
           
JideTable(TableModel dm, TableColumnModel cm)
           
JideTable(TableModel dm, TableColumnModel cm, ListSelectionModel sm)
           
JideTable(Vector<?> rowData, Vector<?> columnNames)
           
 
Method Summary
 void addCellEditorListener(JideCellEditorListener l)
          Adds a JideCellEditorListener to the listener list.
 void addColumn(TableColumn column)
          Overrides this method to skip the column that is being added when the column was hidden earlier by TableColumnChooser.hideColumn(javax.swing.JTable, int) method.
 void addColumnSelectionInterval(int index0, int index1)
           
 void addNotify()
           
 void addRowSelectionInterval(int index0, int index1)
           
 void addRowValidator(RowValidator l)
          Adds a RowValidator to the listener list.
 void addUndo(UndoableEdit edit)
          Adds an undoable edit to JideTable for further undo/redo.
 void addUndoableEditListener(UndoableEditListener listener)
          Adds the undoable edit listener.
 void addValidator(Validator l)
          Adds a Validator to the listener list.
 void adjustSelectionWhenColumnMoved(int column, int targetColumn)
          Usually you don't need to call this method.
 boolean alwaysCalculateCellRect()
          A boolean flag to determine if the rect should always be calculated when painting the grid line and cells.
protected  void calculateAutoResizedRowHeights()
          Deprecated. replaced by #calculateRowHeight. This method will not be invoked while setRowAutoResizes(true). Please override #calculateRowHeight instead to calculate row height.
protected  void calculateAutoResizedRowHeights(int firstRow, int lastRow)
          Deprecated. replaced by #calculateRowHeight. This method will not be invoked while setRowAutoResizes(true). Please override #calculateRowHeight instead to calculate row height.
protected  int calculateRowHeight(int row)
          The method calculates the height for the row based on the content in the row.
 void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)
          Updates the selection models of the table, depending on the state of the two flags: toggle and extend.
 void clearSelection()
           
 void clearSelectionPermanently()
          Clear the selections permanently without being restored later on.
 void columnSelectionChanged(ListSelectionEvent e)
           
 void configureEnclosingScrollPaneExplicitly()
           
protected  String convertElementToString(Object value, int row, int column)
          Get the displayed string of the specified value in designated row and column.
 int convertRowIndexToModel(int viewRowIndex)
          Overrides this methods so that it is available for pre-JDK6 environment.
 int convertRowIndexToView(int modelRowIndex)
          Overrides this methods so that it is available for pre-JDK6 environment.
protected  AutoCompletion createCellAutoCompletion(JTextComponent textComponent, Object[] autoCompletionList)
          Creates the AutoCompletion for the cell editor to use.
 void createDefaultColumnsFromModel()
           
protected  ListSelectionModel createDefaultSelectionModel()
           
protected  JTableHeader createDefaultTableHeader()
          Creates the table header.
 void createDefaultTableSelectionModel()
          Creates a default TableSelectionModel.
protected  TransferHandler createDefaultTransferHandler()
          Creates default TransferHandler.
protected  RowHeightChangeListener createRowAutoScrollingListener()
          Creates the RowHeightChangeListener which will automatically scroll the row then row height changes so that it is outside the visible area.
protected  RowHeights createRowHeights()
           
protected  SortTableHeaderRenderer createSortHeaderRenderer()
          Deprecated. replaced by StyledLabel based header renderer.
 boolean editCellAt(int row, int column, EventObject e)
           
 void editingCanceled(ChangeEvent e)
           
 void editingStopped(ChangeEvent e)
           
protected  void fireEditingCanceled(Object source, int row, int column)
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireEditingStarted(Object source, int row, int column)
          Notifies all listeners that have registered interest for notification on this event type.
protected  boolean fireEditingStarting(Object source, int row, int column)
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireEditingStopped(Object source, int row, int column)
          Notifies all listeners that have registered interest for notification on this event type.
protected  boolean fireEditingStopping(Object source, int row, int column)
          Notifies all listeners that have registered interest for notification on this event type.
 String getActualUIClassID()
           
 CellEditorListener[] getCellEditorListeners()
          Returns an array of all the JideCellEditorListeners added to this JideTable with addCellEditorListener().
 Rectangle getCellRect(int row, int column, boolean includeSpacing)
           
 int getClickCountToStart()
          Returns the number of clicks needed to start editing.
 TableCellRenderer getDefaultRenderer(Class<?> columnClass)
           
protected  Rectangle getDirtyRegion(int firstRow, int firstColumn, int lastRow, int lastColumn)
          Gets the dirty region from the first row, first column and last row, last column.
 int getEditorAutoCompletionMode()
          Gets the editor auto-completion mode.
protected  int getEditorAutoCompletionMode(int rowIndex, int columnIndex)
          Gets the editor auto-completion mode for the cell.
 Rectangle getEditorCellRect(int rowIndex, int columnIndex)
          In TreeTable and HierarchicalTable case, the cell rect for cell editor should consider the +/- icon size so the cell editor doesn't cover the +/- icon.
 Color getGridColor(int row)
          Gets the grid line color for each row.
 GridColorProvider getGridColorProvider()
          Gets the GridColorProvider to provide the grid line colors.
 TableCellEditor getRolloverCellEditor()
          Gets the cell editor created by rolloverCellAt(int, int).
 int getRolloverColumn()
          Gets the column index that has the rollover cell editor.
 int getRolloverRow()
          Gets the row index that has the rollover cell editor.
 int getRowHeight(int row)
           
 RowHeights getRowHeights()
           
 RowValidator[] getRowValidator()
          Returns an array of all the RowValidators added to this AbstractCellEditor with addValidationListener().
 int getSelectedColumn()
          Returns the index of the first selected column, -1 if no column is selected.
 int getSelectedColumnCount()
          Returns the number of selected columns.
 int[] getSelectedColumns()
          Returns the indices of all selected columns.
 int getSelectedRow()
          Returns the index of the first selected row, -1 if no row is selected.
 int getSelectedRowCount()
          Returns the number of selected rows.
 int[] getSelectedRows()
          Returns the indices of all selected rows.
 Color getSelectionBackground()
           
 TableColumnWidthKeeper getTableColumnWidthKeeper()
           
 String getTableHeaderToolTipText(int modelIndex)
          Gets the TableHeader's tooltip for a particular model column index
 String getTableHeaderToolTipText(MouseEvent event)
          Gets the TableHeader's tooltip at the location of mouse event.
 TableSelectionModel getTableSelectionModel()
          Gets the table selection model.
 JTextComponent getTextComponentForEditorComponent(Component component)
          Gets the text component from the editor component.
 String getToolTipText(MouseEvent event)
           
 UndoManager getUndoManager()
          Gets the undo manager.
 Validator[] getValidator()
          Returns an array of all the Validators added to this AbstractCellEditor with addValidationListener().
 Object getValueAt(int row, int column)
          Returns the cell value at row and column.
 Color getVerticalGridColor(int column)
          Gets the grid line color for each column.
 void indexChanged(IndexChangeEvent event)
          Called whenever the table model wrapper is going to have some change.
protected  void initTable()
          Leaves it here for backward compatible reason.
 boolean isAdjustEditorLocationOnModelChanged()
          Gets the flag that indicates if the cell editing should be kept when table model is changed.
 boolean isAlwaysRequestFocusForEditor()
          Get the flag indicating if JideTable should always request focus for cell editor.
 boolean isAutoResizeFillMode()
          Get the flag indicating if empty area of the table need be filled.
 boolean isAutoSelectTextWhenStartsEditing()
          Checks if the text in the cell editor will be selected when cell starts editing.
 boolean isAutoStartCellEditing()
          Checks if the navigation key stroke will start cell editing.
protected  boolean isAutoStartCellEditingKey(KeyStroke ks)
          Checks if the key stroke will trigger the cell editing.
protected  boolean isBatchProcessing()
          Checks if it is in batch processing.
 boolean isCalculateRowHeightsOnWidthChange()
          Get the flag indicating if JideTable should calculate row heights if column width is changed.
 boolean isCellContentVisible()
          Checks if the table cell content will be painted.
protected  boolean isCellFocused(int rowIndex, int columnIndex)
          Check if the cell is a focused cell inside the table.
 boolean isCellSelected(int row, int column)
          Returns true if the specified indices are in the valid range of rows and columns and the cell at the specified position is selected.
 boolean isClearPropertyAtStructureChange()
          Get the flag indicating if JideTable should clear properties for table column orders.
 boolean isClearSelectionOnTableDataChanges()
          Deprecated. replaced by isLoadSelectionOnTableDataChanged().
 boolean isColumnAutoResizable()
          Checks if the column is auto-resizable.
 boolean isColumnResizable()
          Checks if the column is resizable by dragging the vertical grid line.
 boolean isColumnSelected(int column)
          Returns true if the specified index is in the valid range of columns, and the column at that index is selected.
 boolean isEnableIgnored()
          Get the flag indicating if the cell will be painted with normal text color even the table is disabled.
 boolean isFillBottom()
          Deprecated. replaced by isFillsBottom()
 boolean isFillGrids()
          Deprecated. replaced by isFillsGrids()
 boolean isFillRight()
          Deprecated. replaced by isFillsRight()
 boolean isFillsBottom()
          Gets the flag indicating if the area below the JideTable in the viewport will be filled.
 boolean isFillsGrids()
          Gets the flag indicating if the area below the JideTable in the viewport will be filled with grids.
protected  boolean isFillsGridsBottom()
          Gets the flag indicating if the area bottom to the JideTable in the viewport will be filled with grids.
protected  boolean isFillsGridsRight()
          Gets the flag indicating if the area right to the JideTable in the viewport will be filled with grids.
 boolean isFillsRight()
          Gets the flag indicating if the area right to the JideTable in the viewport will be filled.
 boolean isKeepRowHeights()
          Get if you want to keep row heights after table events, such as sorting and filtering.
 boolean isLoadSelectionOnTableDataChanged()
          Gets the flag indicating if JideTable should load selection if it receives a table model event which indicates a table data changed event is fired from its original table model.
 boolean isNestedTableHeader()
          Checks if nested table header is used.
 boolean isNonContiguousCellSelection()
          Checks if the table selection model allows non-contiguous cell selection.
 boolean isRollover()
          Checks if there is a rollover cell editor created by rolloverCellAt(int, int).
 boolean isRowAutoResizes()
          Checks if row automatically resizes with the cells preferred heights.
protected  boolean isRowHeightChanged(int row, int newHeight)
          The method will check if the new height is different with current height.
 boolean isRowResizable()
          Checks if the row is resizable by dragging the horizontal grid line.
 boolean isRowSelected(int row)
          Returns true if the specified index is in the valid range of rows, and the row at that index is selected.
 boolean isScrollRowWhenRowHeightChanges()
          Checks the flag whether a row is scrolled to visible when its height changes.
 boolean isSelectInsertedRows()
          Returns the selectInsertedRows flag.
 boolean isTablePrinting()
          Checks if the table is printing.
protected  boolean isValidCellEditingKey(KeyEvent keyEvent)
          Checks if the key event is a valid keystroke to start cell editing.
 boolean isVariousRowHeights()
          Is the table has various row height on each row.
protected  void loadTableRowSettings(boolean invokeOutside)
          To load row heights and selections after you do some big work, like firing table data change event.
 void paintCellOverlay(Graphics g, Component component, int row, int column, Rectangle cellRect)
          Paints the cell overlay.
 void paintCellUnderlay(Graphics g, Component component, int row, int column, Rectangle cellRect)
          Paints the cell underlay.
protected  void paintFillHeader(Graphics g)
          Paint fill header in the right side of the table header if needed.
 Component prepareEditor(TableCellEditor editor, int row, int column)
           
 Component prepareRenderer(TableCellRenderer renderer, int row, int column)
           
 boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)
           
 void releaseRendererComponent(TableCellRenderer renderer, int row, int column, Component component)
           
 void removeCellEditorListener(JideCellEditorListener l)
          Removes a JideCellEditorListener from the listener list.
 void removeColumn(TableColumn aColumn)
           
 void removeColumnSelectionInterval(int index0, int index1)
           
 void removeEditor()
          Override to regain focus on JTable when the AbstractComboBox's popup panel has focus.
 void removeNotify()
           
 void removeRolloverEditor()
          Removes the rollover cell editor created by rolloverCellAt(int, int).
 void removeRowSelectionInterval(int index0, int index1)
           
 void removeRowValidator(RowValidator l)
          Removes a RowValidator from the listener list.
 void removeUndoableEditListener(UndoableEditListener listener)
          Removes the undoable edit listener.
 void removeValidator(Validator l)
          Removes a Validator from the listener list.
 void resetTransferHandler()
          JideTable will use its own transfer handler called JideTableTransferHandler which could import data from clipboard.
 boolean rolloverCellAt(int row, int column)
          Makes the cell enters editing mode without forcing the other cell editor, if any, to stop editing.
 int rowAtPoint(Point point)
          Returns the index of the row that point lies in, or -1 if the result is not in the range [0, getRowCount()-1].
protected  void saveTableRowSettings(boolean invokeOutside)
          To save row heights and selections before you do some big work, like firing table data change event.
 void scrollRowToVisible(int row)
          Scroll the row till the row is visible.
 void selectAll()
           
 void setAdjustEditorLocationOnModelChanged(boolean keepEditing)
          Sets the flag that indicates if the cell editing should be kept when table model is changed.
 void setAlwaysRequestFocusForEditor(boolean alwaysRequestFocusForEditor)
          Set the flag indicating if JideTable should always request focus for cell editor.
 void setAutoResizeMode(int mode)
          Sets the table's auto resize mode when the table is resized.
 void setAutoSelectTextWhenStartsEditing(boolean autoSelectTextWhenStartsEditing)
          Sets the flag if the text in the cell editor will be selected when starts editing.
 void setAutoStartCellEditing(boolean autoStartCellEditing)
          Sets the flag if the navigation key stroke will start cell editing.
protected  void setBatchProcessing(boolean batchProcessing)
          Sets to batch processing.
 void setCalculateRowHeightsOnWidthChange(boolean calculateRowHeightsOnWidthChange)
          Set the flag indicating if JideTable should calculate row heights if column width is changed.
 void setCellContentVisible(boolean cellContentVisible)
          Sets the cell content visible or invisible.
 void setClearPropertyAtStructureChange(boolean clearPropertyAtStructureChange)
          Set the flag indicating if JideTable should clear properties for table column orders.
 void setClearSelectionOnTableDataChanges(boolean clearSelectionOnTableDataChanges)
          Deprecated. replaced by setLoadSelectionOnTableDataChanged(boolean).
 void setClickCountToStart(int count)
          Specifies the number of clicks needed to start editing.
 void setColumnAutoResizable(boolean resizable)
          Enable or disable the column auto-resizable.
 void setColumnResizable(boolean resizable)
          Enable or disable the column resizable.
 void setColumnSelectionAllowed(boolean columnSelectionAllowed)
          Sets whether the columns can be selected.
 void setColumnSelectionInterval(int index0, int index1)
           
 void setEditorAutoCompletionMode(int editorAutoCompletionMode)
          Sets the editor auto-completion mode.
 void setEnabled(boolean enabled)
           
 void setEnableIgnored(boolean enableIgnored)
          Set the flag indicating if the cell will be painted with the normal text color even the table is disabled.
 void setFillBottom(boolean fillBottom)
          Deprecated. replaced by setFillsBottom(boolean)
 void setFillGrids(boolean fillGrids)
          Deprecated. replaced by setFillsGrids(boolean)
 void setFillRight(boolean fillRight)
          Deprecated. replaced by setFillsRight(boolean)
 void setFillsBottom(boolean fillsBottom)
          Sets the flag indicating if the area below the JideTable in the viewport will be filled.
 void setFillsGrids(boolean fillsGrids)
          Sets the flag indicating if the area below the JideTable in the viewport will be filled with grids.
 void setFillsRight(boolean fillsRight)
          Sets the flag indicating if the area right to the JideTable in the viewport will be filled.
 void setGridColorProvider(GridColorProvider gridColorProvider)
          Sets a GridColorProvider to provide the grid line colors.
 void setKeepRowHeights(boolean keepRowHeights)
          Set if you want to keep row heights after table events, such as sorting and filtering.
 void setLoadSelectionOnTableDataChanged(boolean loadSelectionOnTableDataChanged)
          Sets the flag indicating if JideTable should load selection if it receives a table model event which indicates a table data changed event is fired from its original table model.
 void setModel(TableModel dataModel)
           
 void setNestedTableHeader(boolean nestedTableHeader)
          Sets if nested table header is allowed.
 void setNonContiguousCellSelection(boolean nonContiguousCellSelection)
          Sets the attribute of nonContiguousCellSelection.
 void setPreferredSize(Dimension preferredSize)
           
 void setRowAutoResizes(boolean rowAutoResizes)
          Sets the rowAutoResizes attribute.
 void setRowHeight(int rowHeight)
          Sets the height, in pixels, of all cells to rowHeight, re-validates, and repaints.
 void setRowHeight(int row, int rowHeight)
          Sets the height for row to rowHeight, re-validates, and repaints.
 void setRowHeights(RowHeights rowHeights)
           
 void setRowResizable(boolean resizable)
          Enable or disable the row resizable.
 void setRowSelectionAllowed(boolean rowSelectionAllowed)
          Sets whether the rows can be selected.
 void setRowSelectionInterval(int index0, int index1)
           
 void setScrollRowWhenRowHeightChanges(boolean scrollRowWhenRowHeightChanges)
          Sets the flag if the row should be scrolled to visible when the row height changes.
 void setSelectInsertedRows(boolean selectInsertedRows)
          Sets the selectInsertedRow flag.
protected  void setSortTableHeaderRenderer()
          Deprecated. replaced by StyledLabel based header renderer.
 void setTableColumnWidthKeeper(TableColumnWidthKeeper tableColumnWidthKeeper)
           
 void setTableHeader(JTableHeader tableHeader)
           
 void setTablePrinting(boolean tablePrinting)
          Sets the table as printing.
 void setTableSelectionModel(TableSelectionModel tableSelectionModel)
          Sets a new TableSelectionModel.
 void setVariousRowHeights(boolean variousRowHeights)
          Sets variousRowHeights.
protected  boolean shouldCellBePaintedAsFocused(int row, int column)
          Subclass can override this method to determine if the cell should be painted as focused cell when it is a focused cell.
protected  boolean shouldCellBePaintedAsSelected(int row, int column)
          Subclass can override this method to determine if the cell should be painted as selected when selected.
protected  boolean startCellEditing(CellEditor editor, int row, int column)
          Calls fireEditingStarting and fireEditingStarted, and returns true or false based on the return value of fireEditingStarting.
 void tableChanged(TableModelEvent e)
          Invoked when this table's TableModel generates a TableModelEvent.
 void updateUI()
           
 ValidationResult validate(int rowIndex, int columnIndex, Object oldValue, Object newValue)
           
 ValidationResult validateRow(int rowIndex)
          Validates a row.
 void valueChanged(ListSelectionEvent e)
           
 
Methods inherited from class javax.swing.JTable
columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, createDefaultColumnModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createScrollPaneForTable, doLayout, editCellAt, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoCreateRowSorter, getAutoResizeMode, getCellEditor, getCellEditor, getCellRenderer, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDragEnabled, getDropLocation, getDropMode, getEditingColumn, getEditingRow, getEditorComponent, getFillsViewportHeight, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getPrintable, getRowCount, getRowHeight, getRowMargin, getRowSelectionAllowed, getRowSorter, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getUI, getUIClassID, getUpdateSelectionOnSort, initializeLocalVars, isCellEditable, isEditing, moveColumn, paramString, print, print, print, print, print, resizeAndRepaint, setAutoCreateColumnsFromModel, setAutoCreateRowSorter, setCellEditor, setCellSelectionEnabled, setColumnModel, setDefaultEditor, setDefaultRenderer, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setFillsViewportHeight, setGridColor, setIntercellSpacing, setPreferredScrollableViewportSize, setRowMargin, setRowSorter, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setUI, setUpdateSelectionOnSort, setValueAt, sizeColumnsToFit, sizeColumnsToFit, sorterChanged, unconfigureEnclosingScrollPane
 
Methods inherited from class javax.swing.JComponent
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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, 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, setComponentOrientation, 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
 
Methods inherited from interface com.jidesoft.grid.TableAdapter
getCellSelectionEnabled, getColumnClass, getColumnCount, getColumnName, getColumnSelectionAllowed, getRowCount, getRowSelectionAllowed, isCellEditable, setCellSelectionEnabled, setValueAt
 

Field Detail

_cellChangeEvent

protected transient CellChangeEvent _cellChangeEvent

ROW_AUTO_RESIZES_PROPERTY

@Deprecated
public static final String ROW_AUTO_RESIZES_PROPERTY
Deprecated. renamed to PROPERTY_ROW_AUTO_RESIZES
See Also:
Constant Field Values

PROPERTY_ROW_AUTO_RESIZES

public static final String PROPERTY_ROW_AUTO_RESIZES
See Also:
Constant Field Values

PROPERTY_NON_CONTIGUOUS_CELL_SELECTION

public static final String PROPERTY_NON_CONTIGUOUS_CELL_SELECTION
See Also:
Constant Field Values

PROPERTY_TABLE_SELECTION_MODEL

public static final String PROPERTY_TABLE_SELECTION_MODEL
See Also:
Constant Field Values

PROPERTY_SCROLL_ROW_WHEN_ROW_HEIGHT_CHANGES

public static final String PROPERTY_SCROLL_ROW_WHEN_ROW_HEIGHT_CHANGES
See Also:
Constant Field Values

PROPERTY_CLEAR_SELECTION_ON_TABLE_DATA_CHANGES

@Deprecated
public static final String PROPERTY_CLEAR_SELECTION_ON_TABLE_DATA_CHANGES
Deprecated. replaced by PROPERTY_LOAD_SELECTION_ON_TABLE_DATA_CHANGES
See Also:
Constant Field Values

PROPERTY_LOAD_SELECTION_ON_TABLE_DATA_CHANGES

public static final String PROPERTY_LOAD_SELECTION_ON_TABLE_DATA_CHANGES
See Also:
Constant Field Values

PROPERTY_EDITOR_AUTO_COMPLETION_MODE

public static final String PROPERTY_EDITOR_AUTO_COMPLETION_MODE
See Also:
Constant Field Values

PROPERTY_FILLS_RIGHT

public static final String PROPERTY_FILLS_RIGHT
See Also:
Constant Field Values

PROPERTY_FILLS_BOTTOM

public static final String PROPERTY_FILLS_BOTTOM
See Also:
Constant Field Values

PROPERTY_FILLS_GRIDS

public static final String PROPERTY_FILLS_GRIDS
See Also:
Constant Field Values

CLIENT_PROPERTY_LAZY_CALCULATE_ROW_HEIGHT

public static final String CLIENT_PROPERTY_LAZY_CALCULATE_ROW_HEIGHT
This client property only takes effect when isRowAutoResizes() returns true.

By default, it's lazy load which won't hit the performance. However, if you want to refresh the table's prefererd height without performance concern, please set this client property to Boolean.FALSE

See Also:
Constant Field Values

ACTION_NAME_CANCEL_EDITING

public static final String ACTION_NAME_CANCEL_EDITING
See Also:
Constant Field Values

AUTO_RESIZE_FILL

public static final int AUTO_RESIZE_FILL
An enhanced auto resize mode. In this mode, if a JideTable is inside a JScrollPane and the width cannot fill the JViewport, JideTable will have the blank area filled like normal table header and cells.

See Also:
Constant Field Values

AUTO_RESIZE_NEXT_COLUMN_FILL

@Deprecated
public static final int AUTO_RESIZE_NEXT_COLUMN_FILL
Deprecated. please use AUTO_RESIZE_FILL | AUTO_RESIZE_NEXT_COLUMN instead.
See Also:
Constant Field Values

AUTO_RESIZE_SUBSEQUENT_COLUMNS_FILL

@Deprecated
public static final int AUTO_RESIZE_SUBSEQUENT_COLUMNS_FILL
Deprecated. please use AUTO_RESIZE_FILL | AUTO_RESIZE_SUBSEQUENT_COLUMNS instead.
See Also:
Constant Field Values

AUTO_RESIZE_LAST_COLUMN_FILL

@Deprecated
public static final int AUTO_RESIZE_LAST_COLUMN_FILL
Deprecated. please use AUTO_RESIZE_FILL | AUTO_RESIZE_LAST_COLUMN instead.
See Also:
Constant Field Values

AUTO_RESIZE_ALL_COLUMNS_FILL

@Deprecated
public static final int AUTO_RESIZE_ALL_COLUMNS_FILL
Deprecated. please use AUTO_RESIZE_FILL | AUTO_RESIZE_ALL_COLUMNS instead.
See Also:
Constant Field Values

_clickCountToStart

protected int _clickCountToStart
An integer specifying the number of clicks needed to start editing. Even if clickCountToStart is defined as zero, it will not initiate until a click occurs.


_headerDraggingMouseMotionListener

protected MouseMotionListener _headerDraggingMouseMotionListener

EDITOR_AUTO_COMPLETION_MODE_NONE

public static final int EDITOR_AUTO_COMPLETION_MODE_NONE
See Also:
Constant Field Values

EDITOR_AUTO_COMPLETION_MODE_COLUMN

public static final int EDITOR_AUTO_COMPLETION_MODE_COLUMN
See Also:
Constant Field Values

EDITOR_AUTO_COMPLETION_MODE_ROW

public static final int EDITOR_AUTO_COMPLETION_MODE_ROW
See Also:
Constant Field Values

EDITOR_AUTO_COMPLETION_MODE_TABLE

public static final int EDITOR_AUTO_COMPLETION_MODE_TABLE
See Also:
Constant Field Values

_rowHeights

protected RowHeights _rowHeights

_batchProcessing

protected boolean _batchProcessing

_rolloverEditorRemover

protected PropertyChangeListener _rolloverEditorRemover

_rolloverCellEditorListener

protected CellEditorListener _rolloverCellEditorListener

_rolloverCellEditor

protected transient TableCellEditor _rolloverCellEditor

_rolloverEditorComp

protected transient Component _rolloverEditorComp

_rolloverRow

protected transient int _rolloverRow

_rolloverColumn

protected transient int _rolloverColumn

_columnAutoResizer

protected TableColumnAutoResizer _columnAutoResizer

_rowResizer

protected TableRowResizer _rowResizer

_columnResizer

protected TableColumnResizer _columnResizer
Constructor Detail

JideTable

public JideTable()

JideTable

public JideTable(int numRows,
                 int numColumns)

JideTable

public JideTable(TableModel dm)

JideTable

public JideTable(Object[][] rowData,
                 Object[] columnNames)

JideTable

public JideTable(Vector<?> rowData,
                 Vector<?> columnNames)

JideTable

public JideTable(TableModel dm,
                 TableColumnModel cm)

JideTable

public JideTable(TableModel dm,
                 TableColumnModel cm,
                 ListSelectionModel sm)
Method Detail

initTable

protected void initTable()
Leaves it here for backward compatible reason.


resetTransferHandler

public void resetTransferHandler()
JideTable will use its own transfer handler called JideTableTransferHandler which could import data from clipboard. If you dont' like this behavior, you could call this method to reset the transfer handler to the default one created by JTable which doesn't allow import.


setModel

public void setModel(TableModel dataModel)
Overrides:
setModel in class JTable

setAutoResizeMode

public void setAutoResizeMode(int mode)
Sets the table's auto resize mode when the table is resized.

Comparing to JTable, JideTable provides one more option - AUTO_RESIZE_FILL. It has two effects. First of all, it will stretch the last column of the table header area so that the empty area looks like an empty table column header. The second effect is it will fill the area under the empty table column header with table background or the stripes if you are using RowStripeTableStyleProvider. Most likely you will combine it with AUTO_RESIZE_OFF flag and call setAutoResizeMode(AUTO_RESIZE_FILL | AUTO_RESIZE_OFF). However you could use AUTO_RESIZE_FILL | AUTO_RESIZE_NEXT_COLUMN or with any other auto resize modes.

Prior to 2.10.1, we changed the return value of getAutoResizeMode to return the exact value you set using setAutoResizeMode. However it has some side effects that we can't overcome. So starting from 2.10.1, getAutoResizeMode will return the mode without AUTO_RESIZE_FILL. If you want to check if AUTO_RESIZE_FILL is set, you can call isAutoResizeFillMode().

Overrides:
setAutoResizeMode in class JTable
Parameters:
mode - the auto resize mode
See Also:
JTable.getAutoResizeMode(), JTable.doLayout()

isAutoResizeFillMode

public boolean isAutoResizeFillMode()
Get the flag indicating if empty area of the table need be filled.

By default, this flag is false. You could invoke setAutoResizeMode(int) to change its value. If you want this flag to return true, just call setAutoResizeMode( mode | AUTO_RESIZE_FILL) where the mode is one of the four existing auto resize modes defined in JTable.

Returns:
true if the empty area is to be filled. Otherwise false.
Since:
2.10.1

getActualUIClassID

public String getActualUIClassID()

updateUI

public void updateUI()
Overrides:
updateUI in class JTable

isNestedTableHeader

public boolean isNestedTableHeader()
Checks if nested table header is used. If you want to use nested table header, you need to make sure you call setNestedTableHeader(boolean) and pass in true.

Returns:
true if nested table header is used. Otherwise false.

setNestedTableHeader

public void setNestedTableHeader(boolean nestedTableHeader)
Sets if nested table header is allowed.

Parameters:
nestedTableHeader - true or false.

createDefaultTableHeader

protected JTableHeader createDefaultTableHeader()
Creates the table header. If the nested table header is allowed, it will return an instance of NestedTableHeader. Otherwise, it will return the JTableHeader.

Overrides:
createDefaultTableHeader in class JTable
Returns:
table header

paintFillHeader

protected void paintFillHeader(Graphics g)
Paint fill header in the right side of the table header if needed.

Parameters:
g - the Graphics instance

getTableHeaderToolTipText

public String getTableHeaderToolTipText(MouseEvent event)
Gets the TableHeader's tooltip at the location of mouse event.

Parameters:
event - the mouse event.
Returns:
the tooltip for the column where the mouse is over.

getTableHeaderToolTipText

public String getTableHeaderToolTipText(int modelIndex)
Gets the TableHeader's tooltip for a particular model column index

Parameters:
modelIndex - the model column index.
Returns:
the tooltip for the model column index where the mouse is over.

processKeyBinding

public boolean processKeyBinding(KeyStroke ks,
                                 KeyEvent e,
                                 int condition,
                                 boolean pressed)
Overrides:
processKeyBinding in class JTable

setTableHeader

public void setTableHeader(JTableHeader tableHeader)
Overrides:
setTableHeader in class JTable

prepareEditor

public Component prepareEditor(TableCellEditor editor,
                               int row,
                               int column)
Overrides:
prepareEditor in class JTable

createCellAutoCompletion

protected AutoCompletion createCellAutoCompletion(JTextComponent textComponent,
                                                  Object[] autoCompletionList)
Creates the AutoCompletion for the cell editor to use.

Parameters:
textComponent - the text component
autoCompletionList - the auto completion list
Returns:
the AutoCompletion list.
Since:
3.4.4

convertElementToString

protected String convertElementToString(Object value,
                                        int row,
                                        int column)
Get the displayed string of the specified value in designated row and column.

Parameters:
value - the cell value
row - the row of the cell
column - the column of the cell
Returns:
the string to be displayed in the cell on renderering.

getTextComponentForEditorComponent

public JTextComponent getTextComponentForEditorComponent(Component component)
Gets the text component from the editor component. We need it in order to make it focus and select all the text if isAutoSelectTextWhenStartsEditing() is true.

Please note, this method will only return JTextComponent if the component is JTextComponent, JComboBox, AbstractComboBox or JSpinner. For all other types of components, it will return null. If you have a custom component which also has JTextComponent in it, you would need to override this method to return the right JTextComponent.

Parameters:
component - the component.
Returns:
text component inside the editor component.

startCellEditing

protected boolean startCellEditing(CellEditor editor,
                                   int row,
                                   int column)
Calls fireEditingStarting and fireEditingStarted, and returns true or false based on the return value of fireEditingStarting.

Parameters:
editor - the editor
row - the editing row
column - the editing column
Returns:
true if editing started. Otherwise false.

fireEditingStarting

protected boolean fireEditingStarting(Object source,
                                      int row,
                                      int column)
Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.

Parameters:
source - the source of the event
row - the row index
column - the column index
Returns:
true or false. If all listeners return true in editingStarting(), it will return true. If one of the listener returns false, it will return false.

fireEditingStarted

protected void fireEditingStarted(Object source,
                                  int row,
                                  int column)
Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.

Parameters:
source - the source of the event
row - the row index
column - the column index
See Also:
EventListenerList

addCellEditorListener

public void addCellEditorListener(JideCellEditorListener l)
Adds a JideCellEditorListener to the listener list.

Parameters:
l - the new listener to be added

removeCellEditorListener

public void removeCellEditorListener(JideCellEditorListener l)
Removes a JideCellEditorListener from the listener list.

Parameters:
l - the listener to be removed

getCellEditorListeners

public CellEditorListener[] getCellEditorListeners()
Returns an array of all the JideCellEditorListeners added to this JideTable with addCellEditorListener().

Returns:
all of the CellEditorListeners added or an empty array if no listeners have been added

addValidator

public void addValidator(Validator l)
Adds a Validator to the listener list.

Parameters:
l - the new listener to be added

removeValidator

public void removeValidator(Validator l)
Removes a Validator from the listener list.

Parameters:
l - the listener to be removed

getValidator

public Validator[] getValidator()
Returns an array of all the Validators added to this AbstractCellEditor with addValidationListener().

Returns:
all of the Validators added or an empty array if no listeners have been added

validate

public ValidationResult validate(int rowIndex,
                                 int columnIndex,
                                 Object oldValue,
                                 Object newValue)

addRowValidator

public void addRowValidator(RowValidator l)
Adds a RowValidator to the listener list.

Parameters:
l - the new listener to be added

removeRowValidator

public void removeRowValidator(RowValidator l)
Removes a RowValidator from the listener list.

Parameters:
l - the listener to be removed

getRowValidator

public RowValidator[] getRowValidator()
Returns an array of all the RowValidators added to this AbstractCellEditor with addValidationListener().

Returns:
all of the RowValidators added or an empty array if no listeners have been added

validateRow

public ValidationResult validateRow(int rowIndex)
Validates a row. It will use RowValidators added using addRowValidator(com.jidesoft.validation.RowValidator) to do the validation.

Parameters:
rowIndex - the row index.
Returns:
ValidationResult

editingStopped

public void editingStopped(ChangeEvent e)
Specified by:
editingStopped in interface CellEditorListener
Overrides:
editingStopped in class JTable

editingCanceled

public void editingCanceled(ChangeEvent e)
Specified by:
editingCanceled in interface CellEditorListener
Overrides:
editingCanceled in class JTable

fireEditingStopping

protected boolean fireEditingStopping(Object source,
                                      int row,
                                      int column)
Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.

Parameters:
source - the source of the event
row - the row index
column - the column index
Returns:
true or false. If all listeners return true in editingStarting(), it will return true. If one of the listener returns false, it will return false.

fireEditingStopped

protected void fireEditingStopped(Object source,
                                  int row,
                                  int column)
Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.

Parameters:
source - the source of the event
row - the row index
column - the column index
See Also:
EventListenerList

fireEditingCanceled

protected void fireEditingCanceled(Object source,
                                   int row,
                                   int column)
Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.

Parameters:
source - the source of the event
row - the row index
column - the column index
See Also:
EventListenerList

getRowHeights

public RowHeights getRowHeights()

createRowHeights

protected RowHeights createRowHeights()

setRowHeights

public void setRowHeights(RowHeights rowHeights)

isScrollRowWhenRowHeightChanges

public boolean isScrollRowWhenRowHeightChanges()
Checks the flag whether a row is scrolled to visible when its height changes.

Returns:
the scrollRowWhenRowHeightChanges flag.

setScrollRowWhenRowHeightChanges

public void setScrollRowWhenRowHeightChanges(boolean scrollRowWhenRowHeightChanges)
Sets the flag if the row should be scrolled to visible when the row height changes.

Parameters:
scrollRowWhenRowHeightChanges - true or false.

createRowAutoScrollingListener

protected RowHeightChangeListener createRowAutoScrollingListener()
Creates the RowHeightChangeListener which will automatically scroll the row then row height changes so that it is outside the visible area.

Returns:
a RowHeightChangeListener.

scrollRowToVisible

public void scrollRowToVisible(int row)
Scroll the row till the row is visible. If possible, it will try to make the row after it and the row before it visible too. By default, we will call TableUtils.ensureRowVisible(javax.swing.JTable, int) method. It will only scroll vertically to the exact location so that the row is fully visible.

This method is called automatically when row height changes. If isScrollRowWhenRowHeightChanges() is true, the row will automatically be scrolled to show the whole row when the height for that row changes. You can subclass it to scroll the table in a different way.

Parameters:
row - the row whose height changes.

setRowHeight

public void setRowHeight(int rowHeight)
Sets the height, in pixels, of all cells to rowHeight, re-validates, and repaints. The height of the cells will be equal to the row height minus the row margin.

Overrides:
setRowHeight in class JTable
Parameters:
rowHeight - new row height
Throws:
IllegalArgumentException - if rowHeight is less than 1 description: The height of the specified row.
See Also:
getRowHeight(int)

isBatchProcessing

protected boolean isBatchProcessing()
Checks if it is in batch processing. If yes, we should delay doLayout call to the end.

Returns:
true or false.

setBatchProcessing

protected void setBatchProcessing(boolean batchProcessing)
Sets to batch processing. This method should be used only when you want to expand or collapse several rows and you only want to doLayout once at the end.

Parameters:
batchProcessing - true or false.

setRowHeight

public void setRowHeight(int row,
                         int rowHeight)
Sets the height for row to rowHeight, re-validates, and repaints. The height of the cells in this row will be equal to the row height minus the row margin.

Overrides:
setRowHeight in class JTable
Parameters:
row - the row whose height is being changed
rowHeight - new row height, in pixels
Throws:
IllegalArgumentException - if rowHeight is less than 1 description: The height in pixels of the cells in row

calculateAutoResizedRowHeights

@Deprecated
protected void calculateAutoResizedRowHeights(int firstRow,
                                                         int lastRow)
Deprecated. replaced by #calculateRowHeight. This method will not be invoked while setRowAutoResizes(true). Please override #calculateRowHeight instead to calculate row height.

Parameters:
firstRow - the first row to be calculated
lastRow - the last row to be calculated

calculateAutoResizedRowHeights

@Deprecated
protected void calculateAutoResizedRowHeights()
Deprecated. replaced by #calculateRowHeight. This method will not be invoked while setRowAutoResizes(true). Please override #calculateRowHeight instead to calculate row height.


calculateRowHeight

protected int calculateRowHeight(int row)
The method calculates the height for the row based on the content in the row.

The method will not change the row height of the designated row.

Parameters:
row - the row to be calculated
Returns:
new height appropriate for the row.

isRowHeightChanged

protected boolean isRowHeightChanged(int row,
                                     int newHeight)
The method will check if the new height is different with current height. The method is called by TableUtils.autoResizeRow(javax.swing.JTable, int, int).

Parameters:
row - the row to be checked
newHeight - new height of the row, most likely from calculateRowHeight(int)
Returns:
True if current row height is not the same with the new height. Otherwise false.

getRowHeight

public int getRowHeight(int row)
Overrides:
getRowHeight in class JTable

rowAtPoint

public int rowAtPoint(Point point)
Returns the index of the row that point lies in, or -1 if the result is not in the range [0, getRowCount()-1].

Overrides:
rowAtPoint in class JTable
Parameters:
point - the location of interest
Returns:
the index of the row that point lies in, or -1 if the result is not in the range [0, getRowCount()-1]
See Also:
JTable.columnAtPoint(java.awt.Point)

getCellRect

public Rectangle getCellRect(int row,
                             int column,
                             boolean includeSpacing)
Overrides:
getCellRect in class JTable

getEditorCellRect

public Rectangle getEditorCellRect(int rowIndex,
                                   int columnIndex)
In TreeTable and HierarchicalTable case, the cell rect for cell editor should consider the +/- icon size so the cell editor doesn't cover the +/- icon. In order to do it, we introduce EditorCellRect concept. By default, it is same as getCellRect(rowIndex, columnIndex, false). TreeTable and HierarchicalTable will override it to provide a different rect for cell editor.

Parameters:
rowIndex - the row index.
columnIndex - the column index
Returns:
the cell rect for the cell editor.

createDefaultColumnsFromModel

public void createDefaultColumnsFromModel()
Overrides:
createDefaultColumnsFromModel in class JTable

setKeepRowHeights

public void setKeepRowHeights(boolean keepRowHeights)
Set if you want to keep row heights after table events, such as sorting and filtering.

See isKeepRowHeights()

Parameters:
keepRowHeights - the flag that if the table will keep the row heights

isKeepRowHeights

public boolean isKeepRowHeights()
Get if you want to keep row heights after table events, such as sorting and filtering.

If you set this flag to true, you could keep row heights after sorting and filtering. However, it will hit the performance a little bit. So if you have a large table and don't care about the row heights, you could set this flag to false.

The default value is true.

Returns:
the flag that if the table will keep the row heights.

isLoadSelectionOnTableDataChanged

public boolean isLoadSelectionOnTableDataChanged()
Gets the flag indicating if JideTable should load selection if it receives a table model event which indicates a table data changed event is fired from its original table model.

Returns:
true if selection should be loaded. Otherwise false.
See Also:
setLoadSelectionOnTableDataChanged(boolean)

setLoadSelectionOnTableDataChanged

public void setLoadSelectionOnTableDataChanged(boolean loadSelectionOnTableDataChanged)
Sets the flag indicating if JideTable should load selection if it receives a table model event which indicates a table data changed event is fired from its original table model.

By default, the flag is false to improve performance. It should work for most scenario since firing table data changed event means the table contents are refreshed and no selection needs to be kept. However, if you don't mind about the performance and want to simplify the event you fire from original table model, please set this flag to true.

Parameters:
loadSelectionOnTableDataChanged - the flag

isFillsRight

public boolean isFillsRight()
Gets the flag indicating if the area right to the JideTable in the viewport will be filled.

Returns:
true if the area to be filled. Otherwise false.
Since:
3.3.0
See Also:
setFillsRight(boolean)

setFillsRight

public void setFillsRight(boolean fillsRight)
Sets the flag indicating if the area right to the JideTable in the viewport will be filled.

By default the value is true. This flag takes effect only if JTable.getAutoResizeMode() includes AUTO_RESIZE_FILL

Parameters:
fillsRight - the flag
Since:
3.3.0

isFillsBottom

public boolean isFillsBottom()
Gets the flag indicating if the area below the JideTable in the viewport will be filled.

Returns:
true if the area to be filled. Otherwise false.
Since:
3.3.0
See Also:
setFillsBottom(boolean)

setFillsBottom

public void setFillsBottom(boolean fillsBottom)
Sets the flag indicating if the area below the JideTable in the viewport will be filled.

By default the value is true. This flag takes effect only if JTable.getAutoResizeMode() includes AUTO_RESIZE_FILL

Parameters:
fillsBottom - the flag
Since:
3.3.0

isFillsGrids

public boolean isFillsGrids()
Gets the flag indicating if the area below the JideTable in the viewport will be filled with grids.

Returns:
true if the are to be filled. Otherwise false.
Since:
3.3.0
See Also:
setFillsGrids(boolean)

isFillsGridsBottom

protected boolean isFillsGridsBottom()
Gets the flag indicating if the area bottom to the JideTable in the viewport will be filled with grids.

By default, it returns isFillsBottom() && isFillsGrids().

Returns:
true if the are to be filled. Otherwise false.
Since:
3.3.0
See Also:
setFillsGrids(boolean)

isFillsGridsRight

protected boolean isFillsGridsRight()
Gets the flag indicating if the area right to the JideTable in the viewport will be filled with grids.

By default, it returns isFillsRight().

Returns:
true if the are to be filled. Otherwise false.
Since:
3.3.0
See Also:
setFillsGrids(boolean)

setFillsGrids

public void setFillsGrids(boolean fillsGrids)
Sets the flag indicating if the area below the JideTable in the viewport will be filled with grids.

By default the value is true. This flag takes effect only if JTable.getAutoResizeMode() includes AUTO_RESIZE_FILL and setFillsBottom(boolean) returns true

Parameters:
fillsGrids - the flag
Since:
3.3.0

isFillRight

@Deprecated
public boolean isFillRight()
Deprecated. replaced by isFillsRight()

Gets the flag indicating if the area right to the JideTable in the viewport will be filled.

Returns:
true if the are to be filled. Otherwise false.
See Also:
setFillsRight(boolean)

setFillRight

@Deprecated
public void setFillRight(boolean fillRight)
Deprecated. replaced by setFillsRight(boolean)

Sets the flag indicating if the area right to the JideTable in the viewport will be filled.

By default the value is true. This flag takes effect only if JTable.getAutoResizeMode() includes AUTO_RESIZE_FILL

Parameters:
fillRight - the flag

isFillBottom

@Deprecated
public boolean isFillBottom()
Deprecated. replaced by isFillsBottom()

Gets the flag indicating if the area below the JideTable in the viewport will be filled.

Returns:
true if the are to be filled. Otherwise false.
See Also:
setFillsBottom(boolean)

setFillBottom

@Deprecated
public void setFillBottom(boolean fillBottom)
Deprecated. replaced by setFillsBottom(boolean)

Sets the flag indicating if the area below the JideTable in the viewport will be filled.

By default the value is true. This flag takes effect only if JTable.getAutoResizeMode() includes AUTO_RESIZE_FILL

Parameters:
fillBottom - the flag

isFillGrids

@Deprecated
public boolean isFillGrids()
Deprecated. replaced by isFillsGrids()

Gets the flag indicating if the area below the JideTable in the viewport will be filled with grids.

Returns:
true if the are to be filled. Otherwise false.
See Also:
setFillsGrids(boolean)

setFillGrids

@Deprecated
public void setFillGrids(boolean fillGrids)
Deprecated. replaced by setFillsGrids(boolean)

Sets the flag indicating if the area below the JideTable in the viewport will be filled with grids.

By default the value is true. This flag takes effect only if JTable.getAutoResizeMode() includes AUTO_RESIZE_FILL and setFillsBottom(boolean) returns true

Parameters:
fillGrids - the flag

isAdjustEditorLocationOnModelChanged

public boolean isAdjustEditorLocationOnModelChanged()
Gets the flag that indicates if the cell editing should be kept when table model is changed.

Returns:
true if editing should be kept. Otherwise false.
Since:
3.4.8
See Also:
setAdjustEditorLocationOnModelChanged(boolean)

setAdjustEditorLocationOnModelChanged

public void setAdjustEditorLocationOnModelChanged(boolean keepEditing)
Sets the flag that indicates if the cell editing should be kept when table model is changed.

By default, the value is false to keep backward compatibility.

Parameters:
keepEditing - the flag
Since:
3.4.8

saveTableRowSettings

protected void saveTableRowSettings(boolean invokeOutside)
To save row heights and selections before you do some big work, like firing table data change event.

Please always make a pair call with loadTableRowSettings(boolean).

Parameters:
invokeOutside - always TRUE if you want to call this method explicitly. We will call this method with FALSE internally.

loadTableRowSettings

protected void loadTableRowSettings(boolean invokeOutside)
To load row heights and selections after you do some big work, like firing table data change event.

Please always make a pair call with saveTableRowSettings(boolean).

Parameters:
invokeOutside - always TRUE if you want to call this method explicitly. We will call this method with FALSE internally.

indexChanged

public void indexChanged(IndexChangeEvent event)
Called whenever the table model wrapper is going to have some change. So far we have index changing and index changed events.

Specified by:
indexChanged in interface IndexChangeListener
Parameters:
event - the table model wrapper event

tableChanged

public void tableChanged(TableModelEvent e)
Invoked when this table's TableModel generates a TableModelEvent. The TableModelEvent should be constructed in the coordinate system of the model; the appropriate mapping to the view coordinate system is performed by this JTable when it receives the event.

Application code will not use these methods explicitly, they are used internally by JTable.

Specified by:
tableChanged in interface TableModelListener
Overrides:
tableChanged in class JTable

createDefaultSelectionModel

protected ListSelectionModel createDefaultSelectionModel()
Overrides:
createDefaultSelectionModel in class JTable

isRowAutoResizes

public boolean isRowAutoResizes()
Checks if row automatically resizes with the cells preferred heights.

Returns:
true if it automatically resizes. Otherwise, false.

setRowAutoResizes

public void setRowAutoResizes(boolean rowAutoResizes)
Sets the rowAutoResizes attribute.

Parameters:
rowAutoResizes - true to enable rowAutoResizes. Otherwise false.

setSortTableHeaderRenderer

@Deprecated
protected void setSortTableHeaderRenderer()
Deprecated. replaced by StyledLabel based header renderer.

JideTable allows you to have multiple lines in table header. However this feature is turned off by default. If you want to have this feature, you can do this.

 JideTable table = new JideTable(model){
     protected void initTable() {
         super.initTable();
         setSortTableHeaderRenderer();
     }
 

protected JTableHeader createDefaultTableHeader() { return new JTableHeader(columnModel); } };

Now if you have a column name that has "\n" in it, it will split the text into multiple lines.


createSortHeaderRenderer

@Deprecated
protected SortTableHeaderRenderer createSortHeaderRenderer()
Deprecated. replaced by StyledLabel based header renderer.

Creates the header renderer. By default SortTableHeaderRenderer will be used. Subclass can override this method to create their own header renderer.

Returns:
the header renderer.

isNonContiguousCellSelection

public boolean isNonContiguousCellSelection()
Checks if the table selection model allows non-contiguous cell selection.

Returns:
true if the table selection model allows non-contiguous cell selection. If so, you can call getTableSelectionModel() to get the selection model and add listener to it. If false, getTableSelectionModel() will return null.

setNonContiguousCellSelection

public void setNonContiguousCellSelection(boolean nonContiguousCellSelection)
Sets the attribute of nonContiguousCellSelection. By default it's false.

Parameters:
nonContiguousCellSelection - true to enable non-contiguous cell selection.

setRowSelectionAllowed

public void setRowSelectionAllowed(boolean rowSelectionAllowed)
Description copied from interface: TableAdapter
Sets whether the rows can be selected.

Specified by:
setRowSelectionAllowed in interface TableAdapter
Overrides:
setRowSelectionAllowed in class JTable
Parameters:
rowSelectionAllowed - true if it will allow row selection

setColumnSelectionAllowed

public void setColumnSelectionAllowed(boolean columnSelectionAllowed)
Description copied from interface: TableAdapter
Sets whether the columns can be selected.

Specified by:
setColumnSelectionAllowed in interface TableAdapter
Overrides:
setColumnSelectionAllowed in class JTable
Parameters:
columnSelectionAllowed - true if it will allow column selection

createDefaultTableSelectionModel

public void createDefaultTableSelectionModel()
Creates a default TableSelectionModel.


setTableSelectionModel

public void setTableSelectionModel(TableSelectionModel tableSelectionModel)
Sets a new TableSelectionModel.

Parameters:
tableSelectionModel - the new TableSelectionModel.

getTableSelectionModel

public TableSelectionModel getTableSelectionModel()
Gets the table selection model. It will return a valid value only when isNonContiguousCellSelection() return true.

Returns:
the TableSelectionModel.

getSelectedRows

public int[] getSelectedRows()
Description copied from interface: TableAdapter
Returns the indices of all selected rows.

Specified by:
getSelectedRows in interface TableAdapter
Overrides:
getSelectedRows in class JTable
Returns:
an array of integers containing the indices of all selected rows, or an empty array if no row is selected
See Also:
TableAdapter.getSelectedRow()

getSelectedColumns

public int[] getSelectedColumns()
Description copied from interface: TableAdapter
Returns the indices of all selected columns.

Specified by:
getSelectedColumns in interface TableAdapter
Overrides:
getSelectedColumns in class JTable
Returns:
an array of integers containing the indices of all selected columns, or an empty array if no column is selected
See Also:
TableAdapter.getSelectedColumn()

getSelectedRow

public int getSelectedRow()
Description copied from interface: TableAdapter
Returns the index of the first selected row, -1 if no row is selected.

Specified by:
getSelectedRow in interface TableAdapter
Overrides:
getSelectedRow in class JTable
Returns:
the index of the first selected row

getSelectedColumn

public int getSelectedColumn()
Description copied from interface: TableAdapter
Returns the index of the first selected column, -1 if no column is selected.

Specified by:
getSelectedColumn in interface TableAdapter
Overrides:
getSelectedColumn in class JTable
Returns:
the index of the first selected column

getSelectedRowCount

public int getSelectedRowCount()
Description copied from interface: TableAdapter
Returns the number of selected rows.

Specified by:
getSelectedRowCount in interface TableAdapter
Overrides:
getSelectedRowCount in class JTable
Returns:
the number of selected rows, 0 if no rows are selected

getSelectedColumnCount

public int getSelectedColumnCount()
Description copied from interface: TableAdapter
Returns the number of selected columns.

Specified by:
getSelectedColumnCount in interface TableAdapter
Overrides:
getSelectedColumnCount in class JTable
Returns:
the number of selected columns, 0 if no columns are selected

isRowSelected

public boolean isRowSelected(int row)
Description copied from interface: TableAdapter
Returns true if the specified index is in the valid range of rows, and the row at that index is selected.

Specified by:
isRowSelected in interface TableAdapter
Overrides:
isRowSelected in class JTable
Parameters:
row - the row index
Returns:
true if row is a valid index and the row at that index is selected (where 0 is the first row)

isColumnSelected

public boolean isColumnSelected(int column)
Description copied from interface: TableAdapter
Returns true if the specified index is in the valid range of columns, and the column at that index is selected.

Specified by:
isColumnSelected in interface TableAdapter
Overrides:
isColumnSelected in class JTable
Parameters:
column - the column in the column model
Returns:
true if column is a valid index and the column at that index is selected (where 0 is the first column)

shouldCellBePaintedAsSelected

protected boolean shouldCellBePaintedAsSelected(int row,
                                                int column)
Subclass can override this method to determine if the cell should be painted as selected when selected. It is just an effect on the view. The cell is still selected in the selection model.

Parameters:
row - the row index.
column - the column index
Returns:
true to paint the cell as selected when it is selected. False to not paint.
Since:
3.3.7

shouldCellBePaintedAsFocused

protected boolean shouldCellBePaintedAsFocused(int row,
                                               int column)
Subclass can override this method to determine if the cell should be painted as focused cell when it is a focused cell. It is just an effect on the view. The cell is the anchor cell in the selection model.

Parameters:
row - the row index.
column - the column index
Returns:
true to paint the cell as focused when it is the focused cell. False to not paint.
Since:
3.3.7

isCellSelected

public boolean isCellSelected(int row,
                              int column)
Description copied from interface: TableAdapter
Returns true if the specified indices are in the valid range of rows and columns and the cell at the specified position is selected.

Specified by:
isCellSelected in interface TableAdapter
Overrides:
isCellSelected in class JTable
Parameters:
row - the row being queried
column - the column being queried
Returns:
true if row and column are valid indices and the cell at index (row, column) is selected, where the first row and first column are at index 0

isCalculateRowHeightsOnWidthChange

public boolean isCalculateRowHeightsOnWidthChange()
Get the flag indicating if JideTable should calculate row heights if column width is changed.

This flag will only take effect when isRowAutoResizes() returns true.

The default value of this flag is true.

Returns:
true if JideTable will calculate row heights if column width is changed. Otherwise false.

setCalculateRowHeightsOnWidthChange

public void setCalculateRowHeightsOnWidthChange(boolean calculateRowHeightsOnWidthChange)
Set the flag indicating if JideTable should calculate row heights if column width is changed.

Parameters:
calculateRowHeightsOnWidthChange - the flag

isAlwaysRequestFocusForEditor

public boolean isAlwaysRequestFocusForEditor()
Get the flag indicating if JideTable should always request focus for cell editor.

The default value for this flag is false, which improves the performance.

If you want the cell editor get focus immediately so that Add-ons like IntelliHint can take effect right after you press a key to start editing.

Returns:
the flag.

setAlwaysRequestFocusForEditor

public void setAlwaysRequestFocusForEditor(boolean alwaysRequestFocusForEditor)
Set the flag indicating if JideTable should always request focus for cell editor.

Parameters:
alwaysRequestFocusForEditor - the flag

isClearPropertyAtStructureChange

public boolean isClearPropertyAtStructureChange()
Get the flag indicating if JideTable should clear properties for table column orders.

By default, the value is true. However, for some special table like AggregateTable, we do need keep the status even if table structure change event is fired. In that case, we will set it to false.

Returns:
the flag

setClearPropertyAtStructureChange

public void setClearPropertyAtStructureChange(boolean clearPropertyAtStructureChange)
Set the flag indicating if JideTable should clear properties for table column orders.

Parameters:
clearPropertyAtStructureChange - the flag

paintCellUnderlay

public void paintCellUnderlay(Graphics g,
                              Component component,
                              int row,
                              int column,
                              Rectangle cellRect)
Paints the cell underlay. The cell underlay paints under the cell content. In the other word, this method is called first, then the cell renderer paints the cell content. At last, paintCellOverlay is called. Please note, if the cell renderer component has a background and is opaque, the cell content will full cover the cell underlay. So if you want to use the cell underlay, please make sure the renderer component is not opaque.

Parameters:
g - the Graphics
component - the component
row - the row index
column - the column index
cellRect - the cell rectangle of the cell at the specified row index and column index.

paintCellOverlay

public void paintCellOverlay(Graphics g,
                             Component component,
                             int row,
                             int column,
                             Rectangle cellRect)
Paints the cell overlay. The cell overlay paints after the cell content is painted. In the other word, the paintCellUnderlay method is called first, then the cell renderer paints the cell content. At last, this method is called.

Parameters:
g - the Graphics
component - the component
row - the row index
column - the column index
cellRect - the cell rectangle of the cell at the specified row index and column index.

isEnableIgnored

public boolean isEnableIgnored()
Get the flag indicating if the cell will be painted with normal text color even the table is disabled. JTable doesn't respect enabled flag. There is a bug reported on it at http://bugs.sun.com/view_bug.do?bug_id=4113508 but Sun probably will not fix it. We fixed in JideTable. However if you prefer to keep the old JTable behavior, you can call setEnableIgnored(boolean) and set it to true.

The default value is false.

Returns:
the flag.

setEnableIgnored

public void setEnableIgnored(boolean enableIgnored)
Set the flag indicating if the cell will be painted with the normal text color even the table is disabled.

Parameters:
enableIgnored - the flag

isRollover

public boolean isRollover()
Checks if there is a rollover cell editor created by rolloverCellAt(int, int).

Returns:
true if having rollover editor.

getRolloverCellEditor

public TableCellEditor getRolloverCellEditor()
Gets the cell editor created by rolloverCellAt(int, int).

Returns:
the cell editor.

getRolloverRow

public int getRolloverRow()
Gets the row index that has the rollover cell editor.

Returns:
the row index.

getRolloverColumn

public int getRolloverColumn()
Gets the column index that has the rollover cell editor.

Returns:
the column index.

rolloverCellAt

public boolean rolloverCellAt(int row,
                              int column)
Makes the cell enters editing mode without forcing the other cell editor, if any, to stop editing.

Parameters:
row - the row index.
column - the column index.
Returns:
true if the action is successful.

removeRolloverEditor

public void removeRolloverEditor()
Removes the rollover cell editor created by rolloverCellAt(int, int).


editCellAt

public boolean editCellAt(int row,
                          int column,
                          EventObject e)
Overrides:
editCellAt in class JTable

isValidCellEditingKey

protected boolean isValidCellEditingKey(KeyEvent keyEvent)
Checks if the key event is a valid keystroke to start cell editing. Subclass can override it. Here is the default implementation.
 if (keyEvent.getKeyCode() == KeyEvent.VK_ESCAPE || keyEvent.getKeyCode() == KeyEvent.VK_DELETE ||
 keyEvent.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
     return false;
 }
 else if(keyEvent.getKeyCode() == KeyEvent.VK_F2) {
     return true;
 }
 else if(keyEvent.getKeyCode() >= KeyEvent.VK_F1 && keyEvent.getKeyCode() <= KeyEvent.VK_F24) {
     return false;
 }

 return true;
 

Parameters:
keyEvent - the key event
Returns:
true if it is a valid key. Otherwise false.

clearSelectionPermanently

public void clearSelectionPermanently()
Clear the selections permanently without being restored later on.


clearSelection

public void clearSelection()
Overrides:
clearSelection in class JTable

setRowSelectionInterval

public void setRowSelectionInterval(int index0,
                                    int index1)
Overrides:
setRowSelectionInterval in class JTable

setColumnSelectionInterval

public void setColumnSelectionInterval(int index0,
                                       int index1)
Overrides:
setColumnSelectionInterval in class JTable

addRowSelectionInterval

public void addRowSelectionInterval(int index0,
                                    int index1)
Overrides:
addRowSelectionInterval in class JTable

addColumnSelectionInterval

public void addColumnSelectionInterval(int index0,
                                       int index1)
Overrides:
addColumnSelectionInterval in class JTable

removeRowSelectionInterval

public void removeRowSelectionInterval(int index0,
                                       int index1)
Overrides:
removeRowSelectionInterval in class JTable

removeColumnSelectionInterval

public void removeColumnSelectionInterval(int index0,
                                          int index1)
Overrides:
removeColumnSelectionInterval in class JTable

changeSelection

public void changeSelection(int rowIndex,
                            int columnIndex,
                            boolean toggle,
                            boolean extend)
Description copied from interface: TableAdapter
Updates the selection models of the table, depending on the state of the two flags: toggle and extend. Most changes to the selection that are the result of keyboard or mouse events received by the UI are channeled through this method so that the behavior may be overridden by a subclass. Some UIs may need more functionality than this method provides, such as when manipulating the lead for discontiguous selection, and may not call into this method for some selection changes.

This implementation uses the following conventions:

Specified by:
changeSelection in interface TableAdapter
Overrides:
changeSelection in class JTable
Parameters:
rowIndex - affects the selection at row
columnIndex - affects the selection at column
toggle - see description above
extend - if true, extend the current selection

columnSelectionChanged

public void columnSelectionChanged(ListSelectionEvent e)
Specified by:
columnSelectionChanged in interface TableColumnModelListener
Overrides:
columnSelectionChanged in class JTable

getDirtyRegion

protected Rectangle getDirtyRegion(int firstRow,
                                   int firstColumn,
                                   int lastRow,
                                   int lastColumn)
Gets the dirty region from the first row, first column and last row, last column.

Parameters:
firstRow - the first row
firstColumn - the first column
lastRow - the last row
lastColumn - the last column
Returns:
the dirty region that covers the first cell and the last cell.
Since:
3.3.7

addColumn

public void addColumn(TableColumn column)
Overrides this method to skip the column that is being added when the column was hidden earlier by TableColumnChooser.hideColumn(javax.swing.JTable, int) method.

Overrides:
addColumn in class JTable
Parameters:
column - the TableColumn to be added.

removeColumn

public void removeColumn(TableColumn aColumn)
Overrides:
removeColumn in class JTable

adjustSelectionWhenColumnMoved

public void adjustSelectionWhenColumnMoved(int column,
                                           int targetColumn)
Usually you don't need to call this method. But if you use non-contiguous cell selection feature and use your own TableColumnModel that is created by JTable, you should call this method in TableColumnModel's moveColumn implementation so that the selection can be adjusted when column is moved.

Parameters:
column - the column index
targetColumn - the target column index.

releaseRendererComponent

public void releaseRendererComponent(TableCellRenderer renderer,
                                     int row,
                                     int column,
                                     Component component)

prepareRenderer

public Component prepareRenderer(TableCellRenderer renderer,
                                 int row,
                                 int column)
Overrides:
prepareRenderer in class JTable

getDefaultRenderer

public TableCellRenderer getDefaultRenderer(Class<?> columnClass)
Overrides:
getDefaultRenderer in class JTable

getSelectionBackground

public Color getSelectionBackground()
Overrides:
getSelectionBackground in class JTable

isColumnAutoResizable

public boolean isColumnAutoResizable()
Checks if the column is auto-resizable. If the column is auto-resizable, user can double click on the grid line on table header and the table column will automatically resize to fit in the content of all the cells in that column.

Returns:
true if the column is auto-resizable.

setColumnAutoResizable

public void setColumnAutoResizable(boolean resizable)
Enable or disable the column auto-resizable. Please note, you need to call this method again if you change your table header as this method call will install a listener on the table header if resizable is true.

Parameters:
resizable - true to make column auto-resizable.

isColumnResizable

public boolean isColumnResizable()
Checks if the column is resizable by dragging the vertical grid line.

Returns:
true if the column is resizable by dragging the vertical grid line.

setColumnResizable

public void setColumnResizable(boolean resizable)
Enable or disable the column resizable. If column is resizable, user can drag the vertical grid line to resize the column.

Parameters:
resizable - true to make column resizable.

isRowResizable

public boolean isRowResizable()
Checks if the row is resizable by dragging the horizontal grid line.

Returns:
true if the row is resizable by dragging the horizontal grid line.

setRowResizable

public void setRowResizable(boolean resizable)
Enable or disable the row resizable. If row is resizable, user can drag the horizontal grid line to resize the row.

Parameters:
resizable - true to make row resizable.

selectAll

public void selectAll()
Overrides:
selectAll in class JTable

getToolTipText

public String getToolTipText(MouseEvent event)
Overrides:
getToolTipText in class JTable

isTablePrinting

public boolean isTablePrinting()
Checks if the table is printing.

Returns:
true if the table is printing.

setTablePrinting

public void setTablePrinting(boolean tablePrinting)
Sets the table as printing. If the table is printing, prepareRenderer method will not consider the cell selection.

Parameters:
tablePrinting - true to indicate the table is being printed.

isVariousRowHeights

public boolean isVariousRowHeights()
Is the table has various row height on each row. There is no setter for this property. The only way to change it is to override to return a different value. We did this way because we don't think a table should by nature either has various row heights or the same row heights. So you should know beforehand if the table has the same or different row heights thus overriding is a better way.

For example, in the case of HierarchicalTable, we override it to always return true.

Returns:
true if isRowAutoResizes() is true.

setVariousRowHeights

public void setVariousRowHeights(boolean variousRowHeights)
Sets variousRowHeights. Calling the method will change the heights of visible rows immediately if necessary. If variousRowHeights is false, all rows will have the same row height. This is used when user tries to resize a row when setRowResizable(true) is called. If variousRowHeights is false, we will make all rows the same height after user resizes a row.

Parameters:
variousRowHeights - true or false

createDefaultTransferHandler

protected TransferHandler createDefaultTransferHandler()
Creates default TransferHandler.

Returns:
the default TransferHandler instance.
Since:
3.3.4

isSelectInsertedRows

public boolean isSelectInsertedRows()
Returns the selectInsertedRows flag. If true, the newly inserted rows, if it is just above the existing selected row, will be selected automatically. By default, this is true.

Returns:
true or false.

setSelectInsertedRows

public void setSelectInsertedRows(boolean selectInsertedRows)
Sets the selectInsertedRow flag. If true, the newly inserted row, if it is just above the existing selected row, will be selected automatically. By default, this is true.

Parameters:
selectInsertedRows - true or false.

isClearSelectionOnTableDataChanges

@Deprecated
public boolean isClearSelectionOnTableDataChanges()
Deprecated. replaced by isLoadSelectionOnTableDataChanged().

Checks if the selection should be cleared when tableDataChanged event is received. It will clear the selections even if the event is caused by sorting/filtering/grouping, etc.

Returns:
true if the selection is cleared when the tableDataChanged event is received. Otherwise, false. Default is false.

setClearSelectionOnTableDataChanges

@Deprecated
public void setClearSelectionOnTableDataChanges(boolean clearSelectionOnTableDataChanges)
Deprecated. replaced by setLoadSelectionOnTableDataChanged(boolean).

Sets the clearSelectionOnTableDataChanges attribute.

Parameters:
clearSelectionOnTableDataChanges - true to clear selection when table data changed event is received.

valueChanged

public void valueChanged(ListSelectionEvent e)
Specified by:
valueChanged in interface ListSelectionListener
Overrides:
valueChanged in class JTable

setClickCountToStart

public void setClickCountToStart(int count)
Specifies the number of clicks needed to start editing.

Parameters:
count - an int specifying the number of clicks needed to start editing
See Also:
getClickCountToStart()

getClickCountToStart

public int getClickCountToStart()
Returns the number of clicks needed to start editing.

Returns:
the number of clicks needed to start editing

getGridColorProvider

public GridColorProvider getGridColorProvider()
Gets the GridColorProvider to provide the grid line colors.

Returns:
the GridColorProvider.

setGridColorProvider

public void setGridColorProvider(GridColorProvider gridColorProvider)
Sets a GridColorProvider to provide the grid line colors.

Parameters:
gridColorProvider - the GridColorProvider.

getGridColor

public Color getGridColor(int row)
Gets the grid line color for each row.

Parameters:
row - the row index.
Returns:
the color for that row. Null if using the default grid color.

getVerticalGridColor

public Color getVerticalGridColor(int column)
Gets the grid line color for each column.

Parameters:
column - the column index.
Returns:
the color for that row. Null if using the default grid color.

getTableColumnWidthKeeper

public TableColumnWidthKeeper getTableColumnWidthKeeper()

setTableColumnWidthKeeper

public void setTableColumnWidthKeeper(TableColumnWidthKeeper tableColumnWidthKeeper)

setPreferredSize

public void setPreferredSize(Dimension preferredSize)
Overrides:
setPreferredSize in class JComponent

isAutoStartCellEditing

public boolean isAutoStartCellEditing()
Checks if the navigation key stroke will start cell editing. By default the navigation key strokes are tab and enter keys.

Returns:
true or false.

setAutoStartCellEditing

public void setAutoStartCellEditing(boolean autoStartCellEditing)
Sets the flag if the navigation key stroke will start cell editing.

Parameters:
autoStartCellEditing - true or false.

isAutoStartCellEditingKey

protected boolean isAutoStartCellEditingKey(KeyStroke ks)
Checks if the key stroke will trigger the cell editing. By default, we allow tab key and enter key to start cell editing automatically if isAutoStartCellEditing() is true.

Parameters:
ks - the key stroke
Returns:
true or false.

addNotify

public void addNotify()
Overrides:
addNotify in class JTable

removeNotify

public void removeNotify()
Overrides:
removeNotify in class JTable

removeEditor

public void removeEditor()
Override to regain focus on JTable when the AbstractComboBox's popup panel has focus. This special case is skipped by removeEditor method in JTable.

Overrides:
removeEditor in class JTable

isAutoSelectTextWhenStartsEditing

public boolean isAutoSelectTextWhenStartsEditing()
Checks if the text in the cell editor will be selected when cell starts editing. For example, if the cell editor is a JTextField, we will select the text when user presses any key to start cell editing. It will work if the cell editor component is JTextComponent, JComboBox, AbstractComboBox or JSpinner. For all other custom cell editors, you would need to override getTextComponentForEditorComponent(java.awt.Component) to return the JTextComponent that you would like the text to be selected.

Default is true.

Returns:
true to select the cell content when starts cell editing. Otherwise false.

setAutoSelectTextWhenStartsEditing

public void setAutoSelectTextWhenStartsEditing(boolean autoSelectTextWhenStartsEditing)
Sets the flag if the text in the cell editor will be selected when starts editing. For example, if the cell editor is a JTextField, we will select the text when user presses any key to start cell editing. It will work if the cell editor component is JTextComponent, JComboBox, AbstractComboBox or JSpinner. For all other custom cell editors, you would need to override getTextComponentForEditorComponent(java.awt.Component) to return the JTextComponent that you would like the text to be selected.

Default is true.

Parameters:
autoSelectTextWhenStartsEditing - true or false.

convertRowIndexToView

public int convertRowIndexToView(int modelRowIndex)
Overrides this methods so that it is available for pre-JDK6 environment. For JDK6, this method will call super.convertRowIndexToView(modelRowIndex). For pre-JDK, it will simply return modelRowIndex. We do so because we want to make sure we still get the correct row index in case user uses the JTable's built-in sorting feature in JDK. In fact, since we have sorting feature already in JIDE Grids and is faster and a lot of more flexible than JTable's built-in sorting, we suggest you to use our sorting instead.

Please note, this method has nothing to do with our sorting and filtering if you want to convert the row index. The correct way to convert row index is TableModelWrapperUtils's getRowAt method.

Overrides:
convertRowIndexToView in class JTable
Parameters:
modelRowIndex - the model row index.
Returns:
the view row index.

convertRowIndexToModel

public int convertRowIndexToModel(int viewRowIndex)
Overrides this methods so that it is available for pre-JDK6 environment. For JDK6, this method will call super.convertRowIndexToModel(modelRowIndex). For pre-JDK, it will simply return viewRowIndex. We do so because we want to make sure we still get the correct row index in case user uses the JTable's built-in sorting feature in JDK. In fact, since we have sorting feature already in JIDE Grids and is faster and a lot of more flexible than JTable's built-in sorting, we suggest you to use our sorting instead.

Please note, this method has nothing to do with our sorting and filtering if you want to convert the row index. The correct way to convert row index is TableModelWrapperUtils's getActualRowAt method.

Overrides:
convertRowIndexToModel in class JTable
Parameters:
viewRowIndex - the view row index.
Returns:
the model row index.

alwaysCalculateCellRect

public boolean alwaysCalculateCellRect()
A boolean flag to determine if the rect should always be calculated when painting the grid line and cells. If false, it will calculate the rect for the first column once and then add the column width to determine the next column cell rect. It returns false in JideTable but subclass can return true (such as in TreeTable and HierarchicalTable case).

Returns:
false by default.

isCellContentVisible

public boolean isCellContentVisible()
Checks if the table cell content will be painted.

Returns:
true if the table cell content will be painted. Otherwise false.

setCellContentVisible

public void setCellContentVisible(boolean cellContentVisible)
Sets the cell content visible or invisible. The reason we need this method is because we want to prevent the cell from being displayed in certain cases. For example, when the table is being scrolled, we don't want the cells being displayed when they are quickly scrolled over. Only when the scroll is done, we show the cells.

Parameters:
cellContentVisible - true or false.

configureEnclosingScrollPaneExplicitly

public void configureEnclosingScrollPaneExplicitly()

setEnabled

public void setEnabled(boolean enabled)
Overrides:
setEnabled in class JComponent

getEditorAutoCompletionMode

protected int getEditorAutoCompletionMode(int rowIndex,
                                          int columnIndex)
Gets the editor auto-completion mode for the cell.

By default, it simply returns getEditorAutoCompletionMode(). However, if you don't want to have auto completion for some columns/rows/cells, you could override this method to customize the behavior.

Parameters:
rowIndex - the row index
columnIndex - the column index
Returns:
the editor auto-completion mode.
Since:
3.1.1

getEditorAutoCompletionMode

public int getEditorAutoCompletionMode()
Gets the editor auto-completion mode.

Returns:
the editor auto-completion mode.

setEditorAutoCompletionMode

public void setEditorAutoCompletionMode(int editorAutoCompletionMode)
Sets the editor auto-completion mode. JideTable has a feature to enable the cell editor auto-completion. When it is turned on, typing a cell editor that has a text field will automatically complete the rest of the values based on the existing values from the same column (or the same row, or the whole table).

Parameters:
editorAutoCompletionMode - the editor auto-completion mode.

isCellFocused

protected boolean isCellFocused(int rowIndex,
                                int columnIndex)
Check if the cell is a focused cell inside the table.

Parameters:
rowIndex - the row index of the cell
columnIndex - the column index of the cell
Returns:
true if the cell is focused. Otherwise false.

getValueAt

public Object getValueAt(int row,
                         int column)
Description copied from interface: TableAdapter
Returns the cell value at row and column.

Note: The column is specified in the table view's display order, and not in the TableModel's column order. This is an important distinction because as the user rearranges the columns in the table, the column at a given index in the view will change. Meanwhile the user's actions never affect the model's column ordering.

Specified by:
getValueAt in interface TableAdapter
Overrides:
getValueAt in class JTable
Parameters:
row - the row whose value is to be queried
column - the column whose value is to be queried
Returns:
the Object at the specified cell

getUndoManager

public UndoManager getUndoManager()
Gets the undo manager.

Returns:
the undo manager
Since:
3.3.4

addUndoableEditListener

public void addUndoableEditListener(UndoableEditListener listener)
Adds the undoable edit listener.

Parameters:
listener - the listener
Since:
3.3.4

removeUndoableEditListener

public void removeUndoableEditListener(UndoableEditListener listener)
Removes the undoable edit listener.

Parameters:
listener - the listener
Since:
3.3.4

addUndo

public void addUndo(UndoableEdit edit)
Adds an undoable edit to JideTable for further undo/redo.

Parameters:
edit - the UndoableEdit
Since:
3.3.4

JIDE 3.5.15