| /*=============================================================================# |
| # Copyright (c) 2012, 2021 Original NatTable authors 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: |
| # Original NatTable authors and others - initial API and implementation |
| #=============================================================================*/ |
| |
| package org.eclipse.statet.ecommons.waltable.selection; |
| |
| import org.eclipse.statet.ecommons.waltable.layer.ILayer; |
| import org.eclipse.statet.ecommons.waltable.layer.event.CellVisualChangeEvent; |
| |
| |
| public class CellSelectionEvent extends CellVisualChangeEvent implements ISelectionEvent { |
| |
| private final SelectionLayer selectionLayer; |
| |
| private final boolean revealCell; |
| |
| |
| public CellSelectionEvent(final SelectionLayer selectionLayer, final long columnPosition, final long rowPosition, |
| final boolean revealCell) { |
| super(selectionLayer, columnPosition, rowPosition); |
| this.selectionLayer= selectionLayer; |
| this.revealCell= revealCell; |
| } |
| |
| protected CellSelectionEvent(final CellSelectionEvent event) { |
| super(event); |
| this.selectionLayer= event.selectionLayer; |
| this.revealCell= event.revealCell; |
| } |
| |
| @Override |
| public CellSelectionEvent cloneEvent() { |
| return new CellSelectionEvent(this); |
| } |
| |
| |
| @Override |
| public SelectionLayer getSelectionLayer() { |
| return this.selectionLayer; |
| } |
| |
| public boolean getRevealCell() { |
| return this.revealCell; |
| } |
| |
| @Override |
| public boolean convertToLocal(final ILayer localLayer) { |
| if(this.columnPosition == SelectionLayer.NO_SELECTION || this.rowPosition == SelectionLayer.NO_SELECTION){ |
| return true; |
| } |
| return super.convertToLocal(localLayer); |
| } |
| |
| } |