Dynamic Web Development with Seaside

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

Some Magritte specific widgets

You can also define your own view by following the steps:

  • Create a subclass of MADescriptionComponent.
  • Override renderEditorOn: and/or renderViewerOn: 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.

Copyright © 23 April 2024 Stéphane Ducasse, Lukas Renggli, C. David Shaffer, Rick Zaccone
This book is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 license.

This book is published using Seaside, Magritte and the Pier book publishing engine.