* Index 10 11 12 13 ... 20
* --------------------
* Position 0 1 2 3 ... 20
*/
public void returnsCorrectPositionRectangleForMultiColumnReorderLeftCase() {
ColumnReorderLayer reorderLayer = new ColumnReorderLayer(
new BaseDataLayerFixture(20, 20));
// Build expected cell positions to redraw
final Set<Rectangle> expectedPositions = new HashSet<Rectangle>();
expectedPositions.add(new Rectangle(0, 0, 20, 20));
reorderLayer.addLayerListener(new ILayerListener() {
public void handleLayerEvent(ILayerEvent event) {
ColumnReorderEvent multiReorder = (ColumnReorderEvent) event;
assertTrue(multiReorder.getChangedPositionRectangles()
.containsAll(expectedPositions));
}
});
// Reorder to beginning of grid
List<Integer> fromColumnPositions = Arrays.asList(new Integer[] { 10,
11, 12, 13 });
reorderLayer.reorderMultipleColumnPositions(fromColumnPositions, 0);
// Reorder to middle of grid
expectedPositions.clear();
expectedPositions.add(new Rectangle(10, 0, 10, 20));
fromColumnPositions = Arrays.asList(new Integer[] { 19, 18, 17, 16 });
reorderLayer.reorderMultipleColumnPositions(fromColumnPositions, 10);
// Reorder to end of grid
expectedPositions.clear();
expectedPositions.add(new Rectangle(5, 0, 15, 20));
fromColumnPositions = Arrays.asList(new Integer[] { 5, 6, 7, 8 });
reorderLayer.reorderMultipleColumnPositions(fromColumnPositions, 10);
}