Generally architecture of the library widgets is simple and defines the following types of entities:
- Data Model. It's a class (Java bean) that contains data to be displayed by a widget. The same data models may be used by different widgets. However only in particular cases one widget can use different data models.
- Component. This is a class that views the model in widget specific way. If the widget is rather complicated it may delegate displaying to a renderer (see below). In this case Component performs a function of a mediator object. Any Component extends the GWT Widget class.
- Renderer. It is an optional part of the components. Some widgets have a rederer and others don't. The main idea of the Renderer is to build a complex view of the widget. Another purpose of the Renderer is to be dynamically assigned to a widget in runtime. The same widget may use different renderers.
The next diagram illustrates all the listed entities and relationships.
Each Component is associated with a least one Data Model and 0 or 1 Renderer.
You can also see the weak relationship between Renderer and Data Model. It means that Renderer can use the model
to get data and display it.
There is a default Renderer for each component (if it can use any renderer). And it's just enought to
instantiate a widget and specific default Renderer will be instantiated as well. But you have to
create and set a model because the widgets don't instantiate them automatically.