From b75f01b9e511da115a818402edddda9985f98174 Mon Sep 17 00:00:00 2001 From: Maxim Gorbunkov Date: Thu, 10 Sep 2015 06:24:38 +0000 Subject: [PATCH] Ability to override filter fts shortcut listener #PL-5940 --- .../components/filter/FilterDelegateImpl.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/gui/src/com/haulmont/cuba/gui/components/filter/FilterDelegateImpl.java b/modules/gui/src/com/haulmont/cuba/gui/components/filter/FilterDelegateImpl.java index 4acebfc691..cd4db1b129 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/components/filter/FilterDelegateImpl.java +++ b/modules/gui/src/com/haulmont/cuba/gui/components/filter/FilterDelegateImpl.java @@ -309,12 +309,7 @@ public class FilterDelegateImpl implements FilterDelegate { ftsSearchCriteriaField.setWidth(theme.get("cuba.gui.filter.ftsSearchCriteriaField.width")); ftsSearchCriteriaField.setInputPrompt(getMessage("Filter.enterSearchPhrase")); ftsSearchCriteriaField.requestFocus(); - filterHelper.addShortcutListener(ftsSearchCriteriaField, new FilterHelper.ShortcutListener("ftsSearch", new KeyCombination(KeyCombination.Key.ENTER, null)) { - @Override - public void handleShortcutPressed() { - applyFts(); - } - }); + filterHelper.addShortcutListener(ftsSearchCriteriaField, createFtsSearchShortcutListener()); controlsLayout.add(ftsSearchCriteriaField); searchBtn = componentsFactory.createComponent(Button.class); @@ -342,6 +337,15 @@ public class FilterDelegateImpl implements FilterDelegate { controlsLayout.add(ftsSwitch); } + protected FilterHelper.ShortcutListener createFtsSearchShortcutListener() { + return new FilterHelper.ShortcutListener("ftsSearch", new KeyCombination(KeyCombination.Key.ENTER, null)) { + @Override + public void handleShortcutPressed() { + applyFts(); + } + }; + } + protected void createFtsSwitch() { ftsSwitch = componentsFactory.createComponent(CheckBox.class); ftsSwitch.setCaption(getMessage("Filter.ftsSwitch"));