Happily, it turns out this was the case, and the results are seen in Fig. 12.3. You??™ll just
316 DOMAIN FRAMEWORK
have to take our word for it that theWatch example really was our ?¬?rst shot at making a
DSM example to accompany MetaEdit+, and not for instance the only one out of 27
such examples that we could actually get to work!
You may recall that the authors of the existing framework, while experienced
programmers, were Java novices. The original code was thus unsurprisingly in need of
refactoring, and the new platform provided a good reason. First, we refactored out the
mass of user-interface, control, and state machine behavior into their own classes.
From this, it was easier to see what had to be done.
The majority of classes were platform independent, requiring only basic Java
functionality. The user interface and control Application Program Interfaces (APIs)
are different for MIDP, with only very basic widget support. The widgets for
displaying the time and icons were thus replaced with a lower-level set of text drawing
operations in a newWatchCanvas class. As the text and icons had to adapt to different
MIDP devices??™ fonts and screen sizes, it was soon noticed that a similarWatchCanvas
class could also replace the old widgets in the applet version. This resulted in
smoother updating in the applet, as well as keeping the applet and MIDP versions
more visually similar.
Pages:
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594