The model
submodule provides implementations
of Wicket IModel
s, with
these IModel
s wrapping Naked
Objects domain objects. These IModel
s
are shared among different views defined in the ui
module.
The most important models are:
EntityModel
Represents a domain object
ScalarModel
Represents either a property of a domain object (along with its value), or a parameter of an action (again, along with its value). When used to represent a property, the model can indicate its owning domain object.
EntityCollectionModel
Represents a collection of entities, either owned by a domain
object (that is, representing the contents of a domain object's
collection, such as an Order
's
lineItems
collection), or standalone (that is, as
the result of an action, such as
CustomerRepository#findCustomers()
).
ActionModel
Represents an action to invoke (which may include action parameters), or the results of invoking that action.
There are also a couple of supporting models:
ApplicationActionsModel
Provides a hierarchical set of actions for the registered application services
ValueModel
Represents a standalone value, eg the result of an action
(CustomerRepository#countBlacklistedCustomers()
)
WelcomeModel
Holds the contents of the welcome message on the home page
The IModel
s also handle serialization
issues required by Wicket's stateful architecture,
storing the state of these domain objects transparently in mementos
(even if the underlying pojos are not serializable).