CollectionFilterService

EXPERIMENTAL/DRAFT

If at least one CollectionFilterService is registered with Spring’s context that handles a given domainType, viewer implementations (like Wicket Viewer) should show a quick-search prompt, which is rendered on top of the UI table that presents the collection in question.

API

CollectionFilterService.java
interface CollectionFilterService {
  boolean handles(Class<?> domainType)     (1)
  Function<T, Tokens> tokenizer(Class<T> domainType)     (2)
  BiPredicate<Tokens, String> tokenFilter(Class<T> domainType)     (3)
  String sanitzeSearchArgument(String searchArg)     (4)
  TranslatableString searchPromptPlaceholderText(Class<?> domainType)     (5)
  TranslationContext translationContext(Class<?> domainType)     (6)
}
1 handles(Class)

Whether this service handles given type.

2 tokenizer(Class)

Returns a function that for a given domainObject returns Tokens (words), that are then matchable by #tokenFilter(Class) .

3 tokenFilter(Class)

For given domainType returns a BiPredicate that matches Tokens against a nullable searchString.

4 sanitzeSearchArgument(String)

Pre-process user input before passing it to the matcher.

5 searchPromptPlaceholderText(Class)

Placeholder text for the quick-search prompt.

6 translationContext(Class)

Provides the TranslationContext for translating the #searchPromptPlaceholderText(Class) .

Members

handles(Class)

Whether this service handles given type.

tokenizer(Class)

Returns a function that for a given domainObject returns Tokens (words), that are then matchable by #tokenFilter(Class) .

For example the domain object’s title could be tokenized (parsed into tokens).

tokenFilter(Class)

For given domainType returns a BiPredicate that matches Tokens against a nullable searchString.

For example, the searchString could be tokenized (parsed into tokens), and then matched against the Tokens using either OR or AND semantics.

The default implementation sanitizes the user input (searchArg) then strips any leading or trailing blanks and handles the empty searchArg case.

sanitzeSearchArgument(String)

Pre-process user input before passing it to the matcher.

Default behavior is to strip leading or trailing blanks (if any).

searchPromptPlaceholderText(Class)

Placeholder text for the quick-search prompt.

translationContext(Class)

Provides the TranslationContext for translating the #searchPromptPlaceholderText(Class) .