26.7Custom Views
Components control how your objects display. Some descriptions have an obvious one to one relationship with a UI component while others could easily be shown by several different components. Figure 169 shows some components. For example, an MAMemoDescription
would be represented by a text area, but a MABooleanDescription
could be a checkbox, or a drop down with true and false, or a radio group with true and false. Each description defaults to a component, but allows you to override and specify any component you choose, including any custom one you may write using the message Description>>componentClass:
.
aDescription componentClass: aClass
You can also define your own view by following the steps:
- Create a subclass of
MADescriptionComponent
. - Override
renderEditorOn:
and/orrenderViewerOn:
as necessary. - Use your custom view together with your description by using the accessor
componentClass:
. - Possibly add your custom view to its description into
defaultComponentClasses
.