Sean P. DeNigris wrote
Should or could the MADescriptionMorph hierarchy
use/inherit-fro
MAVisitor?
I gave it a shot and think it worked out pretty well. A few methods and an
instVar removed from MAContainerMorph, in exchange two methods for a
pluggable visitor. The visitor(s) themselves are two MAVisitor subclasses
with 1 API method each, and one instVar with accessors.
Magritte-Morph-SeanDeNigris.89
[FEATURE]: MADescriptionMorphs use visitor pattern to allow customization
Simple Use Case: layout labels above field widgets instead of to the left
1. Subclass MAMorphicContainerVisitor, overriding #visitDescription:
2. Subclass MAContainerMorph, overriding #visitorClass supplying #1
3. In your domain class, override #descriptionContainer to send #morphClass:
iwith #2
Details:
- New MAMorphicVisitor build morphs for each of a MADescriptionMorph's
fields and add them to its morph
- Now you can easily override the building of different field types by
subclassing MAMorphicVisitor
- MAContainerMorph
- remove all #children related logic, as that work is now delegated to the
visitor
- custom visitor can be specified by overriding #visitorClass
-----
Cheers,
Sean
--
View this message in context:
http://forum.world.st/Visitors-Underused-tp4815294p4815398.html
Sent from the Magritte, Pier and Related Tools mailing list archive at
Nabble.com.