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


Java TableModelEvent.HEADER_ROW属性代码示例

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


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

示例1: tableChanged

@Override
public void tableChanged(TableModelEvent e) {
    super.tableChanged(e);
    // If table isn't empty
    if (!(e.getFirstRow() == TableModelEvent.HEADER_ROW)) {
        this.getSelectionModel().setSelectionInterval(0, 0);
        this.requestFocus();
    }
}
 
开发者ID:phweda,项目名称:MFM,代码行数:9,代码来源:MachineListTable.java

示例2: tableChanged

public void tableChanged(TableModelEvent e) {

    		Object blank = "";

            if(e.getType() == TableModelEvent.UPDATE) {
            	if(e.getColumn() == TableModelEvent.ALL_COLUMNS) {
            		;
            	}
            	else if(e.getFirstRow() == TableModelEvent.HEADER_ROW) {
            		;
            	}
            	else {
		    		if(e.getFirstRow() == numRows-1) {
		    		    if(getValueAt(e.getFirstRow(), e.getColumn()).equals(blank) == false) {
		    		    	addEmptyRow();	
		    			}
		    		}
            	}
	    	}
            else if(e.getType() == TableModelEvent.DELETE) {
            }
    	}
 
开发者ID:etomica,项目名称:etomica,代码行数:22,代码来源:DeviceTableModelGeneric.java

示例3: tableChanged

/***
 * Intercept changes to model so we can re-add our columns
 * @param e the table event
 */
@Override
public void tableChanged(TableModelEvent e)
{
	if (e == null || e.getFirstRow() == TableModelEvent.HEADER_ROW)
	{
		TableColumnModel tcm = getColumnModel();
		TableModel m = getModel();
		
		if (m != null)
		{
			// Remove any current columns
			while (tcm.getColumnCount() > 0) {
				tcm.removeColumn(tcm.getColumn(0));
			}

			// Create new columns from the data model info
			for (int ii = startModelColumn; ii < m.getColumnCount() && ii < endModelColumn; ii++) {
				TableColumn newColumn = new TableColumn(ii);
				addColumn(newColumn);
			}
		}
	}
	
	super.tableChanged(e);
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:29,代码来源:TableBase.java

示例4: tableChanged

public void tableChanged(TableModelEvent e) {
	// If a row changed and is a complete entry(both x and y values)
	// plot the points on the display.
	if(e.getType() == TableModelEvent.UPDATE) {
   		Object blank = "";
   		if(e.getFirstRow() != TableModelEvent.HEADER_ROW) {
    		if(tableModel.getValueAt(e.getFirstRow(), 0).equals(blank) == false &&
    		   tableModel.getValueAt(e.getFirstRow(), 1).equals(blank) == false) {
                updateAction.actionPerformed();
            }
   		}
	}
	// If a row is removed, remove it from the display.
   	else if(e.getType() == TableModelEvent.DELETE) {
           updateAction.actionPerformed();
   	}
}
 
开发者ID:etomica,项目名称:etomica,代码行数:17,代码来源:DevicePlotPoints.java

示例5: tableModelEventToString

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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:EventBroadcaster.java

示例6: getValueAt

/**
 * Get the value in the given table cell.
 * @param row row where cell resides
 * @param col column where cell resides
 * @return the value of the given table cell wrapped as an Object
 */
public Object getValueAt(int row, int col) {
    if (row == TableModelEvent.HEADER_ROW)
        return columnNames[col];
    else if (col == TableModelEvent.ALL_COLUMNS)
    	return null;

	Object value = "";

	if(data.size() >= row) {
	    value = ((TableDataType)(data.get(row))).value[col];
	}
	return value;
}
 
开发者ID:etomica,项目名称:etomica,代码行数:19,代码来源:DeviceTableModelGeneric.java

示例7: tableChanged

@Override
public void tableChanged(TableModelEvent e)
{
    super.tableChanged(e);
    if (e == null || e.getFirstRow() == TableModelEvent.HEADER_ROW) {
        setColumnWidths();
    }
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:8,代码来源:MergeStatusTable.java

示例8: tableChanged

/**
 * Overridden to make sure column sizes are maintained
 */
@Override
public void tableChanged(TableModelEvent e) {
	super.tableChanged(e);
	if ((e == null || e.getFirstRow() == TableModelEvent.HEADER_ROW)) {
		sizeColumns();
	}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:10,代码来源:ExactTable.java

示例9: tableChanged

/**
 * Overridden to make sure column sizes are mantained
 */
@Override
public void tableChanged(TableModelEvent e) {
	super.tableChanged(e);
	if ((e == null || e.getFirstRow() == TableModelEvent.HEADER_ROW)) {
		sizeColumns();
	}
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:10,代码来源:ExactTable.java

示例10: tableChanged

/**
 * 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,代码行数:19,代码来源:XJTable.java

示例11: tableChanged

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,代码行数:46,代码来源:TableSorter.java

示例12: tableChanged

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,代码行数:42,代码来源:TableSorter.java

示例13: tableChanged

@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,代码行数:56,代码来源:TableSorter.java

示例14: tableChanged

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,代码行数:59,代码来源:TableSorter.java

示例15: tableChanged

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,代码行数:55,代码来源:TableSorter.java


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