borland Packages Class Hierarchy dbswing Package
java.lang.Object +----java.awt.Component +----java.awt.Container +----javax.swing.JComponent +----javax.swing.JTable +----com.borland.dbswing.JdbTable
Variables Constructors Properties Methods Event Listeners
Implements AccessListener, DataChangeListener, DataSetAware, NavigationListener, ActionListener, KeyListener, MouseListener, ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, CellEditorListener, ListSelectionListener, TableColumnModelListener, TableModelListener, Scrollable
JdbTable
is a data-aware extension of JTable
that adds support for these features:
DataSet
s)
TableCell
editors and renderers
DataSet
)
DataSet
navigation.
As with other dbSwing controls, JdbTable
allows you to set display properties on the component, but when properties are not set, values are inherited from the Column
s of the DataSet
to which the table is bound.
JdbTable
enhances JTable
, its corresponding Swing component, by adding
the ability to easily display and edit data from a DataExpress DataSet
. DataSet
s
are row-oriented: you are always positioned at one row, you can only edit that row, and your edits must pass validation checks before you can move to a new row. JdbTable
is optimized to handle database data, and this specialization brings with it a number of changes from JTable
:
JdbTable
. By default, selection is limited to a single cell and only that cell is highlighted. Optionally, you can select an entire row, but you still edit one cell at a time.
JdbTable
adds display and edit masks for more powerful display and editing
of database data types.
Navigation and editing keystrokes strengthen the notion of entering and exiting edit mode. Edit masks are invoked when editing begins and field-level validation is done when it ends. Row-level validation is done when you move to a new row. This validation detects and rejects data that would violate database constraints as soon as it is entered.
By default, JdbTable
displays all the Column
s of the DataSet
it is bound
to in the order they appear in the DataSet
. Its hiddenColumns
and customizedColumns
properties let you hide and reorder Column
s.
JdbTable
provides default cell renderers and editors more geared to database data types.
A popup menu lets you sort the table, insert and delete rows, and perform other operations.
JdbTable
's dataSet
property is set or its model is connected to a DataSet
. It is possible to use a JdbTable
without using a DataSet
, populating it as you would a JTable
and getting some extra behavior that JTable
does not provide. However, it is much more common to populate a JdbTable
from a DataSet
.
Like other scrollable Swing and dbSwing components, JdbTable
will not be scrollable unless it is placed in the viewport area of a TableScrollPane
or JScrollPane
. Also, it won't have row and column headers because the headers are actually added to the header area of the scroll pane. dbSwing's TableScrollPane
, an extension of JScrollPane
, includes options that speed up scrolling, especially in large tables.
DataSet
, JBuilder checks that the new value can be parsed to the expected data type and that it satisfies any validation checks (minimum value, for example) defined for its Column
. If the value passes these tests, it can be "put." If it fails, an error message is displayed and the field remains in edit mode.
JdbTable
supports the DataSet
's focus on validating one field value at a time by
restricting editing to a single cell and highlighting that cell. When you're done editing a field value, use Enter or Tab to invoke end-edit processing.
JBuilder also performs row-level validation, checking, for example, that all required columns have non-blank values and that columns for which the DataSet
has unique indexes do not contain values that duplicate existing rows. Again, an error message is displayed if these checks fail.
If the checks pass, all new and modified field values are saved to the DataSet
; the row is "posted." JdbTable
supports the DataSet
's row-level validation by refusing to navigate to a new row if changes to the current row can't be posted.
To select an entire row in a JdbTable
, set its rowSelectionAllowed
property to
true
and its cellSelectionEnabled
property to false
. If you find that
the visual indication that a cell has focus is too subtle, you can use the editableFocusedCellForeground
and editableFocusedCellBackground
properties to distinguish it.
The following list summarizes JdbTable
's navigation and editing keystrokes:
Use Ctrl+Tab or Shift+Ctrl+Tab to move out of the table to the next or previous component.
Press Home or End to move to the first or last cells of the row and Ctrl+Home or Ctrl+End to move to the top or bottom of the column.
Begin typing to append to the value in the current cell, or use Ctrl+Enter to place a text cursor in the cell. At this point, Left, Right, Home, and End move within the current cell.
Press Enter, Tab, or Shift+Tab to end editing in the cell. If the value is invalid, a message will be displayed on the JdbStatusLabel
or in an
error dialog, and the cell will remain in edit mode.
Press Escape to cancel, leaving the cell's value as it was before you began editing.
JdbTable
by the values in a column, click that column's header. To toggle between ascending and descending order, click the header again. You can also right-click anywhere in the data of a JdbTable
to open a popup menu
of row operations. In addition to selecting a column to sort by, you can
return to the DataSet
's original, unsorted order.
JBuilder, like most database
servers, appends newly inserted rows at the end of a DataSet
. In "<unsorted>" order, a new row will "fly away" to the end of the DataSet
when you navigate off it or post it.
To insert a new row into a JdbTable
, use Ctrl+Ins. Columns that have default values defined will contain those values and all other columns will be empty. If you navigate off a row that has only blank or default values, it will be discarded. To delete a row, use Ctrl+Del. You can also
use the popup menu to insert and delete rows. Insert and delete operations
may be disallowed by the DataSet
.
JdbNavToolBar
is very often used with JdbTable
. JdbNavToolBar
automatically detects and binds to the active component's DataSet
. It can be used to navigate, insert and delete rows, and save DataSet
changes back to a server, and also provides visual indications of editing status and row position.
JdbTable
is only a starting point. JTable
has many properties that customize how it looks and works,
and JdbTable
adds others. Here are some appearance changes that are easy to make:
Column headers: By default, a JdbTable
has a column header with black text on a gray background. Each column's default text is the caption
property of the corresponding DataSet
Column
. To change the text, set the caption
property. To display several lines of text in a column header, separate them with newline characters, '\n', in the Column
's caption. To hide column headers, set the columnHeaderVisible
property to false
.
You can also change the color or font of the column header or disallow rearrangement of columns at runtime with code like this:
myJdbTable.getTableHeader().setBackground(Color.cyan); myJdbTable.getTableHeader().setReorderingAllowed(false);
Row headers: By default, the leftmost column of a JdbTable
displays row numbers. You can suppress it by setting the rowHeaderVisible
property to false
.
Grid properties: By default, table cells are separated horizontally and vertically by thin gray lines. To change their color, set the gridColor
property. To hide grid lines, set the showHorizontalLines
property and/or the showVerticalLines
property to false
. To alter the margin between cell values and the grid, set the intercellSpacing
property. This property requires two integers, the horizontal and vertical margins in pixels.
Table cell properties: To customize cells in the table, you can set
the font
, foreground
, background
, selectionForeground
, selectionBackground
,
editableFocusedCellForeground
and editableFocusedCellBackground
properties, among others.
JdbTable
If you don't want to display all of a DataSet
's Column
s, use JdbTable
's hiddenColumns
property. This property can't be set in JBuilder's UI designer because it takes an array, but the code is easy, for example:
myJdbTable.setHiddenColumns(new int[] { 5, 6, 8 } );where 5, 6, and 8 are the ordinals (counting from 0) of the data set columns that should not be displayed. Put this code in
jbInit()
. To reset, pass null
instead of an array of ints.
JdbTable
JdbTable
's customColumns
property associates TableColumn
objects with columns of a JdbTable
. The TableColumns
may be customized, or they may be used only to control the order of columns in the JdbTable
.
In order to describe customized columns, first note the three types of columns:
DataSet
's Column
objects.
Column
is the name of a class in the com.borland.dx.dataset
package. Many Column
properties affect how their data is displayed, so most customization can be done by setting Column
properties. This customization applies to any component that displays the Column
's data, which is not always what you want.
The columns of the JdbTable
.
Each DataSet
Column
- except those that are not visible or are excluded by JdbTable
's hiddenColumns
property - is displayed in a column in the JdbTable
component. By default, DataSet
Column
s are matched in left-to-right order with JdbTable
columns.
The javax.swing.table.TableColumn
objects in a JdbTable
's TableColumnModel
.
Instead of letting JdbTable
create default TableColumn
objects, you can instantiate one or more TableColumn
s, set their modelIndex
properties to associate them with DataSet
Column
s, and pass them to a JdbTable
by setting its customColumns
property. (To determine the model index, count only the visible data set Column
s, not those that are hidden or not visible, starting from zero.) These TableColumn
objects provide another way to customize the table's appearance. This customization only affects the JdbTable
that owns the TableColumn
s.
As part of the call to setCustomColumns
, you include an array of numbers that specify the column of the table in which to display each TableColumn
. To reorder columns in a JdbTable
, you define a TableColumn
for each column you want to move and set its value in this array appropriately. To accept a TableColumn
's default position, use -1. Instead of reordering columns, or in addition, you can modify a JdbTable
by setting properties on your TableColumn
s.
Properties include:
minWidth
- maxWidth
- resizable
- cellEditor
- cellRenderer
The customColumns
property does not require a DataExpress DataSet
. You can fill a JdbTable
with data from
another source by setting its model property to any TableModel
, then take advantage of customColumns
and other JdbTable
features that enhance display and runtime manipulation of data.
The customColumns
property cannot be set through JBuilder's UI designer but some preparation can be done in the designer. Use the BeanChooser to select a javax.swing.table.TableColumn
object, drop it into a design, and set its modelIndex
property. If this TableColumn
is being used only to set the position of a column in a JdbTable
, no other properties need be set. Otherwise, the TableColumn
may be customized by setting other properties. You must code the actual call to setCustomColumns()
because it takes a CustomColumnsDescriptor
, which can't be
manipulated in the designer. See the online Help or source code for JdbTable
's setCustomColumns()
method for an example.
TableColumn
properties and hiding and reordering JdbTable
columns will not be shown in the UI designer.
JTable
defines simple default renderers of type DefaultTableCellRenderer
for numeric, boolean, image, icon, and object columns. JdbTable
usually replaces JTable
's defaults with renderers and editors from the dbSwing package that perform better and support display and edit masks. However, if you explicitly set a column's renderer or editor, JdbTable
will not replace it.
The default cell editor for a column with a picklist is a combo box cell editor. The column is displayed as usual. When edited,
a cell in the column looks and works very much like a JdbComboBox
; a drop-down list of values to choose from is displayed and the value selected from the list becomes the new field value. To get this behavior, set the picklist property of a Column
in a DataSet
just as you would when using a JdbComboBox
and display the DataSet
in a JdbTable
.
When a column whose data type is Variant.INPUTSTREAM
is displayed in
a JdbTable
, its default cell editor is a TableImageEditor
. As much of the image as will fit is displayed in the cell. If you double-click the cell, a dialog opens that displays the full image, with scrollbars if necessary, and allows you to choose a new image file. TableImageEditor
can display GIFs, JPGs, and any BMP file that you can view in Windows Paint. If you display an INPUTSTREAM
column that does not contain images in a JdbTable
, you should provide a custom cell renderer and editor for it.
dbSwing also provides a read-only editor, TableImageReadOnlyEditor
, that also displays images in a dialog but does not provide a file chooser and therefore does not allow the field value to be edited. TableImageReadOnlyEditor
is never installed as the default cell editor for a column, but can be used instead of TableImageEditor
if desired.
To replace the default cell renderer or editor in a column of a JdbTable
,
set the corresponding Column
's itemPainter
or itemEditor
property. For example, to display a column of images but prevent changes to the data,
set the Column
's itemEditor
property to an instance of TableImageReadOnlyEditor
.
If you're working in the UI designer, you can use the BeanChooser to select
TableImageReadOnlyEditor
from the com.borland.dbswing
package, drop an instance into the component tree, and set the Column
's itemEditor
property to it.
Before you write a custom cell renderer, consider using a ColumnPaintListener
instead. It passes you almost the same parameters as a cell renderer, so
you can do almost anything with a ColumnPaintListener
that you would do in a cell renderer. A ColumnPaintListener
differs from a cell renderer in a few ways:
Variant
. In a cell renderer it is
a String
, formatted according to the display mask.
You can modify the value passed to you. This only changes the displayed value, not the stored value.
Instead of replacing a default renderer with your own, you write an event handler for a Column
's painting or editing event. All components bound to the column that support the ColumnPaint
interface will use the event handler.
JdbTable
, you will probably extend DBCellRenderer
. It's a public inner class of JdbTable
, so the syntax
is unusual. Notice the extends clause and the call to super()
in
the constructor of this example. This custom cell renderer displays negative numbers in red:
import java.awt.*; import javax.swing.*; import com.borland.dbswing.*; public class NegativeNumberRenderer extends JdbTable.DBCellRenderer { public NegativeNumberRenderer(JdbTable jdbTable) { jdbTable.super(); } public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table,value, isSelected, hasFocus, row, column); if (value != null) { try { // Compare numeric value of string to zero. This assumes that a negative // value has a leading minus sign, so only handles simple numeric formats if (Double.parseDouble((String) value) < 0.0d) super.setForeground(Color.red); } // Use the default foreground if we can't get a number from the string catch (NumberFormatException nfe) { } } return this; } }
TableColumns
JdbTable
's dataSet
property, each visible column in
the DataSet
is displayed in a column in the JdbTable
. More specifically,
each com.borland.dx.dataset.Column
object is associated with a javax.swing.table.TableColumn
object. Often you can give a JdbTable
the desired appearance and behavior by setting Column
properties. For example, JdbTable
inherits font, color, alignment, and width settings from the Column
s in its DataSet
.
This is the easy way to customize a JdbTable
.
Sometimes, you have to create TableColumn
s yourself so you can set their properties. For example, you have to set TableColumn
properties to control runtime resizing of an individual column in a JdbTable
. More often, you have a choice: instead of instantiating a TableColumn
and setting a property on it, you can get the same result or a very similar result another way.
Unless there's a compelling reason to use a TableColumn
, we recommend the
alternative approach in these cases:
cellRenderer
and cellEditor
properties: Use Column
's itemPainter
and itemEditor
properties to assign cell renderers and editors. You don't have to use a cell renderer at all; you can use a ColumnPaintListener
instead.
headerValue
property: Set the Column
's caption
instead. For multi-line headers, put newline characters ('\n') in the caption.
Order of columns in JdbTable
: Alter the order of columns in a DataSet
by
setting the preferredOrdinal
property.
public JdbTable()Constructs a
JdbTable
component by calling the null
constructor of its superclass.
public JdbTable(int numColumns, int numRows)Constructs a
JdbTable
component by calling the constructor of its superclass that takes integer values for the number of columns and rows in the table.
numColumns
numRows
public JdbTable(Object[][] data, Object[] columnNames)Constructs a
JdbTable
component by calling the constructor of its superclass that takes a two-dimensional array of Object
s for the table's data and an array of Object
s for the table's column names.
data
columnNames
public JdbTable(Vector data, Vector columnNames)Constructs a
JdbTable
component by calling the constructor of its superclass that takes Vector
s for the table's data and its column names.
data
columnNames
public JdbTable(TableModel dm)Constructs a
JdbTable
component by calling the constructor of its superclass and passing to it a TableModel
as the source of the table's data. It uses a default column model and a default selection model.
dm
public JdbTable(TableModel dm, TableColumnModel cm)Constructs a
JdbTable
component by calling the constructor of its superclass and passing to it a TableModel
and TableColumnModel
as the source of the table's data. It uses a default selection model.
dm
cm
public JdbTable(TableModel dm, TableColumnModel cm, ListSelectionModel sm)Constructs a
JdbTable
component by calling the constructor of its superclass and passing to it a TableModel
, TableColumnModel
, and ListSelectionModel
. If any of these parameters are null
, the constructor initializes the table with a default model.
dm
cm
sm
public boolean isAutoSelection() public void setAutoSelection(boolean autoSelection)Returns and sets whether
JdbTable
automatically updates the selection model whenever the data model changes. Setting this property to false
, for example, prevents JdbTable
from setting the selection when it is first displayed. The default property value is true
.
public boolean isColumnHeaderVisible() public void setColumnHeaderVisible(boolean columnHeaderVisible)Determines whether the column header displaying the column names is visible. If
columnHeaderVisible
is true
, the column header is visible; if it is false
, the column header is not visible.
public boolean isColumnSortEnabled() public void setColumnSortEnabled(boolean enableSort)Returns and sets whether clicking in a column of the table header sorts rows by that column. The default value is
true
.
public CustomColumnsDescriptor getCustomColumns() public void setCustomColumns(CustomColumnsDescriptor customColumnDescriptor)When used as a getter,
customColumns
returns the CustomColumnsDescriptor
defining the customized TableColumn
properties of this table.
When used as a setter, customColumns
sets custom properties for a subset of this table's TableColumns
.
customColumnDescriptor
JdbTable
.
Hidden columns take precedence over customized columns, so customized properties on hidden columns are ignored.
If the model used by the JdbTable undergoes a structural change (i.e., columns are added or removed) then customColumns
will likely need to be set again with model indices applicable to the new model. Setting a null
CustomColumnsDescriptor
removes all customized column properties, and should be done before the model (DataSet
) changes to avoid setting customized properties on columns which no longer exist in the new model.
// This code fragment assumes that elsewhere in the program // you have already instantiated a JdbTable called jdbTable1, // which has a default model. // This example code shows how to instantiate a non-default // model, define custom columns, then assign the non-default // model to the JdbTable and set the table's CustomColumnsDescriptor // to use the newly defined custom columns. TableModel tableModel = new AbstractTableModel() { // This instantiates the model, and at the same time implements // the following methods of TableModel, which is an interface. public int getColumnCount() { return 4; } public int getRowCount() { return 1; } public Object getValueAt(int row, int col) { return ""; } public boolean isCellEditable(int row, int col) { return true; } public String getColumnName(int index) { if (index == 0) { return "Name"; } else if (index == 1) { return "Address"; } else if (index == 2) { return "Phone"; } else if (index == 3) { return "email"; } return null; } }; TableColumn addressColumn = new TableColumn(1); // sets preferred width of Address column in the table model addressColumn.setPreferredWidth(225); TableColumn phoneColumn = new TableColumn(2); // sets multi-line header on Phone column in the table model phoneColumn.setHeaderValue(new String [] { "Phone", "Number"}); TableColumn emailColumn = new TableColumn(3); // sets custom cell renderer on email column in the table model emailColumn.setCellEditor(new DefaultCellEditor(new JComboBox(new String[] {"me@mycompany.com", "you@yourcompany.com"} ))); // Set a null CustomColumnsDescriptor before assigning // the new model to the JdbTable to avoid setting // customized properties on columns which no longer exist // in the new model. jdbTable1.setCustomColumns(null); // set table's new non-default table model jdbTable1.setModel(tableModel); // Set a new CustomColumnsDescriptor which makes the // email column appear as the third column in table, the // address column appear in its 'natural' position, and // the phoneColumn appear as the first column in the table. jdbTable1.setCustomColumns(new CustomColumnsDescriptor(new int [] { 2, -1, 0}, new TableColumn [] { emailColumn, addressColumn, phoneColumn}));
TableColumn
's identifier
property is used internally by JdbTable
. When using a DataSet
, you should not set this property. Setting this property (whether or not using a DataSet
) will prevent JdbTable
from properly merging new hidden or custom columns with an existing TableColumnModel
.
public DataSet getDataSet() public void setDataSet(DataSet dataSet)Returns and sets the
DataSet
used to build the TableModel
that contains the data for the table. setDataSet()
creates an instance of DBTableModel
with the given DataSet
, then sets it as the table's model by calling setModel()
. If the DataSet
is null
, the DBTableModel
creates an empty table model.
public boolean isEditable() public void setEditable(boolean editable)Returns and sets whether entries of the table are editable or not:
false
, individual cells will not be editable regardless of whether the TableModel
allows them to be edited.
true
, a particular cell will be editable only if the TableModel
allows the cell to be edited.
public Color getEditableFocusedCellBackground() public void setEditableFocusedCellBackground(Color focusedCellBackground)Returns and sets the background color of the currently focused, editable cell.
public Color getEditableFocusedCellForeground() public void setEditableFocusedCellForeground(Color focusedCellForeground)Returns and sets the foreground color of the currently focused, editable cell.
public int[] getHiddenColumns() public void setHiddenColumns(int[] hiddenColumns)Returns and sets the table model columns that are hidden from the table's display.
Invoking setHiddenColumns()
always causes the table's column model to be rebuilt regardless of the value of autoCreateDefaultColumnsFromModel()
. Each element of the array is the index of the column in the table model you want to be a hidden column.
Hidden columns take precedence over customized columns.
The order of the elements in the array is not significant. Invalid model indexes are ignored.
If the model used by this table undergoes a structural change (i.e., columns are added or removed) then this property will likely need to be set again with model indices applicable to the new model. Specifying a null
value resets (removes) all existing hidden columns, and should be done before the model (DataSet
) changes to avoid hiding columns which no longer exist in the new model, or accidentally hiding columns in the new model which shouldn't be hidden.
The hiddenColumns
array is not cloned. If you make changes to the array after this property has been set, unexpected side effects can occur.
public boolean isPopupMenuEnabled() public void setPopupMenuEnabled(boolean popupEnabled)Returns and sets whether right-clicking in the table displays a pop-up menu. The default value is
true
.
createPopupMenu
public TableRowHeader getRowHeader() public void setRowHeader(TableRowHeader rowHeader)
A JdbTable
has a TableRowHeader
by default, which is customizable through its properties. To add behavior not already provided by TableRowHeader
, create a new class extending it, and set it as the new row header.
Setting a null
row header has the side effect of hiding the row header. Setting a non-null row header has the side effect of displaying the row header if it was not already visible.
public boolean isRowHeaderVisible() public void setRowHeaderVisible(boolean rowHeaderVisible)Determines whether a row header is visible. If
rowHeaderVisible
is true
, the row header is visible; if it is false
, the row header is not visible. The default is true
.
Using setRowHeader()
to set a new non-null row header has the side effect of setting rowHeaderVisible
to true
.
public boolean isSmartColumnWidths() public void setSmartColumnWidths(boolean smartColumnWidths)Determines if the default initial column widths are calculated by the model column's data type. If they are,
smartColumnWidths
is true
. The default is true
.
When using a DataSet
as the table's model, set this property value to true
to have default column widths determined by analysis of the corresponding DataSet
Column
.
A customized column's preferredSize
property takes precedence over this property. Therefore, to override the smart default column width, define a custom column and set its width. Or you can override the getDefaultTableColumnWidth()
method that contains the algorithm for determining the default width of a column.
DataSet
was not used to build this table's model because data type information is not available.
customColumns
public void setTableHeader(JTableHeader tableHeader)Sets the header for the table with the
JTableHeader
specified as the value of tableHeader
.
public void setVisible(boolean visible)Sets whether the table is visible. If the visible parameter is
true
, the table is visible; if it is false
, the table is not visible. The default is true
.
public void addNotify()Calls
addNotify()
of the superclass and opens the DataSet
.
protected void configureEnclosingScrollPane()Adds the table's column header to the enclosing
ScrollPane
's ColumnHeaderView
. The configureEnclosingScrollPane()
method is normally invoked only once, when addNotify()
is called.
javax.swing.JTable.configureEnclosingScrollPane()
public void createDefaultColumnsFromModel()Rebuilds the
TableColumnModel
from the TableModel
and overrides JTable
's method of the same name.
createDefaultColumnsFromModel()
is called by JTable
whenever the table model changes and AutoCreateColumnsFromModel
is true
. It is also called by setHiddenColumns()
and setCustomizedColumns()
regardless of the state of AutoCreateColumnsFromModel
.
createDefaultColumnsFromModel
adds uncustomized columns to the table column model in the same order as they are returned by the model. createDefaultColumnsFromModel
normally isn't called until a table has been realized. This improves performance at load time, since the column model only needs to be built once - after multiple properties have been set - rather than every time a property changes.
javax.swing.JTable.createDefaultColumnsFromModel()
protected TableModel createDefaultDataModel()Creates the default data model at
JdbTable
instantiation time and overrides JTable
's implementation to create a DBTableModel
instead of a DefaultTableModel
.
javax.swing.JTable.createDefaultDataModel()
protected JTableHeader createDefaultTableHeader()Returns a
JTableHeader
. Note that the instance of JTableHeader
which is returned by this method can't accept keyboard focus. This is true because when createDefaultTableHeader()
instantiates the JTableHeader
, it overrides the methods isFocusTraversable()
and isRequestFocusEnabled()
to prevent the JTableHeader
from accepting keyboard focus.
javax.swing.JTable.createDefaultTableHeader()
protected JPopupMenu createPopupMenu()Creates
JdbTable
's default right-click popup menu.
public void ensureRowIsVisible(int row)Makes the specified row visible and throws an
IllegalArgumentException
if the row is not in the valid range.
row
protected TableCellEditor getDefaultCellEditor(Column dataSetColumn)Returns the default editor to use for the specified
Column
.
protected TableCellRenderer getDefaultCellRenderer(Column dataSetColumn)Returns the default renderer to use for the specified
Column
.
protected int getDefaultTableColumnWidth(Column dataSetColumn)Returns a default pixel width for a
TableColumn
based on a DataSet
Column
's type. This method is called by createDefaultColumnsFromModel()
as it attempts to inherit TableColumn
properties from DataSet
Column
properties.
protected int getMaxCaptionWidth(Object columnHeaderValue, Font font)Returns the maximum caption width based on the font and the column header value. This method is called by
createDefaultColumnsFromModel()
if the table model is null
and smartColumnWidths
is true
.
protected int getStringWidth(String string, Font font)Returns the width of the string size based on the font.
protected void initializeLocalVars()Initializes table properties to their default values.
public boolean isCellEditable(int row, int column)Overrides the
JTable
's default implementation to account for the value of the editable
property.
public boolean isCellSelected(int row, int column)
Overrides: javax.swing.JTable.isCellSelected(int, int)
protected boolean isCellValid(TableCellEditor cellEditor)When a user tries to save a table cell value, the table asks whether to stop editing the cell. At that point,
JdbTable
checks to see if the cell editor value is valid. If not, it throws an exception to display to the user. The reason the cell editor is passed as an argument is because it knows the currently edited value, which may still be incomplete.
public Component prepareEditor(TableCellEditor editor, int row, int column)Overrides the
JTable
's default implementation to provide support to JdbTable
's custom cell editors.
public Component prepareRenderer(TableCellRenderer renderer, int row, int column)Overrides the
JTable
's default implementation to provide support to JdbTable
's custom cell renderers.
public void removeNotify()Calls the
removeNotify()
method of the superclass, sets the rowHeaderVisible
and columnHeaderVisible
properties to false
, and sets addNotifyCalled
to false
.
public void updateUI()Overrides
JTable
's updateUI()
method to make a few platform-independent UI changes. First, the default actions for Enter and Shift+Enter are changed to behave like Tab and Shift+Tab, respectively. Then, Ctrl+Ins and Ctrl+Del are bound to the insert and delete row actions.
public void addAncestorListener(javax.swing.event.AncestorListener ) public void removeAncestorListener(javax.swing.event.AncestorListener )
public synchronized void addComponentListener(java.awt.event.ComponentListener ) public synchronized void removeComponentListener(java.awt.event.ComponentListener )
public synchronized void addContainerListener(java.awt.event.ContainerListener ) public synchronized void removeContainerListener(java.awt.event.ContainerListener )
public synchronized void addFocusListener(java.awt.event.FocusListener ) public synchronized void removeFocusListener(java.awt.event.FocusListener )
public synchronized void addInputMethodListener(java.awt.event.InputMethodListener ) public synchronized void removeInputMethodListener(java.awt.event.InputMethodListener )
public synchronized void addKeyListener(java.awt.event.KeyListener ) public synchronized void removeKeyListener(java.awt.event.KeyListener )
public synchronized void addMouseListener(java.awt.event.MouseListener ) public synchronized void removeMouseListener(java.awt.event.MouseListener )
public synchronized void addMouseMotionListener(java.awt.event.MouseMotionListener ) public synchronized void removeMouseMotionListener(java.awt.event.MouseMotionListener )
public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener ) public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener )
public synchronized void addVetoableChangeListener(java.beans.VetoableChangeListener ) public synchronized void removeVetoableChangeListener(java.beans.VetoableChangeListener )