Glazed Lists

Glazed Lists demo

Swing, though powerful, has a tendency to require reams of boilerplate code even to get relatively simple tasks done. Custom table models, list models, column sorters, filters, event handlers and so on... it all requires the Swing programmer to jump through some often circumlocutory design pattern hoops.

Data models for different components are also not especially well integrated. For example, if you have a custom model for a JList and you want to add an extra column (i.e. turn it into a JTable), you’ll have to throw away your custom List Model and start over with a new, incompatible Table Model.

It isn’t a problem, as long as your requirements never change and you never want to add new features. In other words, it’s a problem.

Enter Glazed Lists: a powerful and refreshingly sane API that radically simplifies the Swing programming experience. To the creators of Glazed Lists, boilerplate code is the enemy: so their API works overtime to give you sensible defaults and many factory methods to create custom models, table column sorters, filters and so on.

Their six-minute webcast demonstrates just how straightforward Glazed Lists is to use, and the positive impact it can have on your codebase.

Two areas that look particularly useful are: that the API is designed with concurrency in mind; and the API’s ability to stream data into your tables, and to sort the incoming live data automatically. It would be interesting to see how this holds up for, say, a trading system with > 1,000 or so incoming trades per second.

Another plus is that Glazed Lists, being of modular design, works well with both Swing and SWT. Check out the new features available in the latest 1.7.0 release.

About the Author

Matt Stephens is a senior architect, programmer and project leader based in Central London. He co-wrote Agile Development with ICONIX Process, Extreme Programming Refactored, and Use Case Driven Object Modeling with UML - Theory and Practice.