I’m not sure you can easily manipulate filter buttons, but you can prevent loading if some filter conditions are not filled.
@UiController("User.browse")
@UiDescriptor("user-browse.xml")
@LookupComponent("usersTable")
@Route("users")
public class UserBrowse extends StandardLookup<User> {
@Autowired
private Filter filter;
@Autowired
private Notifications notifications;
@Subscribe(id = "usersDl", target = Target.DATA_LOADER)
public void onUsersDlPreLoad(final CollectionLoader.PreLoadEvent<User> event) {
Filter.Configuration currentConfiguration = filter.getCurrentConfiguration();
LogicalFilterComponent rootLogicalFilterComponent = currentConfiguration.getRootLogicalFilterComponent();
for (FilterComponent filterComponent : rootLogicalFilterComponent.getFilterComponents()) {
if (filterComponent instanceof PropertyFilter) {
PropertyFilter propertyFilter = (PropertyFilter) filterComponent;
Object value = propertyFilter.getValue();
if (value == null) {
notifications.create(Notifications.NotificationType.WARNING)
.withCaption("Fill filter conditions")
.show();
event.preventLoad();
}
}
}
}
}
Alternatively you can not to use Generic Filter component but to create your own fixed custom filter using PropertyFilter components. In this case you’ll have full control over UI.