blob: 20a5c2d6b4f81b72f32af0df6e21a4d836377c1c [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2012, 2020 Edwin Park and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Edwin Park - initial API and implementation
* Dirk Fauth <dirk.fauth@googlemail.com> - Bug 462143
******************************************************************************/
package org.eclipse.nebula.widgets.nattable.viewport.command;
import org.eclipse.nebula.widgets.nattable.command.AbstractLayerCommandHandler;
import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer;
public class ViewportDragCommandHandler extends AbstractLayerCommandHandler<ViewportDragCommand> {
private ViewportLayer viewportLayer;
public ViewportDragCommandHandler(ViewportLayer viewportLayer) {
this.viewportLayer = viewportLayer;
}
@Override
public Class<ViewportDragCommand> getCommandClass() {
return ViewportDragCommand.class;
}
@Override
protected boolean doCommand(ViewportDragCommand command) {
if (command.isConfiguredForMoveDirection()) {
this.viewportLayer.drag(command.getHorizontal(), command.getVertical());
} else {
this.viewportLayer.drag(command.getX(), command.getY());
}
return true;
}
}