/** * {@inheritDoc} */ @Override public final void fireTableDataChanged() { tableModelEvent.setAllDataChanged(); tableModel.fireTableChanged(tableModelEvent); }
/** * {@inheritDoc} */ public void setTableFormat(TableFormat<? super E> tableFormat) { this.tableFormat = tableFormat; tableModelEvent.setStructureChanged(); fireTableChanged(tableModelEvent); }
/** * {@inheritDoc} */ @Override public final void fireTableChanged(int startIndex, int endIndex, int listChangeType) { tableModelEvent.setValues(startIndex, endIndex, listChangeType); tableModel.fireTableChanged(tableModelEvent); }
/** * Ensures that only one TableModelEvent is created and fired for the given ListEvent. */ private void fireOneTableModelEvent(ListEvent<E> listChanges) { // build an "optimized" TableModelEvent describing the precise range of rows in the first block listChanges.nextBlock(); final int startIndex = listChanges.getBlockStartIndex(); final int endIndex = listChanges.getBlockEndIndex(); final int changeType = listChanges.getType(); getMutableTableModelEvent().setValues(startIndex, endIndex, changeType); // if another block exists, fallback to using a generic "data changed" TableModelEvent if (listChanges.nextBlock()) getMutableTableModelEvent().setAllDataChanged(); // fire the single TableModelEvent representing the entire ListEvent fireTableChanged(getMutableTableModelEvent()); } }
/** * Constructor with {@link TableModel}. * * @param tableModel the adapted table model */ DefaultTableModelEventAdapter(AbstractTableModel tableModel) { tableModelEvent = new MutableTableModelEvent(tableModel); this.tableModel = tableModel; }
/** * Ensures that only one TableModelEvent is created and fired for the given ListEvent. */ private void fireOneTableModelEvent(ListEvent<E> listChanges) { // build an "optimized" TableModelEvent describing the precise range of rows in the first block listChanges.nextBlock(); final int startIndex = listChanges.getBlockStartIndex(); final int endIndex = listChanges.getBlockEndIndex(); final int changeType = listChanges.getType(); getMutableTableModelEvent().setValues(startIndex, endIndex, changeType); // if another block exists, fallback to using a generic "data changed" TableModelEvent if (listChanges.nextBlock()) getMutableTableModelEvent().setAllDataChanged(); // fire the single TableModelEvent representing the entire ListEvent fireTableChanged(getMutableTableModelEvent()); } }
/** * Default implementation for converting a {@link ListEvent} to * TableModelEvents. There will be one TableModelEvent per ListEvent block. * Subclasses may choose to implement a different conversion. * * @param listChanges ListEvent to translate */ protected void handleListChange(ListEvent<E> listChanges) { if (!EventQueue.isDispatchThread()) throw new IllegalStateException("Events to " + this.getClass().getSimpleName() + " must arrive on the EDT - consider adding GlazedListsSwing.swingThreadProxyList(source) somewhere in your list pipeline"); // for all changes, one block at a time while (listChanges.nextBlock()) { // get the current change info int startIndex = listChanges.getBlockStartIndex(); int endIndex = listChanges.getBlockEndIndex(); int changeType = listChanges.getType(); // create a table model event for this block tableModelEvent.setValues(startIndex, endIndex, changeType); fireTableChanged(tableModelEvent); } }
/** * {@inheritDoc} */ public void setTableFormat(TableFormat<? super E> tableFormat) { this.tableFormat = tableFormat; tableModelEvent.setStructureChanged(); fireTableChanged(tableModelEvent); }
/** * Default implementation for converting a {@link ListEvent} to * TableModelEvents. There will be one TableModelEvent per ListEvent block. * Subclasses may choose to implement a different conversion. * * @param listChanges ListEvent to translate */ protected void handleListChange(ListEvent<E> listChanges) { if (!EventQueue.isDispatchThread()) throw new IllegalStateException("Events to " + this.getClass().getSimpleName() + " must arrive on the EDT - consider adding GlazedListsSwing.swingThreadProxyList(source) somewhere in your list pipeline"); // for all changes, one block at a time while (listChanges.nextBlock()) { // get the current change info int startIndex = listChanges.getBlockStartIndex(); int endIndex = listChanges.getBlockEndIndex(); int changeType = listChanges.getType(); // create a table model event for this block tableModelEvent.setValues(startIndex, endIndex, changeType); fireTableChanged(tableModelEvent); } }
/** * {@inheritDoc} */ @Override public final void fireTableStructureChanged() { tableModelEvent.setStructureChanged(); tableModel.fireTableChanged(tableModelEvent); }
/** * {@inheritDoc} */ @Override public void listChanged(ListEvent<E> listChanges) { checkAccessThread(); // for all changes, one block at a time while (listChanges.nextBlock()) { // get the current change info int startIndex = listChanges.getBlockStartIndex(); int endIndex = listChanges.getBlockEndIndex(); int changeType = listChanges.getType(); // create a table model event for this block tableModelEvent.setValues(startIndex, endIndex, changeType); tableModel.fireTableChanged(tableModelEvent); } }