Example usage for javax.swing.event TableModelEvent ALL_COLUMNS

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

Introduction

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

Prototype

int ALL_COLUMNS

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

Click Source Link

Document

Specifies all columns in a row or rows.

Usage

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 2s. c o m
        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();
    }
}

From source file:phex.gui.models.SearchListTableModel.java

/**
 * Called if a search changed.//from  w  w w  . java 2s.  c om
 */
public void searchChanged(int position) {
    lazyEventQueue.addTableModelEvent(
            new TableModelEvent(this, position, position, TableModelEvent.ALL_COLUMNS, TableModelEvent.UPDATE));
}

From source file:phex.gui.models.SearchListTableModel.java

/**
 * Called if a search was added.//w w  w. j  av a2 s  .  co  m
 */
public void searchAdded(int position) {
    fireTableChanged(
            new TableModelEvent(this, position, position, TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT));
}

From source file:phex.gui.models.SearchListTableModel.java

/**
 * Called if a search was removed./*  w  ww.  j  a va 2  s  . co m*/
 */
public void searchRemoved(int position) {
    fireTableChanged(
            new TableModelEvent(this, position, position, TableModelEvent.ALL_COLUMNS, TableModelEvent.DELETE));
}

From source file:phex.gui.tabs.download.DownloadTransferTableModel.java

@EventTopicSubscriber(topic = PhexEventTopics.Download_Candidate)
public void onDownloadCandidateEvent(String topic, final ContainerEvent event) {
    if (downloadFile != ((SWDownloadCandidate) event.getSource()).getDownloadFile()) {
        return;/*  w  w  w . j  a  va2  s  .c o  m*/
    }
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            int position = event.getPosition();
            if (event.getType() == ContainerEvent.Type.ADDED) {
                fireTableChanged(new TableModelEvent(DownloadTransferTableModel.this, position, position,
                        TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT));
            } else if (event.getType() == ContainerEvent.Type.REMOVED) {
                fireTableChanged(new TableModelEvent(DownloadTransferTableModel.this, position, position,
                        TableModelEvent.ALL_COLUMNS, TableModelEvent.DELETE));
            }
        }
    });
}

From source file:phex.gui.tabs.download.SWCandidateTableModel.java

@EventTopicSubscriber(topic = PhexEventTopics.Download_Candidate)
public void onDownloadCandidateEvent(String topic, final ContainerEvent event) {
    if (downloadFile != ((SWDownloadCandidate) event.getSource()).getDownloadFile()) {
        return;/*from  w ww .  ja  v a 2  s . co m*/
    }
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            int position = event.getPosition();
            if (event.getType() == ContainerEvent.Type.ADDED) {
                fireTableChanged(new TableModelEvent(SWCandidateTableModel.this, position, position,
                        TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT));
            } else if (event.getType() == ContainerEvent.Type.REMOVED) {
                fireTableChanged(new TableModelEvent(SWCandidateTableModel.this, position, position,
                        TableModelEvent.ALL_COLUMNS, TableModelEvent.DELETE));
            }
        }
    });
}

From source file:phex.gui.tabs.download.SWDownloadTableModel.java

@EventTopicSubscriber(topic = PhexEventTopics.Download_File)
public void onDownloadFileEvent(String topic, final ContainerEvent event) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            int position = event.getPosition();
            if (event.getType() == ContainerEvent.Type.ADDED) {
                fireTableChanged(new TableModelEvent(SWDownloadTableModel.this, position, position,
                        TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT));
            } else if (event.getType() == ContainerEvent.Type.REMOVED) {
                fireTableChanged(new TableModelEvent(SWDownloadTableModel.this, position, position,
                        TableModelEvent.ALL_COLUMNS, TableModelEvent.DELETE));
            }/*from   w w  w .ja v  a  2  s  . co  m*/
        }
    });
}

From source file:phex.gui.tabs.search.SearchListTableModel.java

@EventTopicSubscriber(topic = PhexEventTopics.Search_Update)
public void onSearchUpdateEvent(String topic, final ContainerEvent event) {
    if (searchContainer != event.getContainer()) {
        return;/*from www . ja v  a  2  s  .c o  m*/
    }
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            int position = event.getPosition();
            if (event.getType() == ContainerEvent.Type.ADDED) {
                fireTableChanged(new TableModelEvent(SearchListTableModel.this, position, position,
                        TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT));
            } else if (event.getType() == ContainerEvent.Type.REMOVED) {
                fireTableChanged(new TableModelEvent(SearchListTableModel.this, position, position,
                        TableModelEvent.ALL_COLUMNS, TableModelEvent.DELETE));
            }
        }
    });
}

From source file:phex.gui.tabs.upload.UploadFilesTableModel.java

@EventTopicSubscriber(topic = PhexEventTopics.Upload_State)
public void onUploadStateEvent(String topic, final ContainerEvent event) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            int position = event.getPosition();
            if (event.getType() == ContainerEvent.Type.ADDED) {
                fireTableChanged(new TableModelEvent(UploadFilesTableModel.this, position, position,
                        TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT));
            } else if (event.getType() == ContainerEvent.Type.REMOVED) {
                fireTableChanged(new TableModelEvent(UploadFilesTableModel.this, position, position,
                        TableModelEvent.ALL_COLUMNS, TableModelEvent.DELETE));
            }//www  .  j  a  va2 s.  c om
        }
    });
}