当前位置: 首页>>代码示例>>Java>>正文


Java TableModelEvent.getLastRow方法代码示例

本文整理汇总了Java中javax.swing.event.TableModelEvent.getLastRow方法的典型用法代码示例。如果您正苦于以下问题:Java TableModelEvent.getLastRow方法的具体用法?Java TableModelEvent.getLastRow怎么用?Java TableModelEvent.getLastRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.event.TableModelEvent的用法示例。


在下文中一共展示了TableModelEvent.getLastRow方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: tableChanged

import javax.swing.event.TableModelEvent; //导入方法依赖的package包/类
/**
 * Overridden for efficiency reasons (provides a better calculation of the 
 * dirty region). See 
 * <a href="http://www.objectdefinitions.com/odblog/2009/jtable-setrowheight-causes-slow-repainting/">this page</a>
 * for a more complete discussion. 
 */
@Override
public void tableChanged(TableModelEvent e) {
  //if just an update, and not a data or structure changed event or an insert or delete, use the fixed row update handling
  //otherwise call super.tableChanged to let the standard JTable update handling manage it
  if ( e != null &&
      e.getType() == TableModelEvent.UPDATE &&
      e.getFirstRow() != TableModelEvent.HEADER_ROW &&
      e.getLastRow() != Integer.MAX_VALUE) {
      handleRowUpdate(e);
  } else {
      super.tableChanged(e);
  }
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:20,代码来源:XJTable.java

示例2: translateEvent

import javax.swing.event.TableModelEvent; //导入方法依赖的package包/类
/** Creates a TableModelEvent identical to the original except that the
 * column index has been shifted by +1.  This is used to refire events
 * from the ProxyTableModel (generated by RowModel.setValueFor()) as 
 * change events on the OutlineModel. */
private TableModelEvent translateEvent (TableModelEvent e) {
    TableModelEvent nue = new TableModelEvent (getModel(),
        e.getFirstRow(), e.getLastRow(), e.getColumn()+1, e.getType());
    return nue;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:EventBroadcaster.java

示例3: tableChanged

import javax.swing.event.TableModelEvent; //导入方法依赖的package包/类
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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:52,代码来源:TableSorter.java

示例4: tableChanged

import javax.swing.event.TableModelEvent; //导入方法依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:47,代码来源:TableSorter.java

示例5: tableChanged

import javax.swing.event.TableModelEvent; //导入方法依赖的package包/类
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 event is known to be preserving the sorting or 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, 
    //
    // Note: INSERT and DELETE events fail this test as they have column == ALL_COLUMNS.
    int column = e.getColumn();
    if ((e instanceof SortingSafeTableModelEvent)
            || e.getFirstRow() == e.getLastRow()
               && column != TableModelEvent.ALL_COLUMNS
               && getSortingStatus(column) == NOT_SORTED) {
        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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:43,代码来源:TableSorter.java

示例6: tableChanged

import javax.swing.event.TableModelEvent; //导入方法依赖的package包/类
@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;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:51,代码来源:ExtendedJTableSorterModel.java

示例7: tableChanged

import javax.swing.event.TableModelEvent; //导入方法依赖的package包/类
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;
        }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:60,代码来源:TableSorter.java

示例8: tableChanged

import javax.swing.event.TableModelEvent; //导入方法依赖的package包/类
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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:56,代码来源:TableSorter.java

示例9: tableChanged

import javax.swing.event.TableModelEvent; //导入方法依赖的package包/类
@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;
}
 
开发者ID:equella,项目名称:Equella,代码行数:61,代码来源:TableSorter.java

示例10: tableChanged

import javax.swing.event.TableModelEvent; //导入方法依赖的package包/类
@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;
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:57,代码来源:TableSorter.java


注:本文中的javax.swing.event.TableModelEvent.getLastRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。