From 7a7183912475749e7e1f59c1ce79ba339b9f980d Mon Sep 17 00:00:00 2001 From: anhefti Date: Mon, 24 Jan 2022 09:24:14 +0100 Subject: [PATCH] SEBSERV-247 --- .../ch/ethz/seb/sebserver/gbl/Constants.java | 1 + .../seb/sebserver/gui/table/TableFilter.java | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/Constants.java b/src/main/java/ch/ethz/seb/sebserver/gbl/Constants.java index f13b0f9e..c6766074 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/Constants.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/Constants.java @@ -44,6 +44,7 @@ public final class Constants { public static final int DAY_IN_MIN = 60 * 24; + public static final Character ENTER = '\r'; public static final Character CARRIAGE_RETURN = '\n'; public static final Character CURLY_BRACE_OPEN = '{'; public static final Character CURLY_BRACE_CLOSE = '}'; diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/table/TableFilter.java b/src/main/java/ch/ethz/seb/sebserver/gui/table/TableFilter.java index eb354316..8ecae21c 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/table/TableFilter.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/table/TableFilter.java @@ -331,6 +331,11 @@ public class TableFilter { getAriaLabel()); this.textInput.setLayoutData(gridData); + this.textInput.addListener(SWT.KeyUp, event -> { + if (event.keyCode == Constants.ENTER.hashCode()) { + TableFilter.this.entityTable.applyFilter(); + } + }); return this; } @@ -387,6 +392,9 @@ public class TableFilter { this.selector .adaptToControl() .setLayoutData(gridData); + this.selector.setSelectionListener(event -> { + TableFilter.this.entityTable.applyFilter(); + }); return this; } @@ -439,6 +447,9 @@ public class TableFilter { this.selector = TableFilter.this.entityTable.widgetFactory.dateSelector( innerComposite, getAriaLabel()); + this.selector.addListener(SWT.Selection, event -> { + TableFilter.this.entityTable.applyFilter(); + }); return this; } @@ -532,14 +543,26 @@ public class TableFilter { final WidgetFactory wf = TableFilter.this.entityTable.widgetFactory; wf.labelLocalized(this.innerComposite, DATE_FROM_TEXT); this.fromDateSelector = wf.dateSelector(this.innerComposite, getAriaLabel()); + this.fromDateSelector.addListener(SWT.Selection, event -> { + TableFilter.this.entityTable.applyFilter(); + }); if (this.withTime) { this.fromTimeSelector = wf.timeSelector(this.innerComposite, getAriaLabel()); + this.fromTimeSelector.addListener(SWT.Selection, event -> { + TableFilter.this.entityTable.applyFilter(); + }); } wf.labelLocalized(this.innerComposite, DATE_TO_TEXT); this.toDateSelector = wf.dateSelector(this.innerComposite, getAriaLabel()); + this.toDateSelector.addListener(SWT.Selection, event -> { + TableFilter.this.entityTable.applyFilter(); + }); if (this.withTime) { this.toTimeSelector = wf.timeSelector(this.innerComposite, getAriaLabel()); + this.toTimeSelector.addListener(SWT.Selection, event -> { + TableFilter.this.entityTable.applyFilter(); + }); } return this;