Java Code Examples for javax.swing.event.TableModelListener#tableChanged()

The following examples show how to use javax.swing.event.TableModelListener#tableChanged() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataTableModel.java    From meka with GNU General Public License v3.0 7 votes vote down vote up
/**
 * notfies all listener of the change of the model
 *
 * @param e the event to send to the listeners
 */
public void notifyListener(TableModelEvent e) {
	Iterator<TableModelListener> iter;
	TableModelListener l;

	// is notification enabled?
	if (!isNotificationEnabled()) {
		return;
	}

	iter = m_Listeners.iterator();
	while (iter.hasNext()) {
		l = iter.next();
		l.tableChanged(e);
	}
}
 
Example 2
Source File: GraphTableModel.java    From constellation with Apache License 2.0 6 votes vote down vote up
/**
 * Tell the JTable that the model has changed.
 *
 */
public void graphDataChange() {
    try {
        // Note: if there are any rows in the table, the [firstRow, lastRow] constructor variant must be used.
        // Otherwise, the selection is reset.
        final int nrows = getRowCount();
        final TableModelEvent tme = nrows == 0 ? new TableModelEvent(this) : new TableModelEvent(this, 0, nrows - 1);
        for (final TableModelListener tml : tmls) {
            tml.tableChanged(tme);
        }
    } catch (IndexOutOfBoundsException ex) {
        // This is a known issue as a side effect of not writing on the EDT.
        // I will ware this as a side effect of the quick fix until the Table View is re-written.
        // Logging the fact this is happening so we don't forget.
        LOGGER.log(Level.SEVERE, "Known thread race condition bug. Exception is {0}", ex.getLocalizedMessage());
    }
}
 
Example 3
Source File: TestTableModel.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
public void fireTableDataChanged() {
	TableModelEvent event = new TableModelEvent(this);
	for (TableModelListener listener : listeners) {
		listener.tableChanged(event);
	}
}
 
Example 4
Source File: KeyShortCutEditPanel.java    From netbeans-mmd-plugin with Apache License 2.0 5 votes vote down vote up
private void updateCurrentSelectedForKey (final KeyEvent evt) {
  final int index = this.tableKeyShortcuts.getSelectedRow();
  if (index>=0){
    final KeyShortcut oldShortcut = this.listOfKeys.get(index);
    final int keyCode = evt.getKeyCode();
    final int modifiers = evt.getModifiers() & (KeyEvent.META_MASK | KeyEvent.SHIFT_MASK | KeyEvent.CTRL_MASK | KeyEvent.ALT_MASK);
    final KeyShortcut newShortCut = new KeyShortcut(oldShortcut.getID(),keyCode,modifiers);
    this.listOfKeys.set(index, newShortCut);
    for(final TableModelListener l:this.listeners){
      l.tableChanged(new TableModelEvent(this,index));
    }
  }
  
  updateForSelected();
}
 
Example 5
Source File: KeyShortCutEditPanel.java    From netbeans-mmd-plugin with Apache License 2.0 5 votes vote down vote up
private void updateCurrentSelectedForKey(final KeyEvent evt) {
  final int index = this.tableKeyShortcuts.getSelectedRow();
  if (index >= 0) {
    final KeyShortcut oldShortcut = this.listOfKeys.get(index);
    final int keyCode = evt.getKeyCode();
    final int modifiers = evt.getModifiers() & (KeyEvent.META_MASK | KeyEvent.SHIFT_MASK | KeyEvent.CTRL_MASK | KeyEvent.ALT_MASK);
    final KeyShortcut newShortCut = new KeyShortcut(oldShortcut.getID(), keyCode, modifiers);
    this.listOfKeys.set(index, newShortCut);
    for (final TableModelListener l : this.listeners) {
      l.tableChanged(new TableModelEvent(this, index));
    }
  }

  updateForSelected();
}
 
Example 6
Source File: KeyShortCutEditPanel.java    From netbeans-mmd-plugin with Apache License 2.0 5 votes vote down vote up
private void updateCurrentSelectedForKey (final KeyEvent evt) {
  final int index = this.tableKeyShortcuts.getSelectedRow();
  if (index>=0){
    final KeyShortcut oldShortcut = this.listOfKeys.get(index);
    final int keyCode = evt.getKeyCode();
    final int modifiers = evt.getModifiers() & (KeyEvent.META_MASK | KeyEvent.SHIFT_MASK | KeyEvent.CTRL_MASK | KeyEvent.ALT_MASK);
    final KeyShortcut newShortCut = new KeyShortcut(oldShortcut.getID(),keyCode,modifiers);
    this.listOfKeys.set(index, newShortCut);
    for(final TableModelListener l:this.listeners){
      l.tableChanged(new TableModelEvent(this,index));
    }
  }
  
  updateForSelected();
}
 
Example 7
Source File: FileListPanel.java    From netbeans-mmd-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public void setValueAt(@Nonnull final Object aValue, final int rowIndex, final int columnIndex) {
  final FileSelector selector = this.files.get(rowIndex);
  switch (columnIndex) {
    case 0: selector.setSelected((Boolean)aValue);break;
    default: throw new Error("unexpected column index"); //NOI18N
  }
  final TableModelEvent event = new TableModelEvent(this, rowIndex,rowIndex,columnIndex);
  for(final TableModelListener l : this.listeners){
    l.tableChanged(event);
  }
}
 
Example 8
Source File: ProbeDialog.java    From Digital with GNU General Public License v3.0 4 votes vote down vote up
public void fireChanged() {
    TableModelEvent e = new TableModelEvent(this, 0, signals.size() - 1);
    for (TableModelListener l : listeners)
        l.tableChanged(e);
}
 
Example 9
Source File: TablePagePanel.java    From snap-desktop with GNU General Public License v3.0 4 votes vote down vote up
private void notifyListeners() {
    for (TableModelListener listener : listeners) {
        listener.tableChanged(new TableModelEvent(this));
    }
}
 
Example 10
Source File: PerformanceMonitor.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
void fireUpdate() {
    for(TableModelListener t : listeners) {
        t.tableChanged(new TableModelEvent(this));
    }
}
 
Example 11
Source File: TestAllDialog.java    From Digital with GNU General Public License v3.0 4 votes vote down vote up
private void messageChanged(int row) {
    TableModelEvent te = new TableModelEvent(this, row, row, 1);
    for (TableModelListener l : listener)
        l.tableChanged(te);
}
 
Example 12
Source File: DataEditor.java    From Digital with GNU General Public License v3.0 4 votes vote down vote up
private void fireEvent(TableModelEvent e) {
    for (TableModelListener l : listener)
        l.tableChanged(e);
}
 
Example 13
Source File: TruthTableTableModel.java    From Digital with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Fires a structural table change
 */
public void fireTableChanged() {
    TableModelEvent e = new TableModelEvent(this, HEADER_ROW);
    for (TableModelListener l : listeners)
        l.tableChanged(e);
}
 
Example 14
Source File: TruthTableTableModel.java    From Digital with GNU General Public License v3.0 4 votes vote down vote up
private void fireModelEvent(int rowIndex) {
    TableModelEvent e = new TableModelEvent(this, rowIndex);
    for (TableModelListener l : listeners)
        l.tableChanged(e);
}
 
Example 15
Source File: AttrTable.java    From Logisim with GNU General Public License v3.0 4 votes vote down vote up
void fireTableChanged() {
	TableModelEvent e = new TableModelEvent(this);
	for (TableModelListener l : new ArrayList<TableModelListener>(listeners)) {
		l.tableChanged(e);
	}
}
 
Example 16
Source File: JXTableRowHeader.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void fireTableDataChanged() {
    for (TableModelListener tml : listeners) {
        tml.tableChanged(new TableModelEvent(this));
    }
}
 
Example 17
Source File: NbiTreeTableModel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void fireTableDataChanged(TableModelEvent event) {
    for (TableModelListener listener: listeners.toArray(new TableModelListener[0])) {
        listener.tableChanged(event);
    }
}
 
Example 18
Source File: FlexTable.java    From WhiteRabbit with Apache License 2.0 4 votes vote down vote up
private void notifyListeners() {
	for (TableModelListener listener : listeners)
		listener.tableChanged(new TableModelEvent(this, TableModelEvent.HEADER_ROW));
}
 
Example 19
Source File: DetailsPanel.java    From WhiteRabbit with Apache License 2.0 4 votes vote down vote up
private void notifyListeners() {
	for (TableModelListener listener : listeners)
		listener.tableChanged(new TableModelEvent(this));
}
 
Example 20
Source File: ModelItemTableModel.java    From MogwaiERDesignerNG with GNU General Public License v3.0 4 votes vote down vote up
private void fireTableChanged(TableModelEvent e) {
    for (TableModelListener theListeber : listener) {
        theListeber.tableChanged(e);
    }
}