Another common feature of viewers is filtering. This is used both when performing a manual search, as well as for filtering specific aspects from a view. Quite often, the filtering is connected to the view's menu, which is the drop-down triangle on the top right of the view, using a common name such as Filters. The ViewerFilter
class provides a filtering method, confusingly called select
(there are some filter methods, but these are used to filter the entire array; the select is used to determine if a specific element is shown or not).
Create a class
TimeZoneViewerFilter
in thecom.packtpub.e4.clock.ui.internal
package, which extendsViewerFilter
. It should take aString
pattern in the constructor, and returntrue
if the element is aTimeZone
with that pattern in its display name:public class TimeZoneViewerFilter extends ViewerFilter { private String pattern; public TimeZoneViewerFilter(String pattern) { this.pattern = pattern; } public...