javax.swing.event.TableModelEvent#getColumn()源码实例Demo

下面列出了javax.swing.event.TableModelEvent#getColumn() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: netbeans   文件: CustomizerWar.java
public void tableChanged(TableModelEvent e) {
    if (e.getColumn() != 1) {
        return;
    }
    TableModel listModel = uiProperties.WAR_CONTENT_ADDITIONAL_MODEL;
    ClassPathSupport.Item cpItem = (ClassPathSupport.Item) listModel.getValueAt(e.getFirstRow(), 0);
    String newPathInWar = (String) listModel.getValueAt(e.getFirstRow(), 1);
    String message = null;
    if (cpItem.getType() == ClassPathSupport.Item.TYPE_JAR && newPathInWar.startsWith("WEB-INF")) { //NOI18N
        if (newPathInWar.equals("WEB-INF\\lib") || newPathInWar.equals("WEB-INF/lib")) { //NOI18N
            if (cpItem.getResolvedFile().isDirectory()) {
                message = NbBundle.getMessage(CustomizerWar.class,
                    "MSG_NO_FOLDER_IN_WEBINF_LIB", newPathInWar); // NOI18N
            } else {
                message = NbBundle.getMessage(CustomizerWar.class,
                    "MSG_NO_FILE_IN_WEBINF_LIB", newPathInWar); // NOI18N
            }
        } else if (newPathInWar.equals("WEB-INF\\classes") || newPathInWar.equals("WEB-INF/classes")) { //NOI18N
                message = NbBundle.getMessage(CustomizerWar.class,
                    "MSG_NO_FOLDER_IN_WEBINF_CLASSES", newPathInWar); // NOI18N
        }
    }
    if (message != null) {
        DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message (message, NotifyDescriptor.WARNING_MESSAGE));
    }
}
 
源代码2 项目: pentaho-reporting   文件: SubSetTableModel.java
/**
 * This fine grain notification tells listeners the exact range of cells, rows, or columns that changed. The
 * received rows are translated to fit the external tablemodel size.
 *
 * @param e
 *          the event, that should be translated.
 */
public void tableChanged( final TableModelEvent e ) {
  int firstRow = e.getFirstRow();
  if ( e.getFirstRow() > 0 ) {
    firstRow -= getStart();
  }

  int lastRow = e.getLastRow();
  if ( lastRow > 0 ) {
    lastRow -= getStart();
    lastRow -= ( getEnclosedModel().getRowCount() - getEnd() );
  }
  final int type = e.getType();
  final int column = e.getColumn();

  final TableModelEvent event = new TableModelEvent( SubSetTableModel.this, firstRow, lastRow, column, type );

  for ( int i = 0; i < listeners.size(); i++ ) {
    final TableModelListener l = (TableModelListener) listeners.get( i );
    l.tableChanged( event );
  }
}
 
源代码3 项目: mars-sim   文件: BarChartTab.java
/**
 * The underlying model has changed.
 */
public void tableChanged(TableModelEvent e) {
 if ((e.getType() == TableModelEvent.INSERT) ||
		 (e.getType() == TableModelEvent.DELETE)) {
	 loadCategories();
	 fireDatasetChanged();
 }
 else if (e.getColumn() == TableModelEvent.ALL_COLUMNS) fireDatasetChanged();
 else {
	 boolean dataChanged = false;
	 for (int column : columns) {
		 if (column == e.getColumn()) dataChanged = true;
	 }
	 if (dataChanged) {
		 long time = System.nanoTime() / 1000000L;
		 if ((time - lastUpdateTime) > MIN_TIME_BETWEEN_UPDATES) {
			 lastUpdateTime = time;
			 fireDatasetChanged();
		 }
	 }
 }
}
 
源代码4 项目: java-swing-tips   文件: MainPanel.java
@Override public void tableChanged(TableModelEvent e) {
  if (e.getType() == TableModelEvent.UPDATE && e.getColumn() == targetColumnIndex) {
    int vci = table.convertColumnIndexToView(targetColumnIndex);
    TableColumn column = table.getColumnModel().getColumn(vci);
    Object status = column.getHeaderValue();
    TableModel m = table.getModel();
    if (m instanceof DefaultTableModel && fireUpdateEvent((DefaultTableModel) m, column, status)) {
      JTableHeader h = table.getTableHeader();
      h.repaint(h.getHeaderRect(vci));
    }
  }
}
 
源代码5 项目: netbeans   文件: EventBroadcaster.java
private static String tableModelEventToString (TableModelEvent e) {
    StringBuilder sb = new StringBuilder();
    sb.append ("TableModelEvent ");
    switch (e.getType()) {
        case TableModelEvent.INSERT : sb.append ("insert ");
             break;
        case TableModelEvent.DELETE : sb.append ("delete ");
             break;
        case TableModelEvent.UPDATE : sb.append ("update ");
             break;
        default : sb.append("Unknown type ").append(e.getType());
    }
    sb.append ("from ");
    switch (e.getFirstRow()) {
        case TableModelEvent.HEADER_ROW : sb.append ("header row ");
            break;
        default : sb.append (e.getFirstRow());
                  sb.append (' ');
    }
    sb.append ("to ");
    sb.append (e.getLastRow());
    sb.append (" column ");
    switch (e.getColumn()) {
        case TableModelEvent.ALL_COLUMNS :
            sb.append ("ALL_COLUMNS");
            break;
        default : sb.append (e.getColumn());
    }
    return sb.toString();
}
 
源代码6 项目: mae-annotation   文件: AdjudicationTableModel.java
@Override
void propagateChange(TableModelEvent event, String tid, String newValue, List<Integer> oldSpans) {
    if (event.getColumn() == TablePanelController.SPANS_COL) {
        try {
            propagateToCurrentTableAndGetNewText(event, newValue, oldSpans);
        } catch (MaeException ignored) {
            // this spanstring is already validated within getMain().updateDB() method
        }
    }
}
 
源代码7 项目: hprof-tools   文件: ClassesInfoPanel.java
@Override
public void tableChanged(TableModelEvent event) {
    if (event.getFirstRow() == 0 && event.getColumn() == 0) {
        String query = dataTable.getModel().getValueAt(0, 0).toString();
        presenter.onQueryByName(query);
    }
}
 
源代码8 项目: Spark   文件: CertificatesManagerSettingsPanel.java
@Override
public void tableChanged(TableModelEvent e) {
	int row = e.getFirstRow();
    int column = e.getColumn();
    if (column == 2) {
        TableModel model = (TableModel) e.getSource();
        Boolean checked = (Boolean) model.getValueAt(row, column);
		certControll.addOrRemoveFromExceptionList(checked);
	}
}
 
源代码9 项目: java-swing-tips   文件: HeaderCheckBoxHandler.java
@Override public void tableChanged(TableModelEvent e) {
  if (e.getType() == TableModelEvent.UPDATE && e.getColumn() == targetColumnIndex) {
    int vci = table.convertColumnIndexToView(targetColumnIndex);
    TableColumn column = table.getColumnModel().getColumn(vci);
    Object status = column.getHeaderValue();
    TableModel m = table.getModel();
    if (m instanceof DefaultTableModel && fireUpdateEvent((DefaultTableModel) m, column, status)) {
      JTableHeader h = table.getTableHeader();
      h.repaint(h.getHeaderRect(vci));
    }
  }
}
 
public void tableChanged( final TableModelEvent e ) {
  recomputeRowCount();
  if ( e.getFirstRow() == 0 && e.getLastRow() == Integer.MAX_VALUE ) {
    // a table-data-changed event..
    applyFilter();
    fireTableModelEvent( new TableModelEvent( DefaultFilterTableModel.this,
      e.getFirstRow(), e.getLastRow(), e.getColumn(), e.getType() ) );
    return;
  }

  final TableModelEvent event = new TableModelEvent( DefaultFilterTableModel.this,
    mapFromModel( e.getFirstRow() ), mapFromModel( e.getLastRow() ), e.getColumn(), e.getType() );
  fireTableModelEvent( event );
}
 
源代码11 项目: marathonv5   文件: TableSorter.java
public void tableChanged(TableModelEvent e) {
    // If we're not sorting by anything, just pass the event along.
    if (!isSorting()) {
        clearSortingState();
        fireTableChanged(e);
        return;
    }

    // If the table structure has changed, cancel the sorting; the
    // sorting columns may have been either moved or deleted from
    // the model.
    if (e.getFirstRow() == TableModelEvent.HEADER_ROW) {
        cancelSorting();
        fireTableChanged(e);
        return;
    }

    // We can map a cell event through to the view without widening
    // when the following conditions apply:
    //
    // a) all the changes are on one row (e.getFirstRow() ==
    // e.getLastRow()) and,
    // b) all the changes are in one column (column !=
    // TableModelEvent.ALL_COLUMNS) and,
    // c) we are not sorting on that column (getSortingStatus(column) ==
    // NOT_SORTED) and,
    // d) a reverse lookup will not trigger a sort (modelToView != null)
    //
    // Note: INSERT and DELETE events fail this test as they have column
    // == ALL_COLUMNS.
    //
    // The last check, for (modelToView != null) is to see if
    // modelToView
    // is already allocated. If we don't do this check; sorting can
    // become
    // a performance bottleneck for applications where cells
    // change rapidly in different parts of the table. If cells
    // change alternately in the sorting column and then outside of
    // it this class can end up re-sorting on alternate cell updates -
    // which can be a performance problem for large tables. The last
    // clause avoids this problem.
    int column = e.getColumn();
    if (e.getFirstRow() == e.getLastRow() && column != TableModelEvent.ALL_COLUMNS && getSortingStatus(column) == NOT_SORTED
            && modelToView != null) {
        int viewIndex = getModelToView()[e.getFirstRow()];
        fireTableChanged(new TableModelEvent(TableSorter.this, viewIndex, viewIndex, column, e.getType()));
        return;
    }

    // Something has happened to the data that may have invalidated the
    // row order.
    clearSortingState();
    fireTableDataChanged();
    return;
}
 
源代码12 项目: wandora   文件: TableSorter.java
public void tableChanged(TableModelEvent e) {
    // If we're not sorting by anything, just pass the event along.             
    if (!isSorting()) {
        clearSortingState();
        fireTableChanged(e);
        return;
    }
        
    // If the table structure has changed, cancel the sorting; the             
    // sorting columns may have been either moved or deleted from             
    // the model. 
    if (e.getFirstRow() == TableModelEvent.HEADER_ROW) {
        cancelSorting();
        fireTableChanged(e);
        return;
    }

    // We can map a cell event through to the view without widening             
    // when the following conditions apply: 
    // 
    // a) all the changes are on one row (e.getFirstRow() == e.getLastRow()) and, 
    // b) all the changes are in one column (column != TableModelEvent.ALL_COLUMNS) and,
    // c) we are not sorting on that column (getSortingStatus(column) == NOT_SORTED) and, 
    // d) a reverse lookup will not trigger a sort (modelToView != null)
    //
    // Note: INSERT and DELETE events fail this test as they have column == ALL_COLUMNS.
    // 
    // The last check, for (modelToView != null) is to see if modelToView 
    // is already allocated. If we don't do this check; sorting can become 
    // a performance bottleneck for applications where cells  
    // change rapidly in different parts of the table. If cells 
    // change alternately in the sorting column and then outside of             
    // it this class can end up re-sorting on alternate cell updates - 
    // which can be a performance problem for large tables. The last 
    // clause avoids this problem. 
    int column = e.getColumn();
    if (e.getFirstRow() == e.getLastRow()
            && column != TableModelEvent.ALL_COLUMNS
            && getSortingStatus(column) == NOT_SORTED
            && modelToView != null) {
        int viewIndex = getModelToView()[e.getFirstRow()];
        fireTableChanged(new TableModelEvent(TableSorter.this, 
                                             viewIndex, viewIndex, 
                                             column, e.getType()));
        return;
    }

    // Something has happened to the data that may have invalidated the row order. 
    clearSortingState();
    fireTableDataChanged();
    return;
}
 
源代码13 项目: jplag   文件: AdminTool.java
public void tableChanged(TableModelEvent e) {
	if (e.getColumn() == TableModelEvent.ALL_COLUMNS)
		return;
	BackedUserData bud = getUserTableModel().getBackedUserData(e.getFirstRow());
	userDataChanged(bud);
}
 
源代码14 项目: netbeans   文件: TableSorter.java
public void tableChanged(TableModelEvent e) {
    // If we're not sorting by anything, just pass the event along.             
    if (!isSorting()) {
        clearSortingState();
        fireTableChanged(e);
        return;
    }
    // If the table structure has changed, cancel the sorting; the             
    // sorting columns may have been either moved or deleted from             
    // the model. 
    if (e.getFirstRow() == TableModelEvent.HEADER_ROW) {
        cancelSorting();
        fireTableChanged(e);
        return;
    }
    // We can map a cell event through to the view without widening             
    // when the following conditions apply: 
    // 
    // a) all the changes are on one row (e.getFirstRow() == e.getLastRow()) and, 
    // b) all the changes are in one column (column != TableModelEvent.ALL_COLUMNS) and,
    // c) we are not sorting on that column (getSortingStatus(column) == NOT_SORTED) and, 
    // d) a reverse lookup will not trigger a sort (modelToView != null)
    //
    // Note: INSERT and DELETE events fail this test as they have column == ALL_COLUMNS.
    // 
    // The last check, for (modelToView != null) is to see if modelToView 
    // is already allocated. If we don't do this check; sorting can become 
    // a performance bottleneck for applications where cells  
    // change rapidly in different parts of the table. If cells 
    // change alternately in the sorting column and then outside of             
    // it this class can end up re-sorting on alternate cell updates - 
    // which can be a performance problem for large tables. The last 
    // clause avoids this problem. 
    int column = e.getColumn();
    if (e.getFirstRow() == e.getLastRow() && column != TableModelEvent.ALL_COLUMNS && getSortingStatus(column) == NOT_SORTED && modelToView != null) {
        int viewIndex = getModelToView()[e.getFirstRow()];
        fireTableChanged(new TableModelEvent(TableSorter.this,
                viewIndex, viewIndex,
                column, e.getType()));
        return;
    }
    // Something has happened to the data that may have invalidated the row order. 
    clearSortingState();
    fireTableDataChanged();
    return;
}
 
源代码15 项目: gate-core   文件: XJTable.java
/**
 * This gets events from the source model and forwards them to the UI
 */
@Override
public void tableChanged(TableModelEvent e){
  int type = e.getType();
  int firstRow = e.getFirstRow();
  int lastRow = e.getLastRow();
  int column = e.getColumn();
  
  //deal with the changes in the data
  //we have no way to "repair" the sorting on data updates so we will need
  //to rebuild the order every time
  
  switch(type){
    case TableModelEvent.UPDATE:
      if(firstRow == TableModelEvent.HEADER_ROW){
        //complete structure change -> reallocate the data
        init(sourceModel);
        newColumns();
        fireTableStructureChanged();
        if(isSortable()) sort();
      }else if(lastRow == Integer.MAX_VALUE){
        //all data changed (including the number of rows)
        init(sourceModel);
        if(isSortable()){
          sort();
        } else {
          //this will re-create all rows (which deletes the rowModel in JTable)
          componentSizedProperly = false;
          fireTableDataChanged();
        }
      }else{
        //the rows should have normal values
        //if the sortedColumn is not affected we don't care
        if(isSortable() &&
           (column == sortedColumn || 
            column == TableModelEvent.ALL_COLUMNS)){
            //re-sorting will also fire the event upwards
            sort();
        }else{
          componentSizedProperly = false;
          fireTableChanged(new TableModelEvent(this,  
                  sourceToTarget(firstRow), 
                  sourceToTarget(lastRow), column, type));
          
        }
      }
      break;
    case TableModelEvent.INSERT:
      //rows were inserted -> we need to rebuild
      init(sourceModel);
      if(firstRow != TableModelEvent.HEADER_ROW && firstRow == lastRow){
        //single row insertion
        if(isSortable()) sort();
        else{
          componentSizedProperly = false;
          fireTableChanged(new TableModelEvent(this,  
                sourceToTarget(firstRow), 
                sourceToTarget(lastRow), column, type));
        }
      }else{
        //the real rows are not in sequence
        if(isSortable()) sort();
        else {
          //this will re-create all rows (which deletes the rowModel in JTable)
          componentSizedProperly = false;
          fireTableDataChanged();
        }
      }
      break;
    case TableModelEvent.DELETE:
      //rows were deleted -> we need to rebuild
      init(sourceModel);
      if(isSortable()) sort();
      else {
        //this will re-create all rows (which deletes the rowModel in JTable)
        componentSizedProperly = false;
        fireTableDataChanged();
      }
  }
}
 
源代码16 项目: evosql   文件: TableSorter.java
public void tableChanged(TableModelEvent e) {

            // If we're not sorting by anything, just pass the event along.
            if (!isSorting()) {
                clearSortingState();
                fireTableChanged(e);

                return;
            }

            // If the table structure has changed, cancel the sorting; the
            // sorting columns may have been either moved or deleted from
            // the model.
            if (e == null || e.getFirstRow() == TableModelEvent.HEADER_ROW) {
                cancelSorting();
                fireTableChanged(e);

                return;
            }

            // We can map a cell event through to the view without widening
            // when the following conditions apply:
            //
            // a) all the changes are on one row (e.getFirstRow() == e.getLastRow()) and,
            // b) all the changes are in one column (column != TableModelEvent.ALL_COLUMNS) and,
            // c) we are not sorting on that column (getSortingStatus(column) == NOT_SORTED) and,
            // d) a reverse lookup will not trigger a sort (modelToView != null)
            //
            // Note: INSERT and DELETE events fail this test as they have column == ALL_COLUMNS.
            //
            // The last check, for (modelToView != null) is to see if modelToView
            // is already allocated. If we don't do this check; sorting can become
            // a performance bottleneck for applications where cells
            // change rapidly in different parts of the table. If cells
            // change alternately in the sorting column and then outside of
            // it this class can end up re-sorting on alternate cell updates -
            // which can be a performance problem for large tables. The last
            // clause avoids this problem.
            int column = e.getColumn();

            if (e.getFirstRow() == e.getLastRow()
                    && column != TableModelEvent.ALL_COLUMNS
                    && getSortingStatus(column) == NOT_SORTED
                    && modelToView != null) {
                int viewIndex = getModelToView()[e.getFirstRow()];

                fireTableChanged(new TableModelEvent(TableSorter.this,
                                                     viewIndex, viewIndex,
                                                     column, e.getType()));

                return;
            }

            // Something has happened to the data that may have invalidated the row order.
            clearSortingState();
            fireTableDataChanged();

            return;
        }
 
源代码17 项目: Logisim   文件: TableSorter.java
@Override
public void tableChanged(TableModelEvent e) {
	// If we're not sorting by anything, just pass the event along.
	if (!isSorting()) {
		clearSortingState();
		fireTableChanged(e);
		return;
	}

	// If the table structure has changed, cancel the sorting; the
	// sorting columns may have been either moved or deleted from
	// the model.
	if (e.getFirstRow() == TableModelEvent.HEADER_ROW) {
		cancelSorting();
		fireTableChanged(e);
		return;
	}

	// We can map a cell event through to the view without widening
	// when the following conditions apply:
	//
	// a) all the changes are on one row (e.getFirstRow() ==
	// e.getLastRow()) and,
	// b) all the changes are in one column (column !=
	// TableModelEvent.ALL_COLUMNS) and,
	// c) we are not sorting on that column (getSortingStatus(column) ==
	// NOT_SORTED) and,
	// d) a reverse lookup will not trigger a sort (modelToView != null)
	//
	// Note: INSERT and DELETE events fail this test as they have column
	// == ALL_COLUMNS.
	//
	// The last check, for (modelToView != null) is to see if
	// modelToView
	// is already allocated. If we don't do this check; sorting can
	// become
	// a performance bottleneck for applications where cells
	// change rapidly in different parts of the table. If cells
	// change alternately in the sorting column and then outside of
	// it this class can end up re-sorting on alternate cell updates -
	// which can be a performance problem for large tables. The last
	// clause avoids this problem.
	int column = e.getColumn();
	if (e.getFirstRow() == e.getLastRow() && column != TableModelEvent.ALL_COLUMNS
			&& getSortingStatus(column) == NOT_SORTED && modelToView != null) {
		int viewIndex = getModelToView()[e.getFirstRow()];
		fireTableChanged(new TableModelEvent(TableSorter.this, viewIndex, viewIndex, column, e.getType()));
		return;
	}

	// Something has happened to the data that may have invalidated the
	// row order.
	clearSortingState();
	fireTableDataChanged();
	return;
}
 
源代码18 项目: tda   文件: TableSorter.java
public void tableChanged(TableModelEvent e) {
    // If we're not sorting by anything, just pass the event along.             
    if (!isSorting()) {
        clearSortingState();
        fireTableChanged(e);
        return;
    }
        
    // If the table structure has changed, cancel the sorting; the             
    // sorting columns may have been either moved or deleted from             
    // the model. 
    if (e.getFirstRow() == TableModelEvent.HEADER_ROW) {
        cancelSorting();
        fireTableChanged(e);
        return;
    }

    // We can map a cell event through to the view without widening             
    // when the following conditions apply: 
    // 
    // a) all the changes are on one row (e.getFirstRow() == e.getLastRow()) and, 
    // b) all the changes are in one column (column != TableModelEvent.ALL_COLUMNS) and,
    // c) we are not sorting on that column (getSortingStatus(column) == NOT_SORTED) and, 
    // d) a reverse lookup will not trigger a sort (modelToView != null)
    //
    // Note: INSERT and DELETE events fail this test as they have column == ALL_COLUMNS.
    // 
    // The last check, for (modelToView != null) is to see if modelToView 
    // is already allocated. If we don't do this check; sorting can become 
    // a performance bottleneck for applications where cells  
    // change rapidly in different parts of the table. If cells 
    // change alternately in the sorting column and then outside of             
    // it this class can end up re-sorting on alternate cell updates - 
    // which can be a performance problem for large tables. The last 
    // clause avoids this problem. 
    int column = e.getColumn();
    if (e.getFirstRow() == e.getLastRow()
            && column != TableModelEvent.ALL_COLUMNS
            && getSortingStatus(column) == NOT_SORTED
            && modelToView != null) {
        int viewIndex = getModelToView()[e.getFirstRow()];
        fireTableChanged(new TableModelEvent(TableSorter.this, 
                                             viewIndex, viewIndex, 
                                             column, e.getType()));
        return;
    }

    // Something has happened to the data that may have invalidated the row order. 
    clearSortingState();
    fireTableDataChanged();
    return;
}
 
@Override
public void tableChanged(TableModelEvent e) {
	// If we're not sorting by anything, just pass the event along.
	if (!isSorting()) {
		clearSortingState();
		fireTableChanged(e);
		return;
	}

	// If the table structure has changed, cancel the sorting; the
	// sorting columns may have been either moved or deleted from
	// the model.
	if (e.getFirstRow() == TableModelEvent.HEADER_ROW) {
		cancelSorting();
		fireTableChanged(e);
		return;
	}

	// We can map a cell event through to the view without widening
	// when the following conditions apply:
	//
	// a) all the changes are on one row (e.getFirstRow() == e.getLastRow()) and,
	// b) all the changes are in one column (column != TableModelEvent.ALL_COLUMNS) and,
	// c) we are not sorting on that column (getSortingStatus(column) == NOT_SORTED) and,
	// d) a reverse lookup will not trigger a sort (modelToView != null)
	//
	// Note: INSERT and DELETE events fail this test as they have column == ALL_COLUMNS.
	//
	// The last check, for (modelToView != null) is to see if modelToView
	// is already allocated. If we don't do this check; sorting can become
	// a performance bottleneck for applications where cells
	// change rapidly in different parts of the table. If cells
	// change alternately in the sorting column and then outside of
	// it this class can end up re-sorting on alternate cell updates -
	// which can be a performance problem for large tables. The last
	// clause avoids this problem.
	int column = e.getColumn();
	if (e.getFirstRow() == e.getLastRow() && column != TableModelEvent.ALL_COLUMNS
			&& getSortingStatus(column) == NOT_SORTED && modelToView != null) {
		int viewIndex = getModelToView()[e.getFirstRow()];
		fireTableChanged(new TableModelEvent(ExtendedJTableSorterModel.this, viewIndex, viewIndex, column,
				e.getType()));
		return;
	}

	// Something has happened to the data that may have invalidated the row order.
	clearSortingState();
	fireTableDataChanged();
	return;
}
 
源代码20 项目: binnavi   文件: CTableSorter.java
@Override
public void tableChanged(final TableModelEvent e) {
  // If we're not sorting by anything, just pass the event along.
  if (!isSorting()) {
    clearSortingState();
    fireTableChanged(e);
    return;
  }

  // If the table structure has changed, cancel the sorting; the
  // sorting columns may have been either moved or deleted from
  // the model.
  if (e.getFirstRow() == TableModelEvent.HEADER_ROW) {
    cancelSorting();
    fireTableChanged(e);
    return;
  }

  // We can map a cell event through to the view without widening
  // when the following conditions apply:
  //
  // a) all the changes are on one row (e.getFirstRow() == e.getLastRow()) and,
  // b) all the changes are in one column (column != TableModelEvent.ALL_COLUMNS) and,
  // c) we are not sorting on that column (getSortingStatus(column) == NOT_SORTED) and,
  // d) a reverse lookup will not trigger a sort (modelToView != null)
  //
  // Note: INSERT and DELETE events fail this test as they have column == ALL_COLUMNS.
  //
  // The last check, for (modelToView != null) is to see if modelToView
  // is already allocated. If we don't do this check; sorting can become
  // a performance bottleneck for applications where cells
  // change rapidly in different parts of the table. If cells
  // change alternately in the sorting column and then outside of
  // it this class can end up re-sorting on alternate cell updates -
  // which can be a performance problem for large tables. The last
  // clause avoids this problem.
  final int column = e.getColumn();
  if ((e.getFirstRow() == e.getLastRow()) && (column != TableModelEvent.ALL_COLUMNS)
      && (getSortingStatus(column) == NOT_SORTED) && (modelToView != null)) {
    final int viewIndex = getModelToView()[e.getFirstRow()];
    fireTableChanged(new TableModelEvent(CTableSorter.this, viewIndex, viewIndex, column,
        e.getType()));
    return;
  }

  // Something has happened to the data that may have invalidated the row order.
  clearSortingState();
  fireTableDataChanged();
  return;
}