Annotated on a view model to indicate that it should be used as the home page.

The view model is instantiated through a no-arg constructor, so must in effect be stateless. Typically it will use injected repositories in order to display a dashboard, and offer actions to traverse or operate on the rendered state.


@interface HomePage {


For example, a todo app could use @HomePage on a dashboard of todo items to complete:


The corresponding code is:

@DomainObject(nature = Nature.VIEW_MODEL)
public class TodoAppDashboard {
    public String title() { return "Dashboard"; }

    public List<ToDoItem> getNotYetComplete() { /* ... */ }
    public List<ToDoItem> getComplete() { /* ... */ }

    public Blob exportToWordDoc() { /* ... */ }  (1)
1 associated using file-based layout with the notYetComplete collection.

The other two actions shown in the above screenshot — exportAsXml and downloadLayout — are actually contributed to the TodoAppDashboard through various domain services, as is the downloadLayout action.