2.7. Alternate Views

As we've seen already, there's a Component to render an entire entity. In fact, it's possible to provide more than one Component to do this. We could also view the entity in a tabbed view:

When there is more than one Component capable of rendering the object, Wicket Objects allows the view to be selected:

This works for collections too; using the selector we can view a collection of Employees in a variety of ways:

Selecting the icons view shows the collection of Employees as icons:

So far all the screenshots we've seen have been generated from a basic domain application, with no custom GUI coding (see Appendix A, Example Application). But Wicket Objects is also extensible. So, we can write custom views/components, provide a corresponding ComponentFactory and then plug them into Wicket Objects' registry of ComponentFactorys. For example, if we make Employee implement a view-specific Locatable interface, then we can render them on a google-maps mashup:

The selector, by the way, is actually implemented as yet another view/component, capable of rendering the entity or collection. It queries the ComponentFactory registry to determine how many other ComponentFactorys there are capable of rendering the entity or collection; if more than one then it provides a drop-down and then delegates to the other Components to do the work.