Example usage for javax.swing.event TableModelEvent TableModelEvent

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

Introduction

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

Prototype

public TableModelEvent(TableModel source, int firstRow, int lastRow, int column, int type) 

Source Link

Document

The cells from (firstRow, column) to (lastRow, column) have been changed.

Usage

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;/* ww  w  .  ja  va  2s  . 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  ww w .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));
            }/* ww  w  .j av  a2s. c o  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  .j  av  a2s.co 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));
            }// ww  w  .j a  v  a 2 s . c  om
        }
    });
}