Search in sources :

Example 1 with ClearFilterCommand

use of org.eclipse.nebula.widgets.nattable.filterrow.command.ClearFilterCommand in project nebula.widgets.nattable by eclipse.

the class FilterRowDataLayer method doCommand.

@Override
public boolean doCommand(ILayerCommand command) {
    boolean handled = false;
    if (command instanceof ClearFilterCommand && command.convertToTargetLayer(this)) {
        int columnPosition = ((ClearFilterCommand) command).getColumnPosition();
        setDataValueByPosition(columnPosition, 0, null);
        handled = true;
    } else if (command instanceof ClearAllFiltersCommand) {
        getFilterRowDataProvider().clearAllFilters();
        handled = true;
    }
    if (handled) {
        fireLayerEvent(new RowStructuralRefreshEvent(this));
        return true;
    } else {
        return super.doCommand(command);
    }
}
Also used : ClearFilterCommand(org.eclipse.nebula.widgets.nattable.filterrow.command.ClearFilterCommand) ClearAllFiltersCommand(org.eclipse.nebula.widgets.nattable.filterrow.command.ClearAllFiltersCommand) RowStructuralRefreshEvent(org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent)

Example 2 with ClearFilterCommand

use of org.eclipse.nebula.widgets.nattable.filterrow.command.ClearFilterCommand in project nebula.widgets.nattable by eclipse.

the class ClearAllFiltersAction method run.

@Override
public void run(NatTable natTable, MouseEvent event) {
    NatEventData natEventData = (NatEventData) event.data;
    natTable.doCommand(new ClearFilterCommand(natTable, natEventData.getColumnPosition()));
}
Also used : ClearFilterCommand(org.eclipse.nebula.widgets.nattable.filterrow.command.ClearFilterCommand) NatEventData(org.eclipse.nebula.widgets.nattable.ui.NatEventData)

Example 3 with ClearFilterCommand

use of org.eclipse.nebula.widgets.nattable.filterrow.command.ClearFilterCommand in project nebula.widgets.nattable by eclipse.

the class ClearFilterAction method run.

@Override
public void run(NatTable natTable, MouseEvent event) {
    NatEventData natEventData = (NatEventData) event.data;
    natTable.doCommand(new ClearFilterCommand(natTable, natEventData.getColumnPosition()));
}
Also used : ClearFilterCommand(org.eclipse.nebula.widgets.nattable.filterrow.command.ClearFilterCommand) NatEventData(org.eclipse.nebula.widgets.nattable.ui.NatEventData)

Example 4 with ClearFilterCommand

use of org.eclipse.nebula.widgets.nattable.filterrow.command.ClearFilterCommand in project nebula.widgets.nattable by eclipse.

the class FilterRowHeaderCompositeTest method shouldHandleClearFilterCommand.

@Test
public void shouldHandleClearFilterCommand() throws Exception {
    Assert.assertEquals(13, this.filterList.size());
    this.layerUnderTest.doCommand(new UpdateDataCommand(this.layerUnderTest, 1, 2, "ford"));
    Assert.assertEquals(1, this.filterList.size());
    this.layerUnderTest.doCommand(new ClearFilterCommand(this.layerUnderTest, 1));
    Assert.assertEquals(13, this.filterList.size());
    this.listener.containsInstanceOf(RowStructuralRefreshEvent.class);
}
Also used : ClearFilterCommand(org.eclipse.nebula.widgets.nattable.filterrow.command.ClearFilterCommand) UpdateDataCommand(org.eclipse.nebula.widgets.nattable.edit.command.UpdateDataCommand) Test(org.junit.Test)

Example 5 with ClearFilterCommand

use of org.eclipse.nebula.widgets.nattable.filterrow.command.ClearFilterCommand in project nebula.widgets.nattable by eclipse.

the class FilterRowDataLayerTest method shouldHandleClearFilterCommand.

@Test
public void shouldHandleClearFilterCommand() throws Exception {
    assertEquals(13, this.filterList.size());
    this.layerUnderTest.doCommand(new UpdateDataCommand(this.layerUnderTest, 1, 0, "ford"));
    assertEquals(1, this.filterList.size());
    this.layerUnderTest.doCommand(new ClearFilterCommand(this.layerUnderTest, 1));
    assertEquals(13, this.filterList.size());
    this.listener.containsInstanceOf(RowStructuralRefreshEvent.class);
}
Also used : ClearFilterCommand(org.eclipse.nebula.widgets.nattable.filterrow.command.ClearFilterCommand) UpdateDataCommand(org.eclipse.nebula.widgets.nattable.edit.command.UpdateDataCommand) Test(org.junit.Test)

Aggregations

ClearFilterCommand (org.eclipse.nebula.widgets.nattable.filterrow.command.ClearFilterCommand)6 UpdateDataCommand (org.eclipse.nebula.widgets.nattable.edit.command.UpdateDataCommand)2 ClearAllFiltersCommand (org.eclipse.nebula.widgets.nattable.filterrow.command.ClearAllFiltersCommand)2 RowStructuralRefreshEvent (org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent)2 NatEventData (org.eclipse.nebula.widgets.nattable.ui.NatEventData)2 Test (org.junit.Test)2 DisposeResourcesCommand (org.eclipse.nebula.widgets.nattable.command.DisposeResourcesCommand)1 ToggleFilterRowCommand (org.eclipse.nebula.widgets.nattable.filterrow.command.ToggleFilterRowCommand)1