Class StructuralChangeEventHelper
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.layer.event.StructuralChangeEventHelper
-
public final class StructuralChangeEventHelper extends Object
Helper class providing support for modifying cached index lists for IStructuralChangeEvents.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
handleColumnDelete(Collection<StructuralDiff> columnDiffs, ILayer underlyingLayer, Collection<Integer> cachedColumnIndexes, boolean handleNotFound)
Will check for events that indicate that columns has been deleted.static void
handleColumnDelete(Collection<StructuralDiff> columnDiffs, ILayer underlyingLayer, org.eclipse.collections.api.collection.primitive.MutableIntCollection cachedColumnIndexes, boolean handleNotFound)
Will check for events that indicate that columns has been deleted.static void
handleColumnInsert(Collection<StructuralDiff> columnDiffs, ILayer underlyingLayer, Collection<Integer> cachedColumnIndexes, boolean addToCache)
Will check for events that indicate that columns are added.static void
handleColumnInsert(Collection<StructuralDiff> columnDiffs, ILayer underlyingLayer, org.eclipse.collections.api.collection.primitive.MutableIntCollection cachedColumnIndexes, boolean addToCache)
Will check for events that indicate that columns are added.static void
handleRowDelete(Collection<StructuralDiff> rowDiffs, ILayer underlyingLayer, Collection<Integer> cachedRowIndexes, boolean handleNotFound)
Will check for events that indicate that rows has been deleted.static void
handleRowDelete(Collection<StructuralDiff> rowDiffs, ILayer underlyingLayer, org.eclipse.collections.api.collection.primitive.MutableIntCollection cachedRowIndexes, boolean handleNotFound)
Will check for events that indicate that rows has been deleted.static void
handleRowInsert(Collection<StructuralDiff> rowDiffs, ILayer underlyingLayer, Collection<Integer> cachedRowIndexes, boolean addToCache)
Will check for events that indicate that rows are added.static void
handleRowInsert(Collection<StructuralDiff> rowDiffs, ILayer underlyingLayer, org.eclipse.collections.api.collection.primitive.MutableIntCollection cachedRowIndexes, boolean addToCache)
Will check for events that indicate that rows are added.static boolean
isReorder(Collection<StructuralDiff> structuralDiffs)
Method to indicate if the collection of StructuralDiffs marks a reorder event.
-
-
-
Method Detail
-
handleRowDelete
public static void handleRowDelete(Collection<StructuralDiff> rowDiffs, ILayer underlyingLayer, Collection<Integer> cachedRowIndexes, boolean handleNotFound)
Will check for events that indicate that rows has been deleted. In that case the given cached indexes for the given layer need to be updated because the index of the rows might have changed. E.g. Row with index 3 is hidden in the given layer, deleting row at index 1 will cause the row at index 3 to be moved at index 2. Without transforming the index regarding the delete event, the wrong row would be hidden.- Parameters:
rowDiffs
- The collection ofStructuralDiff
s to handleunderlyingLayer
- The underlying layer of the layer who caches the indexes. Needed to translate the transported row positions to indexes, because the conversion to the layer who caches the index is done before it is fired further in the layer stackcachedRowIndexes
- The collection of indexes that is cached by the layer that needs transformationhandleNotFound
- flag to tell whether the not found row indexes should be taken into account or not. Needed for last row checks
-
handleRowDelete
public static void handleRowDelete(Collection<StructuralDiff> rowDiffs, ILayer underlyingLayer, org.eclipse.collections.api.collection.primitive.MutableIntCollection cachedRowIndexes, boolean handleNotFound)
Will check for events that indicate that rows has been deleted. In that case the given cached indexes for the given layer need to be updated because the index of the rows might have changed. E.g. Row with index 3 is hidden in the given layer, deleting row at index 1 will cause the row at index 3 to be moved at index 2. Without transforming the index regarding the delete event, the wrong row would be hidden.- Parameters:
rowDiffs
- The collection ofStructuralDiff
s to handleunderlyingLayer
- The underlying layer of the layer who caches the indexes. Needed to translate the transported row positions to indexes, because the conversion to the layer who caches the index is done before it is fired further in the layer stackcachedRowIndexes
- The collection of indexes that is cached by the layer that needs transformationhandleNotFound
- flag to tell whether the not found row indexes should be taken into account or not. Needed for last row checks- Since:
- 2.0
-
handleRowInsert
public static void handleRowInsert(Collection<StructuralDiff> rowDiffs, ILayer underlyingLayer, Collection<Integer> cachedRowIndexes, boolean addToCache)
Will check for events that indicate that rows are added. In that case the given cached indexes need to be updated because the index of the rows might have changed. E.g. Row with index 3 is hidden in the given layer, adding a row at index 1 will cause the row at index 3 to be moved to index 4. Without transforming the index regarding the add event, the wrong row would be hidden.- Parameters:
rowDiffs
- The collection ofStructuralDiff
s to handleunderlyingLayer
- The underlying layer of the layer who caches the indexes. Needed to translate the transported row positions to indexes, because the conversion to the layer who caches the index is done before it is fired further in the layer stackcachedRowIndexes
- The collection of indexes that is cached by the layer that needs transformationaddToCache
- Flag to configure if the added value should be added to the cache or not. This is necessary to differ whether cachedRowIndexes are a collection of all indexes that need to be updated (e.g. row reordering) or just a collection of indexes that are applied for a specific state (e.g. row hide state)
-
handleRowInsert
public static void handleRowInsert(Collection<StructuralDiff> rowDiffs, ILayer underlyingLayer, org.eclipse.collections.api.collection.primitive.MutableIntCollection cachedRowIndexes, boolean addToCache)
Will check for events that indicate that rows are added. In that case the given cached indexes need to be updated because the index of the rows might have changed. E.g. Row with index 3 is hidden in the given layer, adding a row at index 1 will cause the row at index 3 to be moved to index 4. Without transforming the index regarding the add event, the wrong row would be hidden.- Parameters:
rowDiffs
- The collection ofStructuralDiff
s to handleunderlyingLayer
- The underlying layer of the layer who caches the indexes. Needed to translate the transported row positions to indexes, because the conversion to the layer who caches the index is done before it is fired further in the layer stackcachedRowIndexes
- The collection of indexes that is cached by the layer that needs transformationaddToCache
- Flag to configure if the added value should be added to the cache or not. This is necessary to differ whether cachedRowIndexes are a collection of all indexes that need to be updated (e.g. row reordering) or just a collection of indexes that are applied for a specific state (e.g. row hide state)- Since:
- 2.0
-
handleColumnDelete
public static void handleColumnDelete(Collection<StructuralDiff> columnDiffs, ILayer underlyingLayer, Collection<Integer> cachedColumnIndexes, boolean handleNotFound)
Will check for events that indicate that columns has been deleted. In that case the given cached indexes for the given layer 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, deleting column at index 1 will cause the column at index 3 to be moved at index 2. Without transforming the index regarding the delete event, the wrong column would be hidden.- Parameters:
columnDiffs
- The collection ofStructuralDiff
s to handleunderlyingLayer
- The underlying layer of the layer who caches the indexes. Needed to translate the transported column positions to indexes, because the conversion to the layer who caches the index is done before it is fired further in the layer stackcachedColumnIndexes
- The collection of indexes that is cached by the layer that needs transformationhandleNotFound
- flag to tell whether the not found column indexes should be taken into account or not. Needed for last column checks
-
handleColumnDelete
public static void handleColumnDelete(Collection<StructuralDiff> columnDiffs, ILayer underlyingLayer, org.eclipse.collections.api.collection.primitive.MutableIntCollection cachedColumnIndexes, boolean handleNotFound)
Will check for events that indicate that columns has been deleted. In that case the given cached indexes for the given layer 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, deleting column at index 1 will cause the column at index 3 to be moved at index 2. Without transforming the index regarding the delete event, the wrong column would be hidden.- Parameters:
columnDiffs
- The collection ofStructuralDiff
s to handleunderlyingLayer
- The underlying layer of the layer who caches the indexes. Needed to translate the transported column positions to indexes, because the conversion to the layer who caches the index is done before it is fired further in the layer stackcachedColumnIndexes
- The collection of indexes that is cached by the layer that needs transformationhandleNotFound
- flag to tell whether the not found column indexes should be taken into account or not. Needed for last column checks.- Since:
- 2.0
-
handleColumnInsert
public static void handleColumnInsert(Collection<StructuralDiff> columnDiffs, ILayer underlyingLayer, Collection<Integer> cachedColumnIndexes, boolean addToCache)
Will check for events that indicate that columns are added. In that case the given cached indexes 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 ofStructuralDiff
s to handleunderlyingLayer
- The underlying layer of the layer who caches the indexes. Needed to translate the transported column positions to indexes, because the conversion to the layer who caches the index is done before it is fired further in the layer stackcachedColumnIndexes
- The collection of indexes that is cached by the layer that needs transformationaddToCache
- Flag to configure if the added value should be added to the cache or not. This is necessary to differ whether cachedColumnIndexes are a collection of all indexes that need to be updated (e.g. column reordering) or just a collection of indexes that are applied for a specific state (e.g. column hide state)
-
handleColumnInsert
public static void handleColumnInsert(Collection<StructuralDiff> columnDiffs, ILayer underlyingLayer, org.eclipse.collections.api.collection.primitive.MutableIntCollection cachedColumnIndexes, boolean addToCache)
Will check for events that indicate that columns are added. In that case the given cached indexes 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 ofStructuralDiff
s to handleunderlyingLayer
- The underlying layer of the layer who caches the indexes. Needed to translate the transported column positions to indexes, because the conversion to the layer who caches the index is done before it is fired further in the layer stackcachedColumnIndexes
- The collection of indexes that is cached by the layer that needs transformationaddToCache
- Flag to configure if the added value should be added to the cache or not. This is necessary to differ whether cachedColumnIndexes are a collection of all indexes that need to be updated (e.g. column reordering) or just a collection of indexes that are applied for a specific state (e.g. column hide state)- Since:
- 2.0
-
isReorder
public static boolean isReorder(Collection<StructuralDiff> structuralDiffs)
Method to indicate if the collection of StructuralDiffs marks a reorder event. This is necessary because reordering itself contains out of two diffs, one for deleting columns/rows, one for adding them at another position. As these diffs are completely separated from each other, but the handling does have impact, this check is added. Also on reordering there is no need for special handling of diffs in the layers that call this method.Here is a small example to explain the impact on handling:
- column at position 2 gets hidden
- reorder column at index 0 to index 4
- on handling the deletion of index 0 the hidden index 2 would be reduced to 1 (which is wrong because it is reordered not really deleted)
- adding the column at index 4 would undo the hidden index modification, because the insertion is handled separately and does not know about the former deletion
- Parameters:
structuralDiffs
- The collection of StructuralDiffs to check for reordering- Returns:
true
if the diff indicates a reordering happened,false
if if was not a reordering based on the explanation above.
-
-