> The other is to conceive of the model as a logical /specification/ of the
> display, and for the presentation logic to consist of one or more views that
> can /implement/ that specification. So the model doesn't contain layout as
> such, but it does contain information that any given view can use to configure
> a suitable LayoutManager. Similarly for transitions, etc.
This is the way to go. I once used this idea to produce reports that
could be viewed as HTML, PDF, and TSV (for Excel), and it worked very
well. The 'model' was a table-like description of the layout, and it
was rendered appropriately in each format. Some formats supported
features that were omitted in others (e.g., no lines in TSV). There are
at least 2 good OO designs for this:
1. The model is essentially a 'specification' describing a presentation
expressed in some 'language', and each view is an 'interpreter' for
that language. The views can end up looking kind of like visitors.
2. Create only one 'abstract' interpreter. This interpreter calls
abstract methods to implement the actual display operations. Each view
is a set of implementations of the abstract methods.
1 is more flexible; 2 is more conducive to code sharing.
--
Need to get from a Foo object to a Bar object in Java?
Ask Prospector:
http://snobol.cs.berkeley.edu
Want to play tabletop RPGs over the internet?
Check out Koboldsoft RPZen:
http://www.koboldsoft.com