Search in sources :

Example 6 with ClearFilterCommand

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

the class ComboBoxFilterRowHeaderComposite method doCommand.

@Override
public boolean doCommand(ILayerCommand command) {
    boolean handled = false;
    if (command instanceof ToggleFilterRowCommand) {
        setFilterRowVisible(!this.filterRowVisible);
        return true;
    } else // to the FilterRowDataLayer
    if (command instanceof ClearFilterCommand && command.convertToTargetLayer(this)) {
        int columnPosition = ((ClearFilterCommand) command).getColumnPosition();
        this.filterRowDataLayer.setDataValueByPosition(columnPosition, 0, getComboBoxDataProvider().getValues(columnPosition, 0));
        handled = true;
    } else if (command instanceof ClearAllFiltersCommand) {
        setAllValuesSelected();
        handled = true;
    } else if (command instanceof DisposeResourcesCommand) {
        this.comboBoxDataProvider.dispose();
    }
    if (handled) {
        fireLayerEvent(new RowStructuralRefreshEvent(this));
        return true;
    } else {
        return super.doCommand(command);
    }
}
Also used : DisposeResourcesCommand(org.eclipse.nebula.widgets.nattable.command.DisposeResourcesCommand) ClearFilterCommand(org.eclipse.nebula.widgets.nattable.filterrow.command.ClearFilterCommand) ClearAllFiltersCommand(org.eclipse.nebula.widgets.nattable.filterrow.command.ClearAllFiltersCommand) ToggleFilterRowCommand(org.eclipse.nebula.widgets.nattable.filterrow.command.ToggleFilterRowCommand) RowStructuralRefreshEvent(org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent)

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