Search in sources :

Example 66 with TableModelListener

use of javax.swing.event.TableModelListener in project zaproxy by zaproxy.

the class UsersTableModelUnitTest method shouldAddTableModelListeners.

@Test
void shouldAddTableModelListeners() {
    // Given
    TableModelListener listener = createTestTableModelListener();
    UsersTableModel usersTableModel = new UsersTableModel();
    // When
    usersTableModel.addTableModelListener(listener);
    // Then
    assertThat(usersTableModel.getTableModelListeners(), is(arrayContaining(listener)));
}
Also used : TableModelListener(javax.swing.event.TableModelListener) UsersTableModel(org.zaproxy.zap.extension.users.UsersTableModel) Test(org.junit.jupiter.api.Test)

Example 67 with TableModelListener

use of javax.swing.event.TableModelListener in project zaproxy by zaproxy.

the class UsersTableModelUnitTest method shouldRemoveTableModelListeners.

@Test
void shouldRemoveTableModelListeners() {
    // Given
    TableModelListener listener = createTestTableModelListener();
    UsersTableModel usersTableModel = new UsersTableModel();
    usersTableModel.addTableModelListener(listener);
    // When
    usersTableModel.removeTableModelListener(listener);
    // Then
    assertThat(usersTableModel.getTableModelListeners(), is(emptyArray()));
}
Also used : TableModelListener(javax.swing.event.TableModelListener) UsersTableModel(org.zaproxy.zap.extension.users.UsersTableModel) Test(org.junit.jupiter.api.Test)

Example 68 with TableModelListener

use of javax.swing.event.TableModelListener in project zaproxy by zaproxy.

the class OptionsCheckForUpdatesPanel method getScriptDirModel.

private OptionsAutoupdateDirsTableModel getScriptDirModel() {
    if (scriptDirModel == null) {
        scriptDirModel = new OptionsAutoupdateDirsTableModel();
        scriptDirModel.addTableModelListener(new TableModelListener() {

            @Override
            public void tableChanged(TableModelEvent e) {
                repopulateDownloadDirs();
            }
        });
    }
    return scriptDirModel;
}
Also used : TableModelEvent(javax.swing.event.TableModelEvent) TableModelListener(javax.swing.event.TableModelListener)

Aggregations

TableModelListener (javax.swing.event.TableModelListener)68 TableModelEvent (javax.swing.event.TableModelEvent)54 JScrollPane (javax.swing.JScrollPane)11 Iterator (java.util.Iterator)9 JTable (javax.swing.JTable)9 ListSelectionEvent (javax.swing.event.ListSelectionEvent)9 ActionEvent (java.awt.event.ActionEvent)8 ListSelectionListener (javax.swing.event.ListSelectionListener)8 Dimension (java.awt.Dimension)7 ActionListener (java.awt.event.ActionListener)7 JButton (javax.swing.JButton)7 JPanel (javax.swing.JPanel)7 DefaultTableModel (javax.swing.table.DefaultTableModel)6 TableColumn (javax.swing.table.TableColumn)6 ArrayList (java.util.ArrayList)5 GridBagConstraints (java.awt.GridBagConstraints)4 KeyShortcut (com.igormaznitsa.mindmap.swing.panel.utils.KeyShortcut)3 BorderLayout (java.awt.BorderLayout)3 Insets (java.awt.Insets)3 MouseAdapter (java.awt.event.MouseAdapter)3