Customise Save and Save As action in Filters

Hello

I want to validate the conditions provided by the user across the screens while he tries to save the filter. Is it possible to override the save filter functionality?

Any takers?

Hi,

Filter component behavior is inside the FilterDelegate Spring bean. In your project, you can override this bean.

You may create a class that extends the FilterDelegateImpl class in the web module of your app:

public class ExtFilterDelegateImpl extends FilterDelegateImpl {

    @Override
    protected void createFilterActions() {
        super.createFilterActions();
        saveAction = new MySaveAction("save", false, getMainMessage("filter.save"));
    }

    private class MySaveAction extends SaveAction {

        public MySaveAction(String id, boolean saveWithValues, String caption) {
            super(id, saveWithValues, caption);
        }

        @Override
        public void actionPerform(Component component) {
            getNotifications().create(Notifications.NotificationType.HUMANIZED)
                    .withCaption("Pre-save check invoked")
                    .show();
            super.actionPerform(component);
        }
    }
}

and register the bean in web-spring.xml:

<bean id="cuba_FilterDelegate" class="com.company.sample.web.ExtFilterDelegateImpl" scope="prototype"/>