Good Practices

General

This section contains do's and don'ts and some general good practices that might be helpful to ULC application developers.

Call-back functions

Notification is always done through call-back functions, which are realized as listener interfaces. It is not possible to stop somewhere in your server-side code and wait until the user triggers something and to only then continue the server-side code on the next line. Your code got triggered as a reaction to a user request and we have to return a response to finish the round-trip. This is different from a pure Swing application.

Static variables

Never keep instances of ULC classes in static variables (ULCIcons neither!). They cannot be shared between different sessions.

Tip : CheckStyle already has a check to warn for such cases: AvoidModifiersForTypesCheck and code.

ULCComponent instances

The same instance of a ULCComponent cannot be added to different panes at the same time. This behaviour is analogous to Swing. Since ULCIcon is not an instance of ULCComponent, for a given session, you can reuse an instance of ULCIcon within any number of panes.

Renderers

Currently, you cannot modify the text in a renderer of any widget. Therefore, make sure your widget's model returns the text to be displayed. As an alternative, provide a decorator model that converts your data to its UI representation.

Event handling

Do not use asynchronous event handling, except when you are aware of its consequences.

Thread-safety

Do not access ULC components except from within the ULC thread. Otherwise, the behaviour of your application is not specified.
Polling Timer

Serializable Session

Keep your session serializable in order to allow proper integration into Servlet and EJB application servers. This means that all objects having your IApplication instance as an ancestor should be serializable and any objects put in the ApplicationContext should be serializable as well (or need to be marked as transient using ApplicationContext.setAttribute(key, value, true)).
Serializable Check

Session Termination

Always terminate a session by calling ApplicationContext.terminate(). Never use System.exit().

Component Reuse

Keep the server and client memory-footprint low by reusing ULC components like ULCFrame, ULCWindow, etc. Hold these components in a pool and reconfigure them before display. Keep your pool in the ApplicationContext.

Cool GUIs

This section contains some ideas how you can make your Swing GUIs look more appealing.

ULCBoxPane

When using the ULCBoxPane, make sure that for each column, at least one component has its vertical constraint property set to EXPAND and for each row, at least one component has its horizontal constraint property set to EXPAND. Otherwise, your UI might like odd when extra space is available.

Icons

Use meaningful icons for buttons, toolbar entries, menus, windows, splash screens, etc.
IconExperience Homepage

Rollover Icons

Using rollover icons gives your toolbar buttons a nice touch.

Look&Feel

On MS Windows clients, use the JGoodies Look&Feel. On Mac OS X clients, use the system Look&Feel.
ULC Online Shop JGoodies Homepage

Splash Screen

Use a splash screen that is shown between connecting to ULC's server-side and until the libraries and UI descriptions are uploaded to the client.
Splash Screen

Writing Extensions

See the ULC Extension Guide for information about the use of the new Extension API.

Operation

This section contains some suggestions what to do before and during operation.

Simulate low bandwidth

Discover client-server traffic and communication bottlenecks already during development time. This can be achieved by launching ULC's DevelopmentRunner using the -useGui program parameter and changing the communication speed to a lower rate.

Check reachability through firewalls and proxies

Make sure your application can be accessed from remote clients. If it fails, this might be due to firewall or proxy settings (client-side or server-side). Use the Ping tool to narrow down the problem.
Ping