Java Reference
In-Depth Information
Decision point
How do we make the bar code reader and the terminal communicate?
We adopt the Observer pattern (see Sidebar 8.1, page 181); the observer
interface is BarCodeListener , which is implemented by class CounterFrame .
The observable is the class BarCodeReader , which generates an event of class
BarCodeReaderEvent that contains all the information related to the bar code
read. Such an approach is similar, but simpler, to the solution adopted by
the Java for Retail POS Committee (Java POS Committee 2001). The classes
are described in Figure 14.8. This design decouples the counter window and
the bar code reader window making it easier to replace the emulation
window with the actual device.
The appearance of the terminal GUI must be reconfigured upon a success-
ful login. The login layout shown in Figure 14.6 (top) must be transformed
into the normal operation layout shown in Figure 14.6 (bottom).
Decision point
How to reconfigure the graphical layout of the terminal user interface?
The reconfiguration of the user interface can be achieved in two alter-
native ways: first by using several windows, second by modifying the con-
tents of a single window. The latter option is made possible by dynamically
reconfigurable layouts such as the grid bag layout. It has the advantage of
being simpler and more lightweight. The grid bag layout is one of the
standard layout managers of the Java AWT.
Figure 14.8 Counter terminal user interface class diagram
Search WWH ::

Custom Search