This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

JavaFx 2.0 - TableView connected to a Database

We made some tests with TableView and missed productivity features like Load-on-demand and database support. So we tried to use our DataBooks with a TableView. We need a TableView that is re-usable and shows data from remote storages like databases or csv files. It should support multi-column sorting and of course, load records on demand. A nice feature would be support for edit data without boilerplate code.

Our first simple use-case: Show records from a database table

The result:

TableView with IDataBook

TableView with IDataBook

The implementation is not finished and is more a PoC, but it works great! The source code is available here.
It is also possible to edit data, but the different datatypes are not yet supported!

Simply use the table view to show dynamic content. Allow editing without additional source code. Don't re-invent the wheel again!

The source code of the test application is available here.

JavaFx 2.0 and Business Applications

JavaFx 2.x has some nice UI components. It has new APIs and it is completely different to Swing. Of course, you can mix JavaFx components with Swing components, but the LaF is not the same! The new styling mechanism of JavaFx are really great.

But for me, its not a big step forward in the evolution. It is another UI library, of course a visually appealing. I miss an application framework or components with built-in support for modern applications. From my point of view, there is not enough focus on business applications. A business application is not a simple table or chart with some nice looking bars. A business app should handle millions of records, should allow keyboard navigation in all variants, should be fast, should save costs and time.

What should be different?

A standard JavaFx 2 application looks very nice because the standard style is modern. Also styling options are better than ever.

For me, the whole API is too much focused on Lists, POJOs, Generics and Object Bindings. Of course, it is cool for small apps, but you waste time with boilerplate code. If you have a database application with 5 simple tables that contains master data, and you need edit screens, you duplicate your source code 5 times because you have no support for dynamic usage. If you work without Generics, it is not really funny because JavaFx uses it everywhere.

Load-on-demand of records is possible if you do it manually, but it is not included in the controls. "Touch-scrolling" would be great. Compared to other UI libraries (swing, swt, qt), you can't change the default operation of UI controls because you don't have access to internal listeners, scrollbars, Behaviour, ... Some parts are customizable but these are more the exception.

The whole event handling is sometimes very complex, because you don't know what event type you have to use, where the type is declared and which event is the correct one. And inner classes are not the best solution for clarity. Because of Generics you have a lot of configuration work and you are not sure if everything works as expected. Without powerful IDEs you have no chance. Sometimes you have events but nothing happened....
That parts are not the real problem because it requires a certain amount of time to understand new classes. But must things always be complex rather than simple?

But it is great to write source code instead of crazy scripts.

What else?

The version number 2 is too high, because it is still not mature. JavaFx shows what is possible (scene graph, effects, web and video content) but it is not simple to use. But maybe it is perfect to combine only some parts with other mature toolkits like Swing or Swt?

It is not the library that bothers me, but it brings little relief for a developer. Why not just use Pivot? Yes... the web view is powerful ;-)

What should be done?

Focus on Business applications. Integrate an application framework that saves development time. Controls should not be so restrictive!