DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Data Engineering
  3. Databases
  4. New Filter API in Vaadin 6.6

New Filter API in Vaadin 6.6

Nicolas Fränkel user avatar by
Nicolas Fränkel
CORE ·
May. 02, 11 · Interview
Like (0)
Save
Tweet
Share
4.56K Views

Join the DZone community and get the full member experience.

Join For Free

Vaadin is available in version 6.6 preview since this week. Among other interesting enhancements, one surely caught my attention, the new Filter API.

To understand why it's so interesting, one must know how it's handled in version 6.5 and before. But first, a word about filters in Vaadin: they are used in containers, which handle collections of items, in order to sort out eligible items. The Container.Filterable interface define a method to add a single filter, whose signature is:

 

addContainerFilter(Object propertyId, String filterString, boolean ignoreCase, boolean onlyMatchPrefix)

So, we can only filter on string equality, and this equality can be loosened/tightened toward case and position. Morevoer, filters on the same property are additive. If you need to go beyond that, your goose is cooked. In a previous proposal to a request, the filter had to be accent insensitive, which is not supported. I had to hack like mad to implement it. In effect, since most of the container API's code is private, I copied it to offer the needed option alternative. It did the trick but it's pretty dirty.

However, the new API supplies a true extensible model for filters which renders my previous development obsolete. Facts worth mentioning are the following:

  • The Container.Filterable interface becomes Container.SimpleFilterable, with no other changes in the method signatures
  • A brand-new Container.Filterable is added, with the method:
addContainerFilter(Container.Filter filter)
  • The Filter interface becomes public, and brings an entire hierarchy, with boolean composition in mind (meaning you can OR, AND or NOT you filters in combination). The interface has two methods:
appliesToProperty(Object propertyId) passesFilter(Object itemId, Item item)

These updates make creating an accent-insensitive a breeze. Conclusion is, if you're interested in Vaadin, you have to take a look at the new version, if only for the filter API!

To go further:

  • Vaadin 6.6.0 pre1 is available here
From http://blog.frankel.ch/new-filter-api-in-vaadin-6-6
API Filter (software) Vaadin

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Mocha JavaScript Tutorial With Examples for Selenium Testing
  • 10 Most Popular Frameworks for Building RESTful APIs
  • Create CloudWatch Custom Log Metric Alarm Notification Email Solution Using Terraform
  • Event Driven 2.0

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: