Sometimes we would like to reuse a component while adding something to it, such as an information message or extra buttons. Seaside has facilities for doing this. In Seaside parlance, this is called “decorating” a component. Note that this is not implemented using the design pattern of the same name, but rather as a Chain of Responsibility. This means that decorations form a chain of special components into which your component is inserted, and that a given message pass through the chain of decorators.
A component decoration is static in the sense that it should not change after the component has been rendered. Thus, a decoration should be attached to a component either just after it (the decorator) is created, or just before the component is passed as argument of a
self call: (aComponent
There are three kinds of decorations:
- Visual Decorations. These change a visual aspect of the decorated component:
WAMessageDecorationrenders a heading above the component;
WAFormDecorationrenders a form with buttons around the component; and
WAWindowDecorationrenders a border with a close widget around the component.
- Behavioral Decorations. These allow you to add some common behaviours to your components:
WAValidationDecorationallows you to add validation of the answer-argument and the display of an error message.
- Internal Decorations. These support internal logic that you will use when building complex applications:
WADelegationis used to implement the
WAAnswerHandleris used to handle the