You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

datamodel-overview.asciidoc 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ---
  2. title: Overview
  3. order: 1
  4. layout: page
  5. ---
  6. [[datamodel.overview]]
  7. = Overview
  8. The Vaadin Data Model is one of the core concepts of the library. To allow the
  9. view (user interface components) to access the data model of an application
  10. directly, we have introduced a standard data interface.
  11. The model allows binding user interface components directly to the data that
  12. they display and possibly allow to edit. There are three nested levels of
  13. hierarchy in the data model: __property__, __item__, and __container__. Using a
  14. spreadsheet application as an analogy, these would correspond to a cell, a row,
  15. and a table, respectively.
  16. .Vaadin Data Model
  17. image::img/datamodel-whitebg.png[]
  18. The Data Model is realized as a set of interfaces in the
  19. [classname]#com.vaadin.data# package. The package contains the
  20. [classname]#Property#, [classname]#Item#, and [classname]#Container# interfaces,
  21. along with a number of more specialized interfaces and classes.
  22. Notice that the Data Model does not define data representation, but only
  23. interfaces. This leaves the representation fully to the implementation of the
  24. containers. The representation can be almost anything, such as a plain old Java
  25. object (POJO) structure, a filesystem, or a database query.
  26. The Data Model is used heavily in the core user interface components of Vaadin,
  27. especially the field components, that is, components that implement the
  28. [classname]#Field# interface or more typically extend
  29. [classname]#AbstractField#, which defines many common features. A key feature of
  30. all the built-in field components is that they can either maintain their data by
  31. themselves or be bound to an external data source. The value of a field is
  32. always available through the [classname]#Property# interface. As more than one
  33. component can be bound to the same data source, it is easy to implement various
  34. viewer-editor patterns.
  35. The relationships of the various interfaces are shown in
  36. <<figure.datamodel.overview.relationships>>; the value change event and listener
  37. interfaces are shown only for the [classname]#Property# interface, while the
  38. notifier interfaces are omitted altogether.
  39. [[figure.datamodel.overview.relationships]]
  40. .Interface Relationships in Vaadin Data Model
  41. image::img/datamodel-interfaces-hi.png[]
  42. The Data Model has many important and useful features, such as support for
  43. change notification. Especially containers have many helper interfaces,
  44. including ones that allow indexing, ordering, sorting, and filtering the data.
  45. Also [classname]#Field# components provide a number of features involving the
  46. data model, such as buffering, validation, and lazy loading.
  47. Vaadin provides a number of built-in implementations of the data model
  48. interfaces. The built-in implementations are used as the default data models in
  49. many field components.
  50. In addition to the built-in implementations, many data model implementations,
  51. such as containers, are available as add-ons, either from the Vaadin Directory
  52. or from independent sources. Both commercial and free implementations exist. The
  53. JPAContainer, described in
  54. <<dummy/../../../framework/jpacontainer/jpacontainer-overview.asciidoc#jpacontainer.overview,"Vaadin
  55. JPAContainer">>, is the most often used conmmercial container add-on. The
  56. installation of add-ons is described in
  57. <<dummy/../../../framework/addons/addons-overview.asciidoc#addons.overview,"Using
  58. Vaadin Add-ons">>. Notice that unlike with most regular add-on components, you
  59. do not need to compile a widget set for add-ons that include just data model
  60. implementations.