< prev index next >
src/java.desktop/share/classes/javax/swing/table/DefaultTableModel.java
Print this page
*** 30,59 ****
import java.util.Enumeration;
import javax.swing.event.TableModelEvent;
/**
! * This is an implementation of <code>TableModel</code> that
! * uses a <code>Vector</code> of <code>Vectors</code> to store the
* cell value objects.
* <p>
! * <strong>Warning:</strong> <code>DefaultTableModel</code> returns a
! * column class of <code>Object</code>. When
! * <code>DefaultTableModel</code> is used with a
! * <code>TableRowSorter</code> this will result in extensive use of
! * <code>toString</code>, which for non-<code>String</code> data types
! * is expensive. If you use <code>DefaultTableModel</code> with a
! * <code>TableRowSorter</code> you are strongly encouraged to override
! * <code>getColumnClass</code> to return the appropriate type.
* <p>
* <strong>Warning:</strong>
* 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 <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author Philip Milne
*
* @see TableModel
--- 30,59 ----
import java.util.Enumeration;
import javax.swing.event.TableModelEvent;
/**
! * This is an implementation of {@code TableModel} that
! * uses a {@code Vector} of {@code Vectors} to store the
* cell value objects.
* <p>
! * <strong>Warning:</strong> {@code DefaultTableModel} returns a
! * column class of {@code Object}. When
! * {@code DefaultTableModel} is used with a
! * {@code TableRowSorter} this will result in extensive use of
! * {@code toString}, which for non-{@code String} data types
! * is expensive. If you use {@code DefaultTableModel} with a
! * {@code TableRowSorter} you are strongly encouraged to override
! * {@code getColumnClass} to return the appropriate type.
* <p>
* <strong>Warning:</strong>
* 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 {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author Philip Milne
*
* @see TableModel
*** 65,81 ****
//
// Instance Variables
//
/**
! * The <code>Vector</code> of <code>Vectors</code> of
! * <code>Object</code> values.
*/
@SuppressWarnings("rawtypes")
protected Vector<Vector> dataVector;
! /** The <code>Vector</code> of column identifiers. */
@SuppressWarnings("rawtypes")
protected Vector columnIdentifiers;
// Unfortunately, for greater source compatibility the inner-most
// Vector in the two fields above is being left raw. The Vector is
// read as well as written so using Vector<?> is not suitable and
--- 65,81 ----
//
// Instance Variables
//
/**
! * The {@code Vector} of {@code Vectors} of
! * {@code Object} values.
*/
@SuppressWarnings("rawtypes")
protected Vector<Vector> dataVector;
! /** The {@code Vector} of column identifiers. */
@SuppressWarnings("rawtypes")
protected Vector columnIdentifiers;
// Unfortunately, for greater source compatibility the inner-most
// Vector in the two fields above is being left raw. The Vector is
// read as well as written so using Vector<?> is not suitable and
*** 86,96 ****
//
// Constructors
//
/**
! * Constructs a default <code>DefaultTableModel</code>
* which is a table of zero columns and zero rows.
*/
public DefaultTableModel() {
this(0, 0);
}
--- 86,96 ----
//
// Constructors
//
/**
! * Constructs a default {@code DefaultTableModel}
* which is a table of zero columns and zero rows.
*/
public DefaultTableModel() {
this(0, 0);
}
*** 100,112 ****
v.setSize(size);
return v;
}
/**
! * Constructs a <code>DefaultTableModel</code> with
! * <code>rowCount</code> and <code>columnCount</code> of
! * <code>null</code> object values.
*
* @param rowCount the number of rows the table holds
* @param columnCount the number of columns the table holds
*
* @see #setValueAt
--- 100,112 ----
v.setSize(size);
return v;
}
/**
! * Constructs a {@code DefaultTableModel} with
! * {@code rowCount} and {@code columnCount} of
! * {@code null} object values.
*
* @param rowCount the number of rows the table holds
* @param columnCount the number of columns the table holds
*
* @see #setValueAt
*** 114,181 ****
public DefaultTableModel(int rowCount, int columnCount) {
this(newVector(columnCount), rowCount);
}
/**
! * Constructs a <code>DefaultTableModel</code> with as many columns
! * as there are elements in <code>columnNames</code>
! * and <code>rowCount</code> of <code>null</code>
* object values. Each column's name will be taken from
! * the <code>columnNames</code> vector.
*
! * @param columnNames <code>vector</code> containing the names
* of the new columns; if this is
! * <code>null</code> then the model has no columns
* @param rowCount the number of rows the table holds
* @see #setDataVector
* @see #setValueAt
*/
public DefaultTableModel(Vector<?> columnNames, int rowCount) {
setDataVector(newVector(rowCount), columnNames);
}
/**
! * Constructs a <code>DefaultTableModel</code> with as many
! * columns as there are elements in <code>columnNames</code>
! * and <code>rowCount</code> of <code>null</code>
* object values. Each column's name will be taken from
! * the <code>columnNames</code> array.
*
! * @param columnNames <code>array</code> containing the names
* of the new columns; if this is
! * <code>null</code> then the model has no columns
* @param rowCount the number of rows the table holds
* @see #setDataVector
* @see #setValueAt
*/
public DefaultTableModel(Object[] columnNames, int rowCount) {
this(convertToVector(columnNames), rowCount);
}
/**
! * Constructs a <code>DefaultTableModel</code> and initializes the table
! * by passing <code>data</code> and <code>columnNames</code>
! * to the <code>setDataVector</code> method.
*
! * @param data the data of the table, a <code>Vector</code>
! * of <code>Vector</code>s of <code>Object</code>
* values
! * @param columnNames <code>vector</code> containing the names
* of the new columns
* @see #getDataVector
* @see #setDataVector
*/
@SuppressWarnings("rawtypes")
public DefaultTableModel(Vector<? extends Vector> data, Vector<?> columnNames) {
setDataVector(data, columnNames);
}
/**
! * Constructs a <code>DefaultTableModel</code> and initializes the table
! * by passing <code>data</code> and <code>columnNames</code>
! * to the <code>setDataVector</code>
! * method. The first index in the <code>Object[][]</code> array is
* the row index and the second is the column index.
*
* @param data the data of the table
* @param columnNames the names of the columns
* @see #getDataVector
--- 114,181 ----
public DefaultTableModel(int rowCount, int columnCount) {
this(newVector(columnCount), rowCount);
}
/**
! * Constructs a {@code DefaultTableModel} with as many columns
! * as there are elements in {@code columnNames}
! * and {@code rowCount} of {@code null}
* object values. Each column's name will be taken from
! * the {@code columnNames} vector.
*
! * @param columnNames {@code vector} containing the names
* of the new columns; if this is
! * {@code null} then the model has no columns
* @param rowCount the number of rows the table holds
* @see #setDataVector
* @see #setValueAt
*/
public DefaultTableModel(Vector<?> columnNames, int rowCount) {
setDataVector(newVector(rowCount), columnNames);
}
/**
! * Constructs a {@code DefaultTableModel} with as many
! * columns as there are elements in {@code columnNames}
! * and {@code rowCount} of {@code null}
* object values. Each column's name will be taken from
! * the {@code columnNames} array.
*
! * @param columnNames {@code array} containing the names
* of the new columns; if this is
! * {@code null} then the model has no columns
* @param rowCount the number of rows the table holds
* @see #setDataVector
* @see #setValueAt
*/
public DefaultTableModel(Object[] columnNames, int rowCount) {
this(convertToVector(columnNames), rowCount);
}
/**
! * Constructs a {@code DefaultTableModel} and initializes the table
! * by passing {@code data} and {@code columnNames}
! * to the {@code setDataVector} method.
*
! * @param data the data of the table, a {@code Vector}
! * of {@code Vector}s of {@code Object}
* values
! * @param columnNames {@code vector} containing the names
* of the new columns
* @see #getDataVector
* @see #setDataVector
*/
@SuppressWarnings("rawtypes")
public DefaultTableModel(Vector<? extends Vector> data, Vector<?> columnNames) {
setDataVector(data, columnNames);
}
/**
! * Constructs a {@code DefaultTableModel} and initializes the table
! * by passing {@code data} and {@code columnNames}
! * to the {@code setDataVector}
! * method. The first index in the {@code Object[][]} array is
* the row index and the second is the column index.
*
* @param data the data of the table
* @param columnNames the names of the columns
* @see #getDataVector
*** 184,200 ****
public DefaultTableModel(Object[][] data, Object[] columnNames) {
setDataVector(data, columnNames);
}
/**
! * Returns the <code>Vector</code> of <code>Vectors</code>
* that contains the table's
* data values. The vectors contained in the outer vector are
* each a single row of values. In other words, to get to the cell
* at row 1, column 5: <p>
*
! * <code>((Vector)getDataVector().elementAt(1)).elementAt(5);</code>
*
* @return the vector of vectors containing the tables data values
*
* @see #newDataAvailable
* @see #newRowsAdded
--- 184,200 ----
public DefaultTableModel(Object[][] data, Object[] columnNames) {
setDataVector(data, columnNames);
}
/**
! * Returns the {@code Vector} of {@code Vectors}
* that contains the table's
* data values. The vectors contained in the outer vector are
* each a single row of values. In other words, to get to the cell
* at row 1, column 5: <p>
*
! * {@code ((Vector)getDataVector().elementAt(1)).elementAt(5);}
*
* @return the vector of vectors containing the tables data values
*
* @see #newDataAvailable
* @see #newRowsAdded
*** 208,230 ****
private static <E> Vector<E> nonNullVector(Vector<E> v) {
return (v != null) ? v : new Vector<>();
}
/**
! * Replaces the current <code>dataVector</code> instance variable
! * with the new <code>Vector</code> of rows, <code>dataVector</code>.
! * Each row is represented in <code>dataVector</code> as a
! * <code>Vector</code> of <code>Object</code> values.
! * <code>columnIdentifiers</code> are the names of the new
! * columns. The first name in <code>columnIdentifiers</code> is
! * mapped to column 0 in <code>dataVector</code>. Each row in
! * <code>dataVector</code> is adjusted to match the number of
! * columns in <code>columnIdentifiers</code>
! * either by truncating the <code>Vector</code> if it is too long,
! * or adding <code>null</code> values if it is too short.
! * <p>Note that passing in a <code>null</code> value for
! * <code>dataVector</code> results in unspecified behavior,
* an possibly an exception.
*
* @param dataVector the new data vector
* @param columnIdentifiers the names of the columns
* @see #getDataVector
--- 208,230 ----
private static <E> Vector<E> nonNullVector(Vector<E> v) {
return (v != null) ? v : new Vector<>();
}
/**
! * Replaces the current {@code dataVector} instance variable
! * with the new {@code Vector} of rows, {@code dataVector}.
! * Each row is represented in {@code dataVector} as a
! * {@code Vector} of {@code Object} values.
! * {@code columnIdentifiers} are the names of the new
! * columns. The first name in {@code columnIdentifiers} is
! * mapped to column 0 in {@code dataVector}. Each row in
! * {@code dataVector} is adjusted to match the number of
! * columns in {@code columnIdentifiers}
! * either by truncating the {@code Vector} if it is too long,
! * or adding {@code null} values if it is too short.
! * <p>Note that passing in a {@code null} value for
! * {@code dataVector} results in unspecified behavior,
* an possibly an exception.
*
* @param dataVector the new data vector
* @param columnIdentifiers the names of the columns
* @see #getDataVector
*** 237,262 ****
justifyRows(0, getRowCount());
fireTableStructureChanged();
}
/**
! * Replaces the value in the <code>dataVector</code> instance
! * variable with the values in the array <code>dataVector</code>.
! * The first index in the <code>Object[][]</code>
* array is the row index and the second is the column index.
! * <code>columnIdentifiers</code> are the names of the new columns.
*
* @param dataVector the new data vector
* @param columnIdentifiers the names of the columns
* @see #setDataVector(Vector, Vector)
*/
public void setDataVector(Object[][] dataVector, Object[] columnIdentifiers) {
setDataVector(convertToVector(dataVector), convertToVector(columnIdentifiers));
}
/**
! * Equivalent to <code>fireTableChanged</code>.
*
* @param event the change event
*
*/
public void newDataAvailable(TableModelEvent event) {
--- 237,262 ----
justifyRows(0, getRowCount());
fireTableStructureChanged();
}
/**
! * Replaces the value in the {@code dataVector} instance
! * variable with the values in the array {@code dataVector}.
! * The first index in the {@code Object[][]}
* array is the row index and the second is the column index.
! * {@code columnIdentifiers} are the names of the new columns.
*
* @param dataVector the new data vector
* @param columnIdentifiers the names of the columns
* @see #setDataVector(Vector, Vector)
*/
public void setDataVector(Object[][] dataVector, Object[] columnIdentifiers) {
setDataVector(convertToVector(dataVector), convertToVector(columnIdentifiers));
}
/**
! * Equivalent to {@code fireTableChanged}.
*
* @param event the change event
*
*/
public void newDataAvailable(TableModelEvent event) {
*** 282,321 ****
}
}
/**
* Ensures that the new rows have the correct number of columns.
! * This is accomplished by using the <code>setSize</code> method in
! * <code>Vector</code> which truncates vectors
! * which are too long, and appends <code>null</code>s if they
* are too short.
! * This method also sends out a <code>tableChanged</code>
* notification message to all the listeners.
*
! * @param e this <code>TableModelEvent</code> describes
* where the rows were added.
! * If <code>null</code> it assumes
* all the rows were newly added
* @see #getDataVector
*/
public void newRowsAdded(TableModelEvent e) {
justifyRows(e.getFirstRow(), e.getLastRow() + 1);
fireTableChanged(e);
}
/**
! * Equivalent to <code>fireTableChanged</code>.
*
* @param event the change event
*
*/
public void rowsRemoved(TableModelEvent event) {
fireTableChanged(event);
}
/**
! * Obsolete as of Java 2 platform v1.3. Please use <code>setRowCount</code> instead.
* @param rowCount the new number of rows
*/
public void setNumRows(int rowCount) {
int old = getRowCount();
if (old == rowCount) {
--- 282,321 ----
}
}
/**
* Ensures that the new rows have the correct number of columns.
! * This is accomplished by using the {@code setSize} method in
! * {@code Vector} which truncates vectors
! * which are too long, and appends {@code null}s if they
* are too short.
! * This method also sends out a {@code tableChanged}
* notification message to all the listeners.
*
! * @param e this {@code TableModelEvent} describes
* where the rows were added.
! * If {@code null} it assumes
* all the rows were newly added
* @see #getDataVector
*/
public void newRowsAdded(TableModelEvent e) {
justifyRows(e.getFirstRow(), e.getLastRow() + 1);
fireTableChanged(e);
}
/**
! * Equivalent to {@code fireTableChanged}.
*
* @param event the change event
*
*/
public void rowsRemoved(TableModelEvent event) {
fireTableChanged(event);
}
/**
! * Obsolete as of Java 2 platform v1.3. Please use {@code setRowCount} instead.
* @param rowCount the new number of rows
*/
public void setNumRows(int rowCount) {
int old = getRowCount();
if (old == rowCount) {
*** 333,343 ****
/**
* Sets the number of rows in the model. If the new size is greater
* than the current size, new rows are added to the end of the model
* If the new size is less than the current size, all
! * rows at index <code>rowCount</code> and greater are discarded.
*
* @see #setColumnCount
* @since 1.3
*
* @param rowCount number of rows in the model
--- 333,343 ----
/**
* Sets the number of rows in the model. If the new size is greater
* than the current size, new rows are added to the end of the model
* If the new size is less than the current size, all
! * rows at index {@code rowCount} and greater are discarded.
*
* @see #setColumnCount
* @since 1.3
*
* @param rowCount number of rows in the model
*** 346,378 ****
setNumRows(rowCount);
}
/**
* Adds a row to the end of the model. The new row will contain
! * <code>null</code> values unless <code>rowData</code> is specified.
* Notification of the row being added will be generated.
*
* @param rowData optional data of the row being added
*/
public void addRow(Vector<?> rowData) {
insertRow(getRowCount(), rowData);
}
/**
* Adds a row to the end of the model. The new row will contain
! * <code>null</code> values unless <code>rowData</code> is specified.
* Notification of the row being added will be generated.
*
* @param rowData optional data of the row being added
*/
public void addRow(Object[] rowData) {
addRow(convertToVector(rowData));
}
/**
! * Inserts a row at <code>row</code> in the model. The new row
! * will contain <code>null</code> values unless <code>rowData</code>
* is specified. Notification of the row being added will be generated.
*
* @param row the row index of the row to be inserted
* @param rowData optional data of the row being added
* @exception ArrayIndexOutOfBoundsException if the row was invalid
--- 346,378 ----
setNumRows(rowCount);
}
/**
* Adds a row to the end of the model. The new row will contain
! * {@code null} values unless {@code rowData} is specified.
* Notification of the row being added will be generated.
*
* @param rowData optional data of the row being added
*/
public void addRow(Vector<?> rowData) {
insertRow(getRowCount(), rowData);
}
/**
* Adds a row to the end of the model. The new row will contain
! * {@code null} values unless {@code rowData} is specified.
* Notification of the row being added will be generated.
*
* @param rowData optional data of the row being added
*/
public void addRow(Object[] rowData) {
addRow(convertToVector(rowData));
}
/**
! * Inserts a row at {@code row} in the model. The new row
! * will contain {@code null} values unless {@code rowData}
* is specified. Notification of the row being added will be generated.
*
* @param row the row index of the row to be inserted
* @param rowData optional data of the row being added
* @exception ArrayIndexOutOfBoundsException if the row was invalid
*** 382,393 ****
justifyRows(row, row+1);
fireTableRowsInserted(row, row);
}
/**
! * Inserts a row at <code>row</code> in the model. The new row
! * will contain <code>null</code> values unless <code>rowData</code>
* is specified. Notification of the row being added will be generated.
*
* @param row the row index of the row to be inserted
* @param rowData optional data of the row being added
* @exception ArrayIndexOutOfBoundsException if the row was invalid
--- 382,393 ----
justifyRows(row, row+1);
fireTableRowsInserted(row, row);
}
/**
! * Inserts a row at {@code row} in the model. The new row
! * will contain {@code null} values unless {@code rowData}
* is specified. Notification of the row being added will be generated.
*
* @param row the row index of the row to be inserted
* @param rowData optional data of the row being added
* @exception ArrayIndexOutOfBoundsException if the row was invalid
*** 414,428 ****
v.setElementAt(tmp, a + to);
}
}
/**
! * Moves one or more rows from the inclusive range <code>start</code> to
! * <code>end</code> to the <code>to</code> position in the model.
! * After the move, the row that was at index <code>start</code>
! * will be at index <code>to</code>.
! * This method will send a <code>tableChanged</code> notification
message to all the listeners.
*
* <pre>
* Examples of moves:
*
--- 414,428 ----
v.setElementAt(tmp, a + to);
}
}
/**
! * Moves one or more rows from the inclusive range {@code start} to
! * {@code end} to the {@code to} position in the model.
! * After the move, the row that was at index {@code start}
! * will be at index {@code to}.
! * This method will send a {@code tableChanged} notification
message to all the listeners.
*
* <pre>
* Examples of moves:
*
*** 457,467 ****
fireTableRowsUpdated(first, last);
}
/**
! * Removes the row at <code>row</code> from the model. Notification
* of the row being removed will be sent to all the listeners.
*
* @param row the row index of the row to be removed
* @exception ArrayIndexOutOfBoundsException if the row was invalid
*/
--- 457,467 ----
fireTableRowsUpdated(first, last);
}
/**
! * Removes the row at {@code row} from the model. Notification
* of the row being removed will be sent to all the listeners.
*
* @param row the row index of the row to be removed
* @exception ArrayIndexOutOfBoundsException if the row was invalid
*/
*** 474,521 ****
// Manipulating columns
//
/**
* Replaces the column identifiers in the model. If the number of
! * <code>newIdentifier</code>s is greater than the current number
* of columns, new columns are added to the end of each row in the model.
! * If the number of <code>newIdentifier</code>s is less than the current
* number of columns, all the extra columns at the end of a row are
* discarded.
*
* @param columnIdentifiers vector of column identifiers. If
! * <code>null</code>, set the model
* to zero columns
* @see #setNumRows
*/
public void setColumnIdentifiers(Vector<?> columnIdentifiers) {
setDataVector(dataVector, columnIdentifiers);
}
/**
* Replaces the column identifiers in the model. If the number of
! * <code>newIdentifier</code>s is greater than the current number
* of columns, new columns are added to the end of each row in the model.
! * If the number of <code>newIdentifier</code>s is less than the current
* number of columns, all the extra columns at the end of a row are
* discarded.
*
* @param newIdentifiers array of column identifiers.
! * If <code>null</code>, set
* the model to zero columns
* @see #setNumRows
*/
public void setColumnIdentifiers(Object[] newIdentifiers) {
setColumnIdentifiers(convertToVector(newIdentifiers));
}
/**
* Sets the number of columns in the model. If the new size is greater
* than the current size, new columns are added to the end of the model
! * with <code>null</code> cell values.
* If the new size is less than the current size, all columns at index
! * <code>columnCount</code> and greater are discarded.
*
* @param columnCount the new number of columns in the model
*
* @see #setColumnCount
* @since 1.3
--- 474,521 ----
// Manipulating columns
//
/**
* Replaces the column identifiers in the model. If the number of
! * {@code newIdentifier}s is greater than the current number
* of columns, new columns are added to the end of each row in the model.
! * If the number of {@code newIdentifier}s is less than the current
* number of columns, all the extra columns at the end of a row are
* discarded.
*
* @param columnIdentifiers vector of column identifiers. If
! * {@code null}, set the model
* to zero columns
* @see #setNumRows
*/
public void setColumnIdentifiers(Vector<?> columnIdentifiers) {
setDataVector(dataVector, columnIdentifiers);
}
/**
* Replaces the column identifiers in the model. If the number of
! * {@code newIdentifier}s is greater than the current number
* of columns, new columns are added to the end of each row in the model.
! * If the number of {@code newIdentifier}s is less than the current
* number of columns, all the extra columns at the end of a row are
* discarded.
*
* @param newIdentifiers array of column identifiers.
! * If {@code null}, set
* the model to zero columns
* @see #setNumRows
*/
public void setColumnIdentifiers(Object[] newIdentifiers) {
setColumnIdentifiers(convertToVector(newIdentifiers));
}
/**
* Sets the number of columns in the model. If the new size is greater
* than the current size, new columns are added to the end of the model
! * with {@code null} cell values.
* If the new size is less than the current size, all columns at index
! * {@code columnCount} and greater are discarded.
*
* @param columnCount the new number of columns in the model
*
* @see #setColumnCount
* @since 1.3
*** 526,556 ****
fireTableStructureChanged();
}
/**
* Adds a column to the model. The new column will have the
! * identifier <code>columnName</code>, which may be null. This method
* will send a
! * <code>tableChanged</code> notification message to all the listeners.
! * This method is a cover for <code>addColumn(Object, Vector)</code> which
! * uses <code>null</code> as the data vector.
*
* @param columnName the identifier of the column being added
*/
public void addColumn(Object columnName) {
addColumn(columnName, (Vector<Object>)null);
}
/**
* Adds a column to the model. The new column will have the
! * identifier <code>columnName</code>, which may be null.
! * <code>columnData</code> is the
! * optional vector of data for the column. If it is <code>null</code>
! * the column is filled with <code>null</code> values. Otherwise,
* the new data will be added to model starting with the first
* element going to row 0, etc. This method will send a
! * <code>tableChanged</code> notification message to all the listeners.
*
* @param columnName the identifier of the column being added
* @param columnData optional data of the column being added
*/
@SuppressWarnings("unchecked") // Adding element to raw columnIdentifiers
--- 526,556 ----
fireTableStructureChanged();
}
/**
* Adds a column to the model. The new column will have the
! * identifier {@code columnName}, which may be null. This method
* will send a
! * {@code tableChanged} notification message to all the listeners.
! * This method is a cover for {@code addColumn(Object, Vector)} which
! * uses {@code null} as the data vector.
*
* @param columnName the identifier of the column being added
*/
public void addColumn(Object columnName) {
addColumn(columnName, (Vector<Object>)null);
}
/**
* Adds a column to the model. The new column will have the
! * identifier {@code columnName}, which may be null.
! * {@code columnData} is the
! * optional vector of data for the column. If it is {@code null}
! * the column is filled with {@code null} values. Otherwise,
* the new data will be added to model starting with the first
* element going to row 0, etc. This method will send a
! * {@code tableChanged} notification message to all the listeners.
*
* @param columnName the identifier of the column being added
* @param columnData optional data of the column being added
*/
@SuppressWarnings("unchecked") // Adding element to raw columnIdentifiers
*** 575,590 ****
fireTableStructureChanged();
}
/**
* Adds a column to the model. The new column will have the
! * identifier <code>columnName</code>. <code>columnData</code> is the
! * optional array of data for the column. If it is <code>null</code>
! * the column is filled with <code>null</code> values. Otherwise,
* the new data will be added to model starting with the first
* element going to row 0, etc. This method will send a
! * <code>tableChanged</code> notification message to all the listeners.
*
* @param columnName identifier of the newly created column
* @param columnData new data to be added to the column
*
* @see #addColumn(Object, Vector)
--- 575,590 ----
fireTableStructureChanged();
}
/**
* Adds a column to the model. The new column will have the
! * identifier {@code columnName}. {@code columnData} is the
! * optional array of data for the column. If it is {@code null}
! * the column is filled with {@code null} values. Otherwise,
* the new data will be added to model starting with the first
* element going to row 0, etc. This method will send a
! * {@code tableChanged} notification message to all the listeners.
*
* @param columnName identifier of the newly created column
* @param columnData new data to be added to the column
*
* @see #addColumn(Object, Vector)
*** 615,626 ****
/**
* Returns the column name.
*
* @return a name for this column using the string value of the
! * appropriate member in <code>columnIdentifiers</code>.
! * If <code>columnIdentifiers</code> does not have an entry
* for this index, returns the default
* name provided by the superclass.
*/
public String getColumnName(int column) {
Object id = null;
--- 615,626 ----
/**
* Returns the column name.
*
* @return a name for this column using the string value of the
! * appropriate member in {@code columnIdentifiers}.
! * If {@code columnIdentifiers} does not have an entry
* for this index, returns the default
* name provided by the superclass.
*/
public String getColumnName(int column) {
Object id = null;
*** 644,655 ****
public boolean isCellEditable(int row, int column) {
return true;
}
/**
! * Returns an attribute value for the cell at <code>row</code>
! * and <code>column</code>.
*
* @param row the row whose value is to be queried
* @param column the column whose value is to be queried
* @return the value Object at the specified cell
* @exception ArrayIndexOutOfBoundsException if an invalid row or
--- 644,655 ----
public boolean isCellEditable(int row, int column) {
return true;
}
/**
! * Returns an attribute value for the cell at {@code row}
! * and {@code column}.
*
* @param row the row whose value is to be queried
* @param column the column whose value is to be queried
* @return the value Object at the specified cell
* @exception ArrayIndexOutOfBoundsException if an invalid row or
*** 660,672 ****
Vector<Object> rowVector = dataVector.elementAt(row);
return rowVector.elementAt(column);
}
/**
! * Sets the object value for the cell at <code>column</code> and
! * <code>row</code>. <code>aValue</code> is the new value. This method
! * will generate a <code>tableChanged</code> notification.
*
* @param aValue the new value; this can be null
* @param row the row whose value is to be changed
* @param column the column whose value is to be changed
* @exception ArrayIndexOutOfBoundsException if an invalid row or
--- 660,672 ----
Vector<Object> rowVector = dataVector.elementAt(row);
return rowVector.elementAt(column);
}
/**
! * Sets the object value for the cell at {@code column} and
! * {@code row}. {@code aValue} is the new value. This method
! * will generate a {@code tableChanged} notification.
*
* @param aValue the new value; this can be null
* @param row the row whose value is to be changed
* @param column the column whose value is to be changed
* @exception ArrayIndexOutOfBoundsException if an invalid row or
*** 684,695 ****
//
/**
* Returns a vector that contains the same objects as the array.
* @param anArray the array to be converted
! * @return the new vector; if <code>anArray</code> is <code>null</code>,
! * returns <code>null</code>
*/
protected static Vector<Object> convertToVector(Object[] anArray) {
if (anArray == null) {
return null;
}
--- 684,695 ----
//
/**
* Returns a vector that contains the same objects as the array.
* @param anArray the array to be converted
! * @return the new vector; if {@code anArray} is {@code null},
! * returns {@code null}
*/
protected static Vector<Object> convertToVector(Object[] anArray) {
if (anArray == null) {
return null;
}
*** 701,712 ****
}
/**
* Returns a vector of vectors that contains the same objects as the array.
* @param anArray the double array to be converted
! * @return the new vector of vectors; if <code>anArray</code> is
! * <code>null</code>, returns <code>null</code>
*/
protected static Vector<Vector<Object>> convertToVector(Object[][] anArray) {
if (anArray == null) {
return null;
}
--- 701,712 ----
}
/**
* Returns a vector of vectors that contains the same objects as the array.
* @param anArray the double array to be converted
! * @return the new vector of vectors; if {@code anArray} is
! * {@code null}, returns {@code null}
*/
protected static Vector<Vector<Object>> convertToVector(Object[][] anArray) {
if (anArray == null) {
return null;
}
< prev index next >