blob: c106c68694ea15dbecf7991c0495c769b32f4bfb [file] [log] [blame]
/*=============================================================================#
# Copyright (c) 2012, 2021 Original NatTable authors and others.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0.
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Original NatTable authors and others - initial API and implementation
#=============================================================================*/
package org.eclipse.statet.ecommons.waltable.resize;
import java.util.ArrayList;
import java.util.Collection;
import org.eclipse.statet.ecommons.waltable.coordinate.LRange;
import org.eclipse.statet.ecommons.waltable.layer.ILayer;
import org.eclipse.statet.ecommons.waltable.layer.event.ColumnStructuralChangeEvent;
import org.eclipse.statet.ecommons.waltable.layer.event.StructuralDiff;
import org.eclipse.statet.ecommons.waltable.layer.event.StructuralDiff.DiffTypeEnum;
public class ColumnResizeEvent extends ColumnStructuralChangeEvent {
public ColumnResizeEvent(final ILayer layer, final long columnPosition) {
super(layer, new LRange(columnPosition));
}
protected ColumnResizeEvent(final ColumnResizeEvent event) {
super(event);
}
@Override
public ColumnResizeEvent cloneEvent() {
return new ColumnResizeEvent(this);
}
@Override
public Collection<StructuralDiff> getColumnDiffs() {
final Collection<StructuralDiff> rowDiffs= new ArrayList<>();
for (final LRange lRange : getColumnPositionRanges()) {
rowDiffs.add(new StructuralDiff(DiffTypeEnum.CHANGE, lRange, lRange));
}
return rowDiffs;
}
}