當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。