A package containing framework for building displayer components.

Package Specification

.

The displayer package contains the interfaces that need to be implemented to provide displayer capability to the GUI components. A displayer is a graphical component able to render a changing value in its context (units, limits, display format etc). Such "changing value" is called dynamic value. A displayer may also be a setter, thus providing not only the display (read-only access) but also data changing (read-write access). An example of a displayer is a gauge component, specialized for the display of double values. Such gauge might have a minimum, maximum, units, title as a context and the value itself as a dynamic value.

Displayers communicate with their data sources with the help of adapters. Adapters are contained in a specialized package.

Displayers are JavaBeans components. They have a number of properties and communicate with other components by firing events. Displayers specified by this package are single displayers, meaning that each displays a single dynamic value of a given data type (double, int, may also be class type).

The main interface of this package is Displayer interface. This interface is not concerned with the GUI capabilities of the displayers - this is the task for the Displayer implementations. However, Displayer IF defines exactly displayer lifecycle, data states, data changes and several common displayer properties. Each displayer can be in one state at one time and must be in some state at any given instant. The states correspond roughly to two groups: a "clean" state, in which the displayer finds itself after successful construction; and "connected" state, when it communicates with modeling layer through an adapter.

As a cannonical implementation, DisplayerSupport class is provided. This class is intended to be used as a delegate (similar to PropertyChangeSupport) to be instantiated by GUI components. PanelDisplayerSupport exemplifies this paradigm by extending JPanel and delegating to DisplayerSupport. The DisplayerSupport implementation is serializable, thread safe and follows the Displayer designs by optimizing on speed and memory consumption by employing lazy creation (listener containers, events) and fast event dispatching (ListenerLists) for value change events.

Setter interface provides a separate capability for mutating the dynamic value. Setter IF may (but need not) be implemented by the same class as Displayer IF. However, the setter is always completely controlled by the displayer and its adapter and has no lifecycle control of its own. Setter also communicates with events, by which it informs the listeners about the requested value changes for the dynamic value. Such requested new value is called a "target value". A target value only becomes equal to the dynamic value when the change is confirmed by the modeling layer. The synchronization between adapter, setter and displayer is exacly prescribed by the interfaces in this package.

Setters can be thread safe (which implies a performance penalty and is rarely necessary) but need not be. SetterSupport provides a cannonical setter implementation optimized for speed. The optimization is based on the assumption, that most of the time only the adapter will listen to the set request events.

Related Documentation

JavaDoc

@see com.cosylab.gui.displayers.Displayer @see com.cosylab.gui.displayers.DisplayerSupport @see com.cosylab.gui.displayers.Setter @see com.cosylab.gui.displayers.SetterSupport @see com.cosylab.gui.adapters.Adapter