Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk Fauth2023-01-03 22:38:16 +0000
committerDirk Fauth2023-01-03 22:38:16 +0000
commit0edf2b6ecd7e29fd4199ffb0522810f7775e1fc6 (patch)
treebec4848b1c4260222864e54128a35a8d46f2bdef
parented66565db3d4b09d8a16d02f4336e098a4f93ae1 (diff)
downloadorg.eclipse.nebula.widgets.nattable-0edf2b6ecd7e29fd4199ffb0522810f7775e1fc6.tar.gz
org.eclipse.nebula.widgets.nattable-0edf2b6ecd7e29fd4199ffb0522810f7775e1fc6.tar.xz
org.eclipse.nebula.widgets.nattable-0edf2b6ecd7e29fd4199ffb0522810f7775e1fc6.zip
Bug 581282 - Add option to configure CellPainterMouseEventMatcher with
state mask Change-Id: Ie4bc94fb838ab7510a9db81a36d331e2a1c8ddef Signed-off-by: Dirk Fauth <dirk.fauth@googlemail.com>
-rw-r--r--org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/ui/matcher/CellPainterMouseEventMatcher.java60
1 files changed, 59 insertions, 1 deletions
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/ui/matcher/CellPainterMouseEventMatcher.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/ui/matcher/CellPainterMouseEventMatcher.java
index 03d891e7..746857d9 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/ui/matcher/CellPainterMouseEventMatcher.java
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/ui/matcher/CellPainterMouseEventMatcher.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2020 Original authors and others.
+ * Copyright (c) 2012, 2023 Original authors and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
@@ -56,6 +56,35 @@ public class CellPainterMouseEventMatcher extends MouseEventMatcher {
}
/**
+ * Creates a {@link CellPainterMouseEventMatcher} for a given state mask,
+ * region name, mouse button and a specific target cellPainter instance. Can
+ * be used in case one single painter instance is registered that should be
+ * checked for.
+ *
+ * @param stateMask
+ * the state of the keyboard modifier keys and mouse masks at the
+ * time the event was generated.
+ * @param regionName
+ * The name of the region where this matcher should react on.
+ * Typically a {@link GridRegion} if a default grid is used. Can
+ * also be another value in case a custom region label is defined
+ * in a custom composition.
+ * @param button
+ * The mouse button this matcher should react on, e.g.
+ * {@link MouseEventMatcher#LEFT_BUTTON} and
+ * {@link MouseEventMatcher#RIGHT_BUTTON}
+ * @param targetCellPainter
+ * The {@link ICellPainter} instance that should be used for the
+ * check.
+ *
+ * @since 2.1
+ */
+ public CellPainterMouseEventMatcher(int stateMask, String regionName, int button, ICellPainter targetCellPainter) {
+ super(stateMask, regionName, button);
+ this.targetCellPainter = targetCellPainter;
+ }
+
+ /**
* Creates a {@link CellPainterMouseEventMatcher} for a given region name,
* mouse button and a target cellPainter class. Can be used in case every
* instance of a painter should be treated the same way, e.g. checkboxes.
@@ -78,6 +107,35 @@ public class CellPainterMouseEventMatcher extends MouseEventMatcher {
this.targetCellPainterClass = targetCellPainterClass;
}
+ /**
+ * Creates a {@link CellPainterMouseEventMatcher} for a given state mask,
+ * region name, mouse button and a target cellPainter class. Can be used in
+ * case every instance of a painter should be treated the same way, e.g.
+ * checkboxes.
+ *
+ * @param stateMask
+ * the state of the keyboard modifier keys and mouse masks at the
+ * time the event was generated.
+ * @param regionName
+ * The name of the region where this matcher should react on.
+ * Typically a {@link GridRegion} if a default grid is used. Can
+ * also be another value in case a custom region label is defined
+ * in a custom composition.
+ * @param button
+ * The mouse button this matcher should react on, e.g.
+ * {@link MouseEventMatcher#LEFT_BUTTON} and
+ * {@link MouseEventMatcher#RIGHT_BUTTON}
+ * @param targetCellPainterClass
+ * The concrete type of the {@link ICellPainter} that should be
+ * used for the check.
+ *
+ * @since 2.1
+ */
+ public CellPainterMouseEventMatcher(int stateMask, String regionName, int button, Class<? extends ICellPainter> targetCellPainterClass) {
+ super(stateMask, regionName, button);
+ this.targetCellPainterClass = targetCellPainterClass;
+ }
+
@Override
public boolean matches(NatTable natTable, MouseEvent event, LabelStack regionLabels) {
if (super.matches(natTable, event, regionLabels)) {

Back to the top