@Override protected void fireTableEvent(int arg0, int arg1, int arg2, int arg3) { super.fireTableEvent(arg0, arg1, arg2, arg3); }
/** * Add a row to this table. All data columns will be notified and will * take on the appropriate default values for the added row. * @return the row number of the newly added row */ public int addRow() { int r = m_rows.addRow(); updateRowCount(); fireTableEvent(r, r, TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT); return r; }
fireTableEvent(m_rows.getMinimumRow(), m_rows.getMaximumRow(), idx, TableModelEvent.DELETE);
/** * Handle a column change event. * @param c the modified column * @param start the starting row of the modified range * @param end the ending row (inclusive) of the modified range */ protected void handleColumnChanged(Column c, int start, int end) { for ( ; !isValidRow(start) && start <= end; ++start ); if ( start > end ) return; // bail if no valid rows // determine the index of the updated column int idx; if ( m_lastCol != -1 && c == getColumn(m_lastCol) ) { // constant time idx = m_lastCol; } else { // linear time idx = getColumnNumber(c); } // if we have a valid index, fire a notification if ( idx >= 0 ) { fireTableEvent(start, end, idx, TableModelEvent.UPDATE); } }
fireTableEvent(m_rows.getMinimumRow(), m_rows.getMaximumRow(), m_lastCol, TableModelEvent.INSERT);
/** * Removes a row from this table. * @param row the row to delete * @return true if the row was successfully deleted, false if the * row was already invalid */ public boolean removeRow(int row) { if ( m_rows.isValidRow(row) ) { // the order of operations here is extremely important // otherwise listeners may end up with corrupted state. // fire update *BEFORE* clearing values // allow listeners (e.g., indices) to perform clean-up fireTableEvent(row, row, TableModelEvent.ALL_COLUMNS, TableModelEvent.DELETE); // invalidate the tuple m_tuples.invalidate(row); // release row with row manager // do this before clearing column values, so that any // listeners can determine that the row is invalid m_rows.releaseRow(row); // now clear column values for ( Iterator cols = getColumns(); cols.hasNext(); ) { Column c = (Column)cols.next(); c.revertToDefault(row); } return true; } return false; }