@HomePage

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

If - for the currently logged on user - none of the view model’s members are effectively visible, (or if there are no members to begin with), the view model instance is considered hidden. Hence a NOT-AUTHORIZED page will be displayed instead.

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.

API

HomePage.java
@interface HomePage {
}

Examples

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

HomePage

The corresponding code is:

@HomePage
@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.