use of org.eclipse.nebula.widgets.nattable.resize.event.RowResizeEvent in project nebula.widgets.nattable by eclipse.
the class ResizeEventPropagationTest method shouldReturnARectangleStartingFromResizedRowToEndOfGrid.
@Test
public void shouldReturnARectangleStartingFromResizedRowToEndOfGrid() {
// Mimics resizing the third row
this.layerListener = new LayerListenerFixture();
this.dataLayer.addLayerListener(this.layerListener);
this.dataLayer.setRowHeightByPosition(3, 100);
// This is the propagated event
RowResizeEvent rowResizeEvent = (RowResizeEvent) this.layerListener.getReceivedEvents().get(0);
Collection<Rectangle> actualRectangles = rowResizeEvent.getChangedPositionRectangles();
// The affected region should have the following size
Rectangle expectedRectangle = new Rectangle(0, 3, 5, 4);
Assert.assertEquals(expectedRectangle, actualRectangles.iterator().next());
}
use of org.eclipse.nebula.widgets.nattable.resize.event.RowResizeEvent in project nebula.widgets.nattable by eclipse.
the class DataLayer method setRowHeightPercentageByPosition.
/**
* Set the height of the row at the given position to the given percentage
* value.
*
* @param rowPosition
* The position of the row to change.
* @param height
* The percentage value to set.
*
* @since 1.6
*/
public void setRowHeightPercentageByPosition(int rowPosition, double height) {
this.rowHeightConfig.setPercentage(rowPosition, height);
fireLayerEvent(new RowResizeEvent(this, rowPosition));
}
use of org.eclipse.nebula.widgets.nattable.resize.event.RowResizeEvent in project nebula.widgets.nattable by eclipse.
the class DataLayer method setRowHeightPercentageByPosition.
public void setRowHeightPercentageByPosition(int rowPosition, int height) {
this.rowHeightConfig.setPercentage(rowPosition, height);
fireLayerEvent(new RowResizeEvent(this, rowPosition));
}
use of org.eclipse.nebula.widgets.nattable.resize.event.RowResizeEvent in project nebula.widgets.nattable by eclipse.
the class MultiRowResizeCommandHandler method doCommand.
@Override
protected boolean doCommand(MultiRowResizeCommand command) {
Collection<Integer> rowPositions = command.getRowPositions();
for (int rowPosition : rowPositions) {
int newRowHeight = command.downScaleValue() ? this.dataLayer.downScaleRowHeight(command.getRowHeight(rowPosition)) : command.getRowHeight(rowPosition);
this.dataLayer.setRowHeightByPosition(rowPosition, newRowHeight, false);
}
List<Range> ranges = PositionUtil.getRanges(rowPositions);
for (Range range : ranges) {
this.dataLayer.fireLayerEvent(new RowResizeEvent(this.dataLayer, range));
}
return true;
}
Aggregations