links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
What is Magritte?
Last updated at 8:34 am UTC on 7 September 2017
Copied from the intro to Margritte in http://www.swa.hpi.uni-potsdam.de/seaside/tutorial

Magritte provides a set of so-called descriptions (class MADescription and subclasses). You use them to declaratively describe all attributes of a domain object. Such a description defines the type of each attribute, for example, a Date, Boolean, or any other object. By default, all descriptions are collected into a description container. In addition, you can also use dynamic descriptions, that means you define new description containers with a subset of the object's descriptions.

These containers are used when creating a component for an object. This is done by sending #asComponent to that object. For every description stored in the container, an input field will be displayed and filled with the current value of the described attribute. You see: not only can Magritte create a task editor for us, it is even more powerful than ours!

Magritte was invented by Lukas Renggli in his master's thesis. As a proof of concept, he implemented the content management and wiki system Pier. Both are still improved and used by many Smalltalkers around the world.



from the same chapter

In this chapter, you have learned how to use Magritte to create powerful input dialogs and reports. The only thing you had to do was to describe your domain objects properly and then to invoke Magritte. Magritte generates the dialogs and validates your given conditions. With Magritte, you can develop faster and save a huge amount of code.

Magritte also prevents your objects to become invalid during editing by the use of the Memento pattern: the input dialog is working on a copy of the original object. Only when you successfully submit the form and no condition fails its data are copied back. If another person changed the same object concurrently, Magritte tries to merge your changes automatically.

You cannot only describe basic data types like numbers or strings. Complex structures, that are classes or even collections of classes, can also be described using relation descriptions. Of course, you can extend the description system by your own descriptions, too.

Magritte is not limited to Web applications. There is a Morphic binding, too, that works quite similarly. Instead of sending #asComponent, you call #asMorph and a new morph is shown. If you have described your domain objects once, you can use these descriptions in both environments.

The layout of the generated forms is not finite. You can use CSS to style it, but in some cases you may want to have a very special layout. Therefore, you can create your own Magritte renderer or component. Within domain objects, you can then define that your renderer or component should be used instead of the default one.

This chapter was only a very small introduction to the meta-description framework Magritte. We hope that you have seen that it allows you to fast and easily create different views to your domain objects, faithfully obeying Magritte's motto: Describe once, get everywhere.

Another explanation

See http://book.seaside.st/book/advanced/magritte/principles

In summary Magritte is really easy to use with Seaside. You put your descriptions on the class-side according to a naming-convention. You can then ask your model objects for their descriptions by sending the message description or alternatively you directly ask Magritte to build a Seaside editor for you by sending the message asComponent.