MagmaBeansViewPage added by Simone GianniMagma offers a number of annotations to define the view of a bean. Using annotations for view settings offer great speed during developement and prototyping, offering automatic list, display and input form generation, while a number of alternative and integrative technologies can be used to customize the view later. Also, annotations have well known limitations, which can then be addressed using more advanced techniques. View principlesSince a bean is composed of properties and actions, the view describes how these elements are to be displayed in an input form, in an output view or on a list. There is an order in which this elements are displayed; Magma supports both raw ordering and relative ordering, which consist in relating elements with others with "before" and "after". Elements can be placed on one or more layers, so that it's be possible to display customly reduced views in different situations. Also, since plain forms with all fields one after the other are boring, some elements can be placed on the side of another element. Defining view on a beanThe @MagView annotation is used to control how an element (property or action) is displayed. OrderingThe main display property is the order, which can be indicated verbatim using a number. public class User { private String name; private String surname; private Date birthday; @MagView(order=1) public String getName() { return name; } @MagView(order=2) public String getSurname() { return surnname; } @MagView(order=3) public Date getBirthday() { return birthday; } } Given this way, the output will be something like :
The other way is giving ordering rules using "before" or "after", for example : @MagView(order=1) public String getName() { return name; } @MagView(after="name") public String getSurname() { return surnname; } @MagView(after="surname") public Date getBirthday() { return birthday; } Will produce the same result, but is more flexible when it comes to extending a bean using ITD. Note that at least one element must still have an order TODO : should be possible to avoid this restriction. Side by sideAnother attribute of the @View annotation can be used to place elements side by side. For example : @MagView(order=1) public String getName() { return name; } @View(zone=Right,of="name") public String getSurname() { return surnname; } @View(after="name") public Date getBirthday() { return birthday; } In this case output will be :
Change Notification Preferences
View Online
|
Add Comment
|
- [CONF] Apache Labs > MagmaBeansView confluence
- [CONF] Apache Labs > MagmaBeansView confluence
- [CONF] Apache Labs > MagmaBeansView confluence
- [CONF] Apache Labs > MagmaBeansView confluence
