06 June 2010

JavaFX App Development Part 1

Currently I am developing a JavaFX application for handling cooking recipes called Cookery. Part 1 will cover my development experiences using the JavaFX Composer in NB 6.9 RC1. Previously I had written Cookery entirely using the NB code editor and JavaFX 1.2. Unfortunately I had encountered some show stopper performance issues (with data binding) during testing, which meant I could not make any further progress with the application. This time around Cookery is undergoing a complete rewrite from scratch using JavaFX 1.3.

Since I had developed Cookery previously I had some rough screen designs on paper. Using the Composer I was able to design screens that were close to what I had on paper. Unfortunately the Composer does not yet support custom controls/classes/nodes, which meant containers had to be used during layout to hold the custom controls, thus no accurate visual feedback. On the plus side I was able to setup the layout for each screen quickly and easily.

The Composer organises control properties in a sensible way that is easily accessible. I like that fact that all commonly used properties for the selected control is presented in the top area of the Properties window. Not all properties are available in the Properties window, of particular mention is the read only properties which do not appear at all. Strangely enough there is still to way to visually manipulate the properties for the Stage (eg set the title), and properties are not sorted in ascending order for each category.

If you have ever used the previous version of the Composer you will no doubt have run into some major performance issues. Luckily with the current version it is much more responsive, and opens up design files much quicker. Also whenever a small change is made to a design file and you rerun the JavaFX project it is much quicker to build, this helped to boost productivity when the project was being built many times.

A major downside with using the Composer is the fact that it does not honour the user's formatting settings when it generates code. This slowed development down unnecessarily while I had to fix up the formatting. One major issue that is of major concern is the excessive amount of scanning that occurs whenever a change is made to a design file. This verges close to being a performance show stopper. Hopefully this issue is becoming priority number 1 with the Composer team, and will be fixed by the time the final version of NB 6.9 arrives. If necessary NB 6.9 should be delayed by about a week. It appears that the scanning issue is very common in other areas (eg JavaFX, PHP, Java).

On the positive side using the menu bar customiser proved to be a highly productive experience. Initially when I first used it I though it would not be as productive to use as Matisse's one (NB's Swing GUI builder). Who wants to manually type out the menu structure? However it proved to be the direct opposite, even saving me from manually renaming/positioning all menus/menu items. Also each menu can be customised individually without having to create the menu from scratch.

Another positive with using the Composer is that is generates very readable code that happens to be in a coding style that is very similar to my own. Any generated event handlers and binding functions/variables can be manually repositioned/changed on the fly. For handling data/state there is the Composer library which came in handy since I needed a general JavaFX database library for the application. There were two issues with the library which I was able to fix since all the source files are automatically created (for the first time only) in the project's src directory.

Listed below are the issues I encountered with the Composer and its library (most issues have workarounds):

Getting a value from a Record returns null

Ensure that the column name is correct and is in the correct case (eg in upper case).

Composer does not allow a custom control to be used visually in the Design Pane

Use a place holder Container (eg Group) in the control's place, and manually add the control to the Container.

Cannot directly resize Container's in the Design Pane

No workaround.

Cannot set any of the properties for the Stage (eg the title) in the Properties window

No workaround.

JDBC Data Source customiser does not handle a custom connection string

Change the connection property in the Properties window for the data source.

Sometimes the design file cannot be manually saved when a change is made

Close the design file and select the Save option when the dialog appears.

Excessive scrolling needs to be done with a design file in Design mode

No workaround.

Refactoring breaks when done in a design file (in Source mode)

Do manual refactoring without the assistance of the code editor's refactoring functions.

JavaFX Script code generated the Composer does not honour the user's formatting settings

Manually format the generated code.

DbDataSource returns a null RecordSet via getRecordSet function

Ensure all DbDataSource properties are correct. Also you may need to invoke the fetchData function before getting the RecordSet.

RecordSet returns null when using get(colName) function on a table column of type CLOB

Manually add code in the fetchData function (in DbDataSource) for retrieving CLOBs.

DbDataSource does not return the last insert ID used

Manually add code in DbDataSource to get the last insert id. Only a workaround if the chosen DB has a function that returns the last insert ID.

RecordSet does not have a specific function for retrieving a xxx type value from a column

Use the get function instead to retrieve the value and cast it to the specific type

1 comment:

  1. It appears that the scanning issue is very common in other areas, I needed a general JavaFX database library for the application.
    software application testing