Search in sources :

Example 1 with RowStructuralChangeEvent

use of org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralChangeEvent in project nebula.widgets.nattable by eclipse.

the class RowSelectionPreserver method handleLayerEvent.

/**
 * On a change in the underlying data:
 * <ol>
 * <li>Clears the selection
 * <li>Re-select the row objects selected earlier.
 * </ol>
 */
@Override
public void handleLayerEvent(IVisualChangeEvent event) {
    if (ObjectUtils.isEmpty(this.selectedRowObjects)) {
        return;
    }
    if (event instanceof RowStructuralRefreshEvent || event instanceof RowStructuralChangeEvent || event instanceof SortColumnEvent) {
        this.selectionLayer.clear();
        this.selectionProvider.setSelection(new StructuredSelection(getValidSelections()));
    }
}
Also used : SortColumnEvent(org.eclipse.nebula.widgets.nattable.sort.event.SortColumnEvent) RowStructuralRefreshEvent(org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) RowStructuralChangeEvent(org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralChangeEvent)

Aggregations

StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 RowStructuralChangeEvent (org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralChangeEvent)1 RowStructuralRefreshEvent (org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent)1 SortColumnEvent (org.eclipse.nebula.widgets.nattable.sort.event.SortColumnEvent)1