Liking cljdoc? Tell your friends :D

javax.swing.table.AbstractTableModel

This abstract class provides default implementations for most of the methods in the TableModel interface. It takes care of the management of listeners and provides some conveniences for generating TableModelEvents and dispatching them to the listeners. To create a concrete TableModel as a subclass of AbstractTableModel you need only provide implementations for the following three methods:

public int getRowCount(); public int getColumnCount(); public Object getValueAt(int row, int column);

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

This abstract class provides default implementations for most of
 the methods in the TableModel interface. It takes care of
 the management of listeners and provides some conveniences for generating
 TableModelEvents and dispatching them to the listeners.
 To create a concrete TableModel as a subclass of
 AbstractTableModel you need only provide implementations
 for the following three methods:



 public int getRowCount();
 public int getColumnCount();
 public Object getValueAt(int row, int column);

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.table.core

No vars found in this namespace.

javax.swing.table.DefaultTableCellRenderer

The standard class for rendering (displaying) individual cells in a JTable.

Implementation Note: This class inherits from JLabel, a standard component class. However JTable employs a unique mechanism for rendering its cells and therefore requires some slightly modified behavior from its cell renderer. The table class defines a single cell renderer and uses it as a as a rubber-stamp for rendering all cells in the table; it renders the first cell, changes the contents of that cell renderer, shifts the origin to the new location, re-draws it, and so on. The standard JLabel component was not designed to be used this way and we want to avoid triggering a revalidate each time the cell is drawn. This would greatly decrease performance because the revalidate message would be passed up the hierarchy of the container to determine whether any other components would be affected. As the renderer is only parented for the lifetime of a painting operation we similarly want to avoid the overhead associated with walking the hierarchy for painting operations. So this class overrides the validate, invalidate, revalidate, repaint, and firePropertyChange methods to be no-ops and override the isOpaque method solely to improve performance. If you write your own renderer, please keep this performance consideration in mind.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

The standard class for rendering (displaying) individual cells
in a JTable.


Implementation Note:
This class inherits from JLabel, a standard component class.
However JTable employs a unique mechanism for rendering
its cells and therefore requires some slightly modified behavior
from its cell renderer.
The table class defines a single cell renderer and uses it as a
as a rubber-stamp for rendering all cells in the table;
it renders the first cell,
changes the contents of that cell renderer,
shifts the origin to the new location, re-draws it, and so on.
The standard JLabel component was not
designed to be used this way and we want to avoid
triggering a revalidate each time the
cell is drawn. This would greatly decrease performance because the
revalidate message would be
passed up the hierarchy of the container to determine whether any other
components would be affected.
As the renderer is only parented for the lifetime of a painting operation
we similarly want to avoid the overhead associated with walking the
hierarchy for painting operations.
So this class
overrides the validate, invalidate,
revalidate, repaint, and
firePropertyChange methods to be
no-ops and override the isOpaque method solely to improve
performance.  If you write your own renderer,
please keep this performance consideration in mind.


Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.table.DefaultTableCellRenderer$UIResource

A subclass of DefaultTableCellRenderer that implements UIResource. DefaultTableCellRenderer doesn't implement UIResource directly so that applications can safely override the cellRenderer property with DefaultTableCellRenderer subclasses.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A subclass of DefaultTableCellRenderer that
implements UIResource.
DefaultTableCellRenderer doesn't implement
UIResource
directly so that applications can safely override the
cellRenderer property with
DefaultTableCellRenderer subclasses.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.table.DefaultTableColumnModel

The standard column-handler for a JTable.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

The standard column-handler for a JTable.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.table.DefaultTableModel

This is an implementation of TableModel that uses a Vector of Vectors to store the cell value objects.

Warning: DefaultTableModel returns a column class of Object. When DefaultTableModel is used with a TableRowSorter this will result in extensive use of toString, which for non-String data types is expensive. If you use DefaultTableModel with a TableRowSorter you are strongly encouraged to override getColumnClass to return the appropriate type.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

This is an implementation of TableModel that
uses a Vector of Vectors to store the
cell value objects.

Warning: DefaultTableModel returns a
column class of Object.  When
DefaultTableModel is used with a
TableRowSorter this will result in extensive use of
toString, which for non-String data types
is expensive.  If you use DefaultTableModel with a
TableRowSorter you are strongly encouraged to override
getColumnClass to return the appropriate type.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.table.JTableHeader

This is the object which manages the header of the JTable.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

This is the object which manages the header of the JTable.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.table.TableCellEditor

This interface defines the method any object that would like to be an editor of values for components such as JListBox, JComboBox, JTree, or JTable needs to implement.

This interface defines the method any object that would like to be
an editor of values for components such as JListBox,
JComboBox, JTree, or JTable
needs to implement.
raw docstring

javax.swing.table.TableCellRenderer

This interface defines the method required by any object that would like to be a renderer for cells in a JTable.

This interface defines the method required by any object that
would like to be a renderer for cells in a JTable.
raw docstring

javax.swing.table.TableColumn

A TableColumn represents all the attributes of a column in a JTable, such as width, resizability, minimum and maximum width. In addition, the TableColumn provides slots for a renderer and an editor that can be used to display and edit the values in this column.

It is also possible to specify renderers and editors on a per type basis rather than a per column basis - see the setDefaultRenderer method in the JTable class. This default mechanism is only used when the renderer (or editor) in the TableColumn is null.

The TableColumn stores the link between the columns in the JTable and the columns in the TableModel. The modelIndex is the column in the TableModel, which will be queried for the data values for the cells in this column. As the column moves around in the view this modelIndex does not change.

Note: Some implementations may assume that all TableColumnModels are unique, therefore we would recommend that the same TableColumn instance not be added more than once to a TableColumnModel. To show TableColumns with the same column of data from the model, create a new instance with the same modelIndex.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A TableColumn represents all the attributes of a column in a
 JTable, such as width, resizability, minimum and maximum width.
 In addition, the TableColumn provides slots for a renderer and
 an editor that can be used to display and edit the values in this column.

 It is also possible to specify renderers and editors on a per type basis
 rather than a per column basis - see the
 setDefaultRenderer method in the JTable class.
 This default mechanism is only used when the renderer (or
 editor) in the TableColumn is null.

 The TableColumn stores the link between the columns in the
 JTable and the columns in the TableModel.
 The modelIndex is the column in the
 TableModel, which will be queried for the data values for the
 cells in this column. As the column moves around in the view this
 modelIndex does not change.

Note: Some implementations may assume that all
   TableColumnModels are unique, therefore we would
   recommend that the same TableColumn instance
   not be added more than once to a TableColumnModel.
   To show TableColumns with the same column of
   data from the model, create a new instance with the same
   modelIndex.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.table.TableModel

The TableModel interface specifies the methods the JTable will use to interrogate a tabular data model.

The JTable can be set up to display any data model which implements the TableModel interface with a couple of lines of code:

 TableModel myData = new MyTableModel();
 JTable table = new JTable(myData);

For further documentation, see Creating a Table Model in The Java Tutorial.

The TableModel interface specifies the methods the
 JTable will use to interrogate a tabular data model.

 The JTable can be set up to display any data
 model which implements the
 TableModel interface with a couple of lines of code:


     TableModel myData = new MyTableModel();
     JTable table = new JTable(myData);

For further documentation, see Creating a Table Model
in The Java Tutorial.
raw docstring

javax.swing.table.TableRowSorter

An implementation of RowSorter that provides sorting and filtering using a TableModel. The following example shows adding sorting to a JTable:

TableModel myModel = createMyTableModel(); JTable table = new JTable(myModel); table.setRowSorter(new TableRowSorter(myModel)); This will do all the wiring such that when the user does the appropriate gesture, such as clicking on the column header, the table will visually sort.

JTable's row-based methods and JTable's selection model refer to the view and not the underlying model. Therefore, it is necessary to convert between the two. For example, to get the selection in terms of myModel you need to convert the indices:

int[] selection = table.getSelectedRows(); for (int i = 0; i < selection.length; i++) { selection[i] = table.convertRowIndexToModel(selection[i]); } Similarly to select a row in JTable based on a coordinate from the underlying model do the inverse:

table.setRowSelectionInterval(table.convertRowIndexToView(row), table.convertRowIndexToView(row));

The previous example assumes you have not enabled filtering. If you have enabled filtering convertRowIndexToView will return -1 for locations that are not visible in the view.

TableRowSorter uses Comparators for doing comparisons. The following defines how a Comparator is chosen for a column:

If a Comparator has been specified for the column by the setComparator method, use it. If the column class as returned by getColumnClass is String, use the Comparator returned by Collator.getInstance(). If the column class implements Comparable, use a Comparator that invokes the compareTo method. If a TableStringConverter has been specified, use it to convert the values to Strings and then use the Comparator returned by Collator.getInstance(). Otherwise use the Comparator returned by Collator.getInstance() on the results from calling toString on the objects.

In addition to sorting TableRowSorter provides the ability to filter. A filter is specified using the setFilter method. The following example will only show rows containing the string "foo":

TableModel myModel = createMyTableModel(); TableRowSorter sorter = new TableRowSorter(myModel); sorter.setRowFilter(RowFilter.regexFilter(".foo.")); JTable table = new JTable(myModel); table.setRowSorter(sorter);

If the underlying model structure changes (the modelStructureChanged method is invoked) the following are reset to their default values: Comparators by column, current sort order, and whether each column is sortable. The default sort order is natural (the same as the model), and columns are sortable by default.

TableRowSorter has one formal type parameter: the type of the model. Passing in a type that corresponds exactly to your model allows you to filter based on your model without casting. Refer to the documentation of RowFilter for an example of this.

WARNING: DefaultTableModel returns a column class of Object. As such all comparisons will be done using toString. This may be unnecessarily expensive. If the column only contains one type of value, such as an Integer, you should override getColumnClass and return the appropriate Class. This will dramatically increase the performance of this class.

An implementation of RowSorter that provides sorting
and filtering using a TableModel.
The following example shows adding sorting to a JTable:


  TableModel myModel = createMyTableModel();
  JTable table = new JTable(myModel);
  table.setRowSorter(new TableRowSorter(myModel));
This will do all the wiring such that when the user does the appropriate
gesture, such as clicking on the column header, the table will
visually sort.

JTable's row-based methods and JTable's
selection model refer to the view and not the underlying
model. Therefore, it is necessary to convert between the two.  For
example, to get the selection in terms of myModel
you need to convert the indices:


  int[] selection = table.getSelectedRows();
  for (int i = 0; i < selection.length; i++) {
    selection[i] = table.convertRowIndexToModel(selection[i]);
  }
Similarly to select a row in JTable based on
a coordinate from the underlying model do the inverse:


  table.setRowSelectionInterval(table.convertRowIndexToView(row),
                                table.convertRowIndexToView(row));

The previous example assumes you have not enabled filtering.  If you
have enabled filtering convertRowIndexToView will return
-1 for locations that are not visible in the view.

TableRowSorter uses Comparators for doing
comparisons. The following defines how a Comparator is
chosen for a column:

If a Comparator has been specified for the column by the
    setComparator method, use it.
If the column class as returned by getColumnClass is
    String, use the Comparator returned by
    Collator.getInstance().
If the column class implements Comparable, use a
    Comparator that invokes the compareTo
    method.
If a TableStringConverter has been specified, use it
    to convert the values to Strings and then use the
    Comparator returned by Collator.getInstance().
Otherwise use the Comparator returned by
    Collator.getInstance() on the results from
    calling toString on the objects.


In addition to sorting TableRowSorter provides the ability
to filter.  A filter is specified using the setFilter
method. The following example will only show rows containing the string
"foo":


  TableModel myModel = createMyTableModel();
  TableRowSorter sorter = new TableRowSorter(myModel);
  sorter.setRowFilter(RowFilter.regexFilter(".*foo.*"));
  JTable table = new JTable(myModel);
  table.setRowSorter(sorter);

If the underlying model structure changes (the
modelStructureChanged method is invoked) the following
are reset to their default values: Comparators by
column, current sort order, and whether each column is sortable. The default
sort order is natural (the same as the model), and columns are
sortable by default.

TableRowSorter has one formal type parameter: the type
of the model.  Passing in a type that corresponds exactly to your
model allows you to filter based on your model without casting.
Refer to the documentation of RowFilter for an example
of this.

WARNING: DefaultTableModel returns a column
class of Object.  As such all comparisons will
be done using toString.  This may be unnecessarily
expensive.  If the column only contains one type of value, such as
an Integer, you should override getColumnClass and
return the appropriate Class.  This will dramatically
increase the performance of this class.
raw docstring

javax.swing.table.TableStringConverter

TableStringConverter is used to convert objects from the model into strings. This is useful in filtering and searching when the model returns objects that do not have meaningful toString implementations.

TableStringConverter is used to convert objects from the model into
strings.  This is useful in filtering and searching when the model returns
objects that do not have meaningful toString implementations.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close