List of usage examples for javax.swing.event TableModelEvent DELETE
int DELETE
To view the source code for javax.swing.event TableModelEvent DELETE.
Click Source Link
From source file:Main.java
public void tableChanged(TableModelEvent e) { int firstRow = e.getFirstRow(); int lastRow = e.getLastRow(); int index = e.getColumn(); switch (e.getType()) { case TableModelEvent.INSERT: for (int i = firstRow; i <= lastRow; i++) { System.out.println(i); }/*from ww w .j a v a2 s .co m*/ break; case TableModelEvent.UPDATE: if (firstRow == TableModelEvent.HEADER_ROW) { if (index == TableModelEvent.ALL_COLUMNS) { System.out.println("A column was added"); } else { System.out.println(index + "in header changed"); } } else { for (int i = firstRow; i <= lastRow; i++) { if (index == TableModelEvent.ALL_COLUMNS) { System.out.println("All columns have changed"); } else { System.out.println(index); } } } break; case TableModelEvent.DELETE: for (int i = firstRow; i <= lastRow; i++) { System.out.println(i); } break; } }
From source file:com.stanley.captioner.MainFrame.java
private void initListeners() { videoTable.getModel().addTableModelListener(new TableModelListener() { @Override//from w ww.java 2 s . c om public void tableChanged(TableModelEvent e) { if (e.getType() == TableModelEvent.INSERT || e.getType() == TableModelEvent.DELETE) { if (videoTable.getRowCount() > 0) { clearButton.setEnabled(true); if (outputDirectoryField.getText() != null && outputDirectoryField.getText().length() > 0) { convertButton.setEnabled(true); } else { convertButton.setEnabled(false); } } else { clearButton.setEnabled(false); convertButton.setEnabled(false); } } } }); videoTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (videoTable.getSelectedRowCount() > 0) { removeButton.setEnabled(true); } else { removeButton.setEnabled(false); } } }); }
From source file:blue.components.lines.Line.java
public void fireTableRowsDeleted(int firstRow, int lastRow) { fireTableChanged(//from ww w. j ava2 s . c om new TableModelEvent(this, firstRow, lastRow, TableModelEvent.ALL_COLUMNS, TableModelEvent.DELETE)); }
From source file:org.jdal.swing.ListTableModel.java
/** * Remove a object from underlaying list model * @param index column to remove// w ww . j a va2 s. c o m * @return the removed object */ public Object remove(int index) { Object result = list.remove(index); fireTableChanged( new TableModelEvent(this, index, index, TableModelEvent.ALL_COLUMNS, TableModelEvent.DELETE)); return result; }
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();// ww w.j a va 2 s. co 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 was removed./*from www .j a v a 2s . com*/ */ 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;//from w ww.ja v a 2s .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;//www . j a v a 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)); }/* w w w. j a v a 2s . 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 w w w.j av a 2 s. com*/ } 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)); } } }); }