List of usage examples for javax.swing.event TableModelEvent INSERT
int INSERT
To view the source code for javax.swing.event TableModelEvent INSERT.
Click Source Link
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;//from www . j av a 2 s. c om } 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;/* w w w . ja va 2s . 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 . jav a 2 s.c om } }); }
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 w ww. jav 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)); }// w w w .ja v a 2 s . c om } }); }
From source file:pl.otros.logview.api.gui.LogViewPanelWrapper.java
private void addRowAutoScroll() { dataTableModel.addTableModelListener(e -> { if (follow.isSelected() && e.getType() == TableModelEvent.INSERT) { final Runnable r = () -> { try { JTable table = logViewPanel.getTable(); int row = table.getRowCount() - 1; if (row > 0) { Rectangle rect = table.getCellRect(row, 0, true); table.scrollRectToVisible(rect); table.clearSelection(); table.setRowSelectionInterval(row, row); }//from w ww . ja va2 s . com } catch (IllegalArgumentException iae) { // ignore..out of bounds iae.printStackTrace(); } }; // Wait for JViewPort size update // TODO Find way to invoke this listener after viewport is notified about changes Runnable r2 = () -> { try { Thread.sleep(300); } catch (InterruptedException ignore) { } SwingUtilities.invokeLater(r); }; new Thread(r2).start(); } }); }
From source file:pl.otros.logview.gui.LogViewPanelWrapper.java
private void addRowScroller() { dataTableModel.addTableModelListener(new TableModelListener() { @Override//from www.j a v a 2 s .c om public void tableChanged(final TableModelEvent e) { if (follow.isSelected() && e.getType() == TableModelEvent.INSERT) { final Runnable r = new Runnable() { @Override public void run() { try { JTable table = logViewPanel.getTable(); int row = table.getRowCount() - 1; if (row > 0) { Rectangle rect = table.getCellRect(row, 0, true); table.scrollRectToVisible(rect); table.clearSelection(); table.setRowSelectionInterval(row, row); } } catch (IllegalArgumentException iae) { // ignore..out of bounds iae.printStackTrace(); } } }; // Wait for JViewPort size update // TODO Find way to invoke this listener after viewport is notified about changes Runnable r2 = new Runnable() { @Override public void run() { try { Thread.sleep(300); } catch (InterruptedException ignore) { } SwingUtilities.invokeLater(r); } }; new Thread(r2).start(); } } }); }