Class UpdateDataChangeHandler<T extends UpdateDataChange>

java.lang.Object
org.eclipse.nebula.widgets.nattable.datachange.AbstractDataChangeHandler<T>
org.eclipse.nebula.widgets.nattable.datachange.UpdateDataChangeHandler<T>
All Implemented Interfaces:
DataChangeHandler
Direct Known Subclasses:
PersistenceUpdateDataChangeHandler, TemporaryUpdateDataChangeHandler

public abstract class UpdateDataChangeHandler<T extends UpdateDataChange> extends AbstractDataChangeHandler<T>
Abstract implementation of DataChangeHandler to handle data updates.
Since:
1.6
  • Field Details

    • changedColumns

      protected final Set<Integer> changedColumns
      The column indexes of columns that contain dirty cells.
    • changedRows

      protected final Set<Integer> changedRows
      The row indexes of rows that contain dirty cells.
  • Constructor Details

  • Method Details

    • handleStructuralChange

      public void handleStructuralChange(IStructuralChangeEvent structuralChangeEvent)
      Description copied from interface: DataChangeHandler
      Trigger handling of IStructuralChangeEvents to update locally stored changes, e.g. update the row index of a key in case a row above was inserted or deleted.
      Parameters:
      structuralChangeEvent - The event to handle.
    • handleColumnDelete

      public void handleColumnDelete(Collection<StructuralDiff> columnDiffs)
      Will check for events that indicate that columns have been deleted. In that case the cached dataChanges need to be updated because the index of the columns might have changed. E.g. cell with column at index 3 is changed in the given layer, deleting column at index 1 will cause the column at index 3 to be moved to index 2. Without transforming the index regarding the delete event, the wrong cell at the incorrect column would be shown as changed.
      Parameters:
      columnDiffs - The collection of StructuralDiffs to handle.
    • handleColumnInsert

      public void handleColumnInsert(Collection<StructuralDiff> columnDiffs)
      Will check for events that indicate that columns are added. In that case the cached dataChanges need to be updated because the index of the columns might have changed. E.g. column with index 3 is hidden in the given layer, adding a column at index 1 will cause the column at index 3 to be moved to index 4. Without transforming the index regarding the add event, the wrong column would be hidden.
      Parameters:
      columnDiffs - The collection of StructuralDiffs to handle.
    • clearDataChanges

      public void clearDataChanges()
      Clear the locally stored changes.
      Specified by:
      clearDataChanges in interface DataChangeHandler
      Overrides:
      clearDataChanges in class AbstractDataChangeHandler<T extends UpdateDataChange>
    • removeChangesForDeletedColumnObjects

      protected void removeChangesForDeletedColumnObjects()
      Iterates over the locally stored data changes and checks if the referenced object does still exist. If not the data change is removed.

      This method is intended to be used with CellKeyHandler implementations whose created keys do not need to be updated on structural changes as they update automatically, e.g. via unique identifier.

    • removeChangesForDeletedRowObjects

      protected void removeChangesForDeletedRowObjects()
    • rebuildPositionCollections

      protected void rebuildPositionCollections()
      Rebuilds the changedColumns and changedRows collections based on the updated AbstractDataChangeHandler.dataChanges map.
    • isColumnDirty

      public boolean isColumnDirty(int columnPosition)
      Description copied from interface: DataChangeHandler
      Checks if the column with the given position contains cells in a dirty state.
      Parameters:
      columnPosition - The position of the column whose dirty state should be checked.
      Returns:
      true if the column contains cells that are marked as dirty (data has changed and not saved yet), false if not.
    • isRowDirty

      public boolean isRowDirty(int rowPosition)
      Description copied from interface: DataChangeHandler
      Checks if the row with the given position contains cells in a dirty state.
      Parameters:
      rowPosition - The position of the row whose dirty state should be checked.
      Returns:
      true if the row contains cells that are marked as dirty (data has changed and not saved yet), false if not.
    • isCellDirty

      public boolean isCellDirty(int columnPosition, int rowPosition)
      Description copied from interface: DataChangeHandler
      Checks if the cell at the given position is dirty.
      Parameters:
      columnPosition - The column position of the cell whose dirty state should be checked.
      rowPosition - The row position of the cell whose dirty state should be checked.
      Returns:
      true if the cell is dirty (data has changed and not saved yet), false if not.
    • setUpdateOnHorizontalChanges

      public void setUpdateOnHorizontalChanges(boolean update)
      Configure if the changes tracked by the DataChangeLayer should also be updated on a horizontal/column structural changes. The update is needed in case the change does not cause a DataChange that is created by some other handler and performed in the correct order.
      Parameters:
      update - true if the changes tracked by the DataChangeLayer should be updated, false if not.
    • setUpdateOnVerticalChanges

      public void setUpdateOnVerticalChanges(boolean update)
      Configure if the changes tracked by the DataChangeLayer should also be updated on a vertical/row structural changes. The update is needed in case the change does not cause a DataChange that is created by some other handler and performed in the correct order.
      Parameters:
      update - true if the changes tracked by the DataChangeLayer should be updated, false if not.