Example usage for javax.swing.event TableModelEvent HEADER_ROW

List of usage examples for javax.swing.event TableModelEvent HEADER_ROW

Introduction

In this page you can find the example usage for javax.swing.event TableModelEvent HEADER_ROW.

Prototype

int HEADER_ROW

To view the source code for javax.swing.event TableModelEvent HEADER_ROW.

Click Source Link

Document

Identifies the header row.

Usage

From source file:org.nuclos.client.ui.collect.model.CollectableTableModelImpl.java

/**
 * adds <code>clctef</code> as column number <code>iColumn</code>
 * @param iColumn/*from  www.java2 s .  c o  m*/
 * @param clctef
 */
@Override
public void addColumn(int iColumn, CollectableEntityField clctef) {
    this.lstclctefColumns.add(iColumn, clctef);
    super.fireTableChanged(
            new TableModelEvent(this, TableModelEvent.HEADER_ROW, TableModelEvent.HEADER_ROW, iColumn));
}

From source file:org.openthinclient.console.util.FilterTableModel.java

public void tableChanged(TableModelEvent e) {
    updateFilteredRows();//from w w w. j a va  2 s. co  m

    if (e.getFirstRow() == TableModelEvent.HEADER_ROW)
        fireTableStructureChanged();
    else
        fireTableDataChanged();
}

From source file:org.wings.STable.java

/**
 * <p>Sets the model of the table.</p>
 *
 * @param tm the <code>TableModel</code> to set.
 *///  w  w  w .java2  s.c o  m
public void setModel(TableModel tm) {
    if (tm == null)
        throw new IllegalArgumentException("Cannot set a null TableModel");

    TableModel oldVal = this.model;
    if (this.model != tm) {
        if (model != null)
            model.removeTableModelListener(this);

        model = tm;
        model.addTableModelListener(this);

        tableChanged(new TableModelEvent(tm, TableModelEvent.HEADER_ROW));
    }
    propertyChangeSupport.firePropertyChange("model", oldVal, this.model);
}

From source file:org.wings.STable.java

public void tableChanged(TableModelEvent e) {
    // kill active editors
    //editingCanceled(null);

    if (e == null || e.getFirstRow() == TableModelEvent.HEADER_ROW) {
        // The whole thing changed
        clearSelectionAndLeadAnchor();/*from  w ww.j a  v  a  2 s  .c om*/
        if (getAutoCreateColumnsFromModel())
            createDefaultColumnsFromModel();
    } else {
        switch (e.getType()) {
        case TableModelEvent.INSERT:
            if (e.getFirstRow() >= 0)
                getSelectionModel().insertIndexInterval(e.getFirstRow(), e.getLastRow(), true);
            break;

        case TableModelEvent.DELETE:
            if (e.getFirstRow() >= 0)
                getSelectionModel().removeIndexInterval(e.getFirstRow(), e.getLastRow());
            break;
        case TableModelEvent.UPDATE:
            /* event fire on javax.swing.table.AbstractTableModel.fireTableDataChanged() */
            if (e.getLastRow() == Integer.MAX_VALUE)
                clearSelectionAndLeadAnchor();
            break;
        }
    }

    if (model.getRowCount() != rowCountBackUp) {
        rowCountBackUp = model.getRowCount();
        fireViewportChanged(false);
    }
    if (columnModel.getColumnCount() != columnCountBackUp) {
        columnCountBackUp = columnModel.getColumnCount();
        fireViewportChanged(true);
    }

    if (e != null && e.getFirstRow() == e.getLastRow() && e.getFirstRow() != TableModelEvent.HEADER_ROW
            && e.getColumn() != TableModelEvent.ALL_COLUMNS && e.getType() == TableModelEvent.UPDATE) {
        if (isUpdatePossible() && STable.class.isAssignableFrom(getClass()))
            update(((TableCG) getCG()).getRenderCellUpdate(this, e.getFirstRow(), e.getColumn()));
        else
            reload();
    }
    /*        else if (e != null &&
    e.getFirstRow() == 0 &&
    e.getLastRow() == Integer.MAX_VALUE &&
    e.getColumn() == TableModelEvent.ALL_COLUMNS &&
    e.getType() == TableModelEvent.UPDATE) {
    update(((TableCG)getCG()).getDataUpdate(this));
            }*/
    else {
        reload();
    }
}