diff options
author | Dirk Fauth | 2016-05-11 20:30:15 +0000 |
---|---|---|
committer | Dirk Fauth | 2016-05-11 20:30:15 +0000 |
commit | 2b03a5599447315102c3b92801ea3a41a7daa79f (patch) | |
tree | beb2dbbb1490b024d97b183de6fa4e4471f509da | |
parent | 2162cedbd8437005b723307b998fc00258bc8f8b (diff) | |
download | org.eclipse.nebula.widgets.nattable-2b03a5599447315102c3b92801ea3a41a7daa79f.tar.gz org.eclipse.nebula.widgets.nattable-2b03a5599447315102c3b92801ea3a41a7daa79f.tar.xz org.eclipse.nebula.widgets.nattable-2b03a5599447315102c3b92801ea3a41a7daa79f.zip |
Refactored FillDirection to Direction
By that refactoring the Direction enumeration can be used in various use
cases and not only for fill drag handle.
Change-Id: I0124caf3d3238649a6733efbfeb536646968a99c
Signed-off-by: Dirk Fauth <dirk.fauth@googlemail.com>
-rw-r--r-- | org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/config/Direction.java (renamed from org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/fillhandle/config/FillDirection.java) | 16 | ||||
-rw-r--r-- | org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/fillhandle/action/FillHandleDragMode.java | 10 | ||||
-rw-r--r-- | org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/fillhandle/config/FillHandleConfigAttributes.java | 5 |
3 files changed, 18 insertions, 13 deletions
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/fillhandle/config/FillDirection.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/config/Direction.java index 0ac287bf..1aa9ade7 100644 --- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/fillhandle/config/FillDirection.java +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/config/Direction.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2015 CEA LIST. + * Copyright (c) 2016 Dirk Fauth. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -10,14 +10,18 @@ * Dirk Fauth <dirk.fauth@googlemail.com> - Initial API and implementation * *****************************************************************************/ -package org.eclipse.nebula.widgets.nattable.fillhandle.config; +package org.eclipse.nebula.widgets.nattable.config; /** - * Enumeration that is used to configure which directions are allowed for using - * the fill drag handle. + * Enumeration that is used to configure direction attributes. It is used for + * example + * <ul> + * <li>to configure which directions are allowed for using the fill drag handle + * </li> + * </ul> * * @since 1.4 */ -public enum FillDirection { - HORIZONTAL, VERTICAL, BOTH +public enum Direction { + NONE, HORIZONTAL, VERTICAL, BOTH } diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/fillhandle/action/FillHandleDragMode.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/fillhandle/action/FillHandleDragMode.java index 31f9177c..41fd56cf 100644 --- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/fillhandle/action/FillHandleDragMode.java +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/fillhandle/action/FillHandleDragMode.java @@ -16,12 +16,12 @@ import java.util.Date; import org.eclipse.nebula.widgets.nattable.Messages; import org.eclipse.nebula.widgets.nattable.NatTable; +import org.eclipse.nebula.widgets.nattable.config.Direction; import org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate; import org.eclipse.nebula.widgets.nattable.copy.InternalCellClipboard; import org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand; import org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand; import org.eclipse.nebula.widgets.nattable.fillhandle.command.FillHandlePasteCommand.FillHandleOperation; -import org.eclipse.nebula.widgets.nattable.fillhandle.config.FillDirection; import org.eclipse.nebula.widgets.nattable.fillhandle.config.FillHandleConfigAttributes; import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell; import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; @@ -155,17 +155,17 @@ public class FillHandleDragMode implements IDragMode { int height = -1; // check if only drag operations in one direction are supported - FillDirection direction = natTable.getConfigRegistry().getConfigAttribute( + Direction direction = natTable.getConfigRegistry().getConfigAttribute( FillHandleConfigAttributes.ALLOWED_FILL_DIRECTION, DisplayMode.NORMAL, this.selectionCell.getConfigLabels().getLabels()); if (direction == null) { - direction = FillDirection.BOTH; + direction = Direction.BOTH; } - if (direction == FillDirection.VERTICAL - || (direction == FillDirection.BOTH && yDiff >= xDiff)) { + if (direction == Direction.VERTICAL + || (direction == Direction.BOTH && yDiff >= xDiff)) { int diff = calculateIncreasedPositiveDiff(selectedRowIndex, this.startIndex.y); height = Math.max(diff, this.selectionLayer.getSelectedRowCount()); width = this.selectionLayer.getSelectedColumnPositions().length; diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/fillhandle/config/FillHandleConfigAttributes.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/fillhandle/config/FillHandleConfigAttributes.java index c623ac8b..968ebd5b 100644 --- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/fillhandle/config/FillHandleConfigAttributes.java +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/fillhandle/config/FillHandleConfigAttributes.java @@ -14,6 +14,7 @@ package org.eclipse.nebula.widgets.nattable.fillhandle.config; import java.util.Calendar; +import org.eclipse.nebula.widgets.nattable.config.Direction; import org.eclipse.nebula.widgets.nattable.style.BorderStyle; import org.eclipse.nebula.widgets.nattable.style.ConfigAttribute; import org.eclipse.swt.graphics.Color; @@ -54,8 +55,8 @@ public interface FillHandleConfigAttributes { /** * ConfigAttribute to configure the directions that are allowed for the fill - * handle. If nothing is specified {@link FillDirection#BOTH} will be used + * handle. If nothing is specified {@link Direction#BOTH} will be used * implicitly. */ - ConfigAttribute<FillDirection> ALLOWED_FILL_DIRECTION = new ConfigAttribute<FillDirection>(); + ConfigAttribute<Direction> ALLOWED_FILL_DIRECTION = new ConfigAttribute<Direction>(); } |