use of org.eclipse.nebula.widgets.nattable.command.ILayerCommand in project nebula.widgets.nattable by eclipse.
the class GridLayerTest method doCommandInvokesBodyFirst.
@Test
public void doCommandInvokesBodyFirst() throws Exception {
DummyCommandHandler bodyCommandHandler = new DummyCommandHandler(true);
DummyCommandHandler columnHeaderCommandHandler = new DummyCommandHandler(true);
DummyCommandHandler rowHeaderCommandHandler = new DummyCommandHandler(true);
DummyCommandHandler cornerCommandHandler = new DummyCommandHandler(true);
this.bodyDataLayer.registerCommandHandler(bodyCommandHandler);
this.columnHeaderDataLayer.registerCommandHandler(columnHeaderCommandHandler);
this.rowHeaderDataLayer.registerCommandHandler(rowHeaderCommandHandler);
this.cornerDataLayer.registerCommandHandler(cornerCommandHandler);
final ILayerCommand command = new LayerCommandFixture();
this.gridLayerUnderTest.doCommand(command);
Assert.assertTrue(bodyCommandHandler.isCommandCaught());
Assert.assertFalse(columnHeaderCommandHandler.isCommandCaught());
Assert.assertFalse(rowHeaderCommandHandler.isCommandCaught());
Assert.assertFalse(cornerCommandHandler.isCommandCaught());
}
use of org.eclipse.nebula.widgets.nattable.command.ILayerCommand in project nebula.widgets.nattable by eclipse.
the class GridLayerTest method doCommandInvokesOtherLayers.
@Test
public void doCommandInvokesOtherLayers() throws Exception {
DummyCommandHandler bodyCommandHandler = new DummyCommandHandler(false);
DummyCommandHandler columnHeaderCommandHandler = new DummyCommandHandler(false);
DummyCommandHandler rowHeaderCommandHandler = new DummyCommandHandler(false);
DummyCommandHandler cornerCommandHandler = new DummyCommandHandler(true);
this.bodyDataLayer.registerCommandHandler(bodyCommandHandler);
this.columnHeaderDataLayer.registerCommandHandler(columnHeaderCommandHandler);
this.rowHeaderDataLayer.registerCommandHandler(rowHeaderCommandHandler);
this.cornerDataLayer.registerCommandHandler(cornerCommandHandler);
final ILayerCommand command = new LayerCommandFixture();
this.gridLayerUnderTest.doCommand(command);
Assert.assertFalse(bodyCommandHandler.isCommandCaught());
Assert.assertFalse(columnHeaderCommandHandler.isCommandCaught());
Assert.assertFalse(rowHeaderCommandHandler.isCommandCaught());
Assert.assertTrue(cornerCommandHandler.isCommandCaught());
}
use of org.eclipse.nebula.widgets.nattable.command.ILayerCommand in project nebula.widgets.nattable by eclipse.
the class HideColumnCommandTest method testHideColumnCommand.
@Test
public void testHideColumnCommand() {
int columnPosition = 2;
ILayerCommand hideColumnCommand = new MultiColumnHideCommand(this.columnHideShowLayer, columnPosition);
Assert.assertEquals(5, this.columnHideShowLayer.getColumnCount());
this.columnHideShowLayer.doCommand(hideColumnCommand);
Assert.assertEquals(4, this.columnHideShowLayer.getColumnCount());
Assert.assertEquals(0, this.columnHideShowLayer.getColumnIndexByPosition(0));
Assert.assertEquals(1, this.columnHideShowLayer.getColumnIndexByPosition(1));
Assert.assertEquals(3, this.columnHideShowLayer.getColumnIndexByPosition(2));
Assert.assertEquals(4, this.columnHideShowLayer.getColumnIndexByPosition(3));
}
use of org.eclipse.nebula.widgets.nattable.command.ILayerCommand in project nebula.widgets.nattable by eclipse.
the class HideRowCommandTest method testHideRowCommand.
@Test
public void testHideRowCommand() {
int rowPosition = 2;
ILayerCommand hideRowCommand = new MultiRowHideCommand(this.rowHideShowLayer, rowPosition);
Assert.assertEquals(7, this.rowHideShowLayer.getRowCount());
this.rowHideShowLayer.doCommand(hideRowCommand);
Assert.assertEquals(6, this.rowHideShowLayer.getRowCount());
Assert.assertEquals(0, this.rowHideShowLayer.getRowIndexByPosition(0));
Assert.assertEquals(1, this.rowHideShowLayer.getRowIndexByPosition(1));
Assert.assertEquals(3, this.rowHideShowLayer.getRowIndexByPosition(2));
Assert.assertEquals(4, this.rowHideShowLayer.getRowIndexByPosition(3));
Assert.assertEquals(5, this.rowHideShowLayer.getRowIndexByPosition(4));
Assert.assertEquals(6, this.rowHideShowLayer.getRowIndexByPosition(5));
}
use of org.eclipse.nebula.widgets.nattable.command.ILayerCommand in project nebula.widgets.nattable by eclipse.
the class DimensionallyDependentIndexLayer method doCommand.
// Commands
@Override
public boolean doCommand(ILayerCommand command) {
// Invoke command handler(s) on the Dimensionally dependent layer
ILayerCommand clonedCommand = command.cloneCommand();
if (super.doCommand(command)) {
return true;
}
clonedCommand = command.cloneCommand();
if (this.horizontalLayerDependency.doCommand(clonedCommand)) {
return true;
}
clonedCommand = command.cloneCommand();
if (this.verticalLayerDependency.doCommand(clonedCommand)) {
return true;
}
return false;
}
Aggregations