use of org.eclipse.nebula.widgets.nattable.layer.event.StructuralDiff in project nebula.widgets.nattable by eclipse.
the class ColumnHideShowLayer method handleLayerEvent.
@Override
public void handleLayerEvent(ILayerEvent event) {
if (event instanceof IStructuralChangeEvent) {
IStructuralChangeEvent structuralChangeEvent = (IStructuralChangeEvent) event;
if (structuralChangeEvent.isHorizontalStructureChanged()) {
Collection<StructuralDiff> columnDiffs = structuralChangeEvent.getColumnDiffs();
if (columnDiffs != null && !columnDiffs.isEmpty() && !StructuralChangeEventHelper.isReorder(columnDiffs)) {
StructuralChangeEventHelper.handleColumnDelete(columnDiffs, this.underlyingLayer, this.hiddenColumnIndexes, false);
StructuralChangeEventHelper.handleColumnInsert(columnDiffs, this.underlyingLayer, this.hiddenColumnIndexes, false);
}
}
}
super.handleLayerEvent(event);
}
use of org.eclipse.nebula.widgets.nattable.layer.event.StructuralDiff in project nebula.widgets.nattable by eclipse.
the class RowHideShowLayer method handleLayerEvent.
@Override
public void handleLayerEvent(ILayerEvent event) {
if (event instanceof IStructuralChangeEvent) {
IStructuralChangeEvent structuralChangeEvent = (IStructuralChangeEvent) event;
if (structuralChangeEvent.isVerticalStructureChanged()) {
Collection<StructuralDiff> rowDiffs = structuralChangeEvent.getRowDiffs();
if (rowDiffs != null && !rowDiffs.isEmpty() && !StructuralChangeEventHelper.isReorder(rowDiffs)) {
StructuralChangeEventHelper.handleRowDelete(rowDiffs, this.underlyingLayer, this.hiddenRowIndexes, false);
StructuralChangeEventHelper.handleRowInsert(rowDiffs, this.underlyingLayer, this.hiddenRowIndexes, false);
}
}
}
super.handleLayerEvent(event);
}
use of org.eclipse.nebula.widgets.nattable.layer.event.StructuralDiff in project nebula.widgets.nattable by eclipse.
the class HideRowPositionsEvent method getRowDiffs.
@Override
public Collection<StructuralDiff> getRowDiffs() {
Collection<StructuralDiff> rowDiffs = new ArrayList<StructuralDiff>(getRowPositionRanges().size());
for (Range range : getRowPositionRanges()) {
StructuralDiff diff = new StructuralDiff(DiffTypeEnum.DELETE, range, new Range(range.start, range.start));
rowDiffs.add(diff);
}
return rowDiffs;
}
use of org.eclipse.nebula.widgets.nattable.layer.event.StructuralDiff in project nebula.widgets.nattable by eclipse.
the class ShowColumnPositionsEvent method getColumnDiffs.
@Override
public Collection<StructuralDiff> getColumnDiffs() {
Collection<StructuralDiff> columnDiffs = new ArrayList<StructuralDiff>(getColumnPositionRanges().size());
int offset = 0;
for (Range range : getColumnPositionRanges()) {
columnDiffs.add(new StructuralDiff(DiffTypeEnum.ADD, new Range(range.start - offset, range.start - offset), range));
offset += range.size();
}
return columnDiffs;
}
use of org.eclipse.nebula.widgets.nattable.layer.event.StructuralDiff in project nebula.widgets.nattable by eclipse.
the class ColumnReorderEvent method getColumnDiffs.
@Override
public Collection<StructuralDiff> getColumnDiffs() {
Collection<StructuralDiff> columnDiffs = new ArrayList<StructuralDiff>();
Collection<Range> beforeFromColumnPositionRanges = getBeforeFromColumnPositionRanges();
final int beforeToColumnPosition = (this.reorderToLeftEdge) ? this.beforeToColumnPosition : (this.beforeToColumnPosition + 1);
int afterAddColumnPosition = beforeToColumnPosition;
for (Range beforeFromColumnPositionRange : beforeFromColumnPositionRanges) {
if (beforeFromColumnPositionRange.start < beforeToColumnPosition) {
afterAddColumnPosition -= Math.min(beforeFromColumnPositionRange.end, beforeToColumnPosition) - beforeFromColumnPositionRange.start;
} else {
break;
}
}
int cumulativeAddSize = 0;
for (Range beforeFromColumnPositionRange : beforeFromColumnPositionRanges) {
cumulativeAddSize += beforeFromColumnPositionRange.size();
}
int offset = 0;
for (Range beforeFromColumnPositionRange : beforeFromColumnPositionRanges) {
int afterDeleteColumnPosition = beforeFromColumnPositionRange.start - offset;
if (afterAddColumnPosition < afterDeleteColumnPosition) {
afterDeleteColumnPosition += cumulativeAddSize;
}
columnDiffs.add(new StructuralDiff(DiffTypeEnum.DELETE, beforeFromColumnPositionRange, new Range(afterDeleteColumnPosition, afterDeleteColumnPosition)));
offset += beforeFromColumnPositionRange.size();
}
Range beforeAddRange = new Range(beforeToColumnPosition, beforeToColumnPosition);
offset = 0;
for (Range beforeFromColumnPositionRange : beforeFromColumnPositionRanges) {
int size = beforeFromColumnPositionRange.size();
columnDiffs.add(new StructuralDiff(DiffTypeEnum.ADD, beforeAddRange, new Range(afterAddColumnPosition + offset, afterAddColumnPosition + offset + size)));
offset += size;
}
return columnDiffs;
}
Aggregations