SlideShare a Scribd company logo
Vaadin Data Model and
JPAContainer
YRD.DOÇ.DR. CELAL MURAT KANDEMİR
ESKİSEHİR OSMANGAZI UNIVERSITY – FACULTY OF EDUCATION
This work is licensed under a Creative Commons Attribution 4.0 International License. http://creativecommons.org/licenses/by-nc/4.0/
Three-Layer Architecture
The data binding model in Vaadin can be used to bind user interface components to a domain
layer.
Role of JPAContainer in binding Vaadin
components to a database
Vaadin JPAContainer allows connecting Vaadin user interface components directly to the
persistent model objects.
You can use the container to display data in a table, tree, any other selection component, or
edit the data in a form.
Data Model
Vaadin Data Model-Binding Components
to Data
The model allows binding user interface
components directly to the data that they display and
possibly allow to edit. There are three nested levels
of hierarchy in the data model: property, item,
and container. Using a spreadsheet application as an
analogy, these would correspond to a cell, a row, and
a table, respectively.
The Data Model is realized as a set of interfaces in
the com.vaadin.data package. The package contains
the Property, Item, and Container interfaces, along
with a number of more specialized interfaces and
classes.
Vaadin Data Model-Binding Components
to Data
The Data Model has many important and useful
features, such as support for change notification.
Especially containers have many helper interfaces,
including ones that allow indexing, ordering, sorting,
and filtering the data.
Field components provide a number of features
involving the data model, such as buffering,
validation, and lazy loading.
Properties
The Property interface is the base of the Vaadin Data Model. It provides a standardized API for
a single data value object that can be read (get) and written (set).
You can set the value of a property with setValue() and read with getValue()
Property Viewers and Editors
A property can be bound to a component
implementing the Viewer interface with
setPropertyDataSource()
You can use the same method in the Editor
interface to bind a component that allows
editing a particular property type to a
property.
Field Validation
ObjectProperty Implementation
The ObjectProperty class is a simple implementation of the Property interface that allows
storing an arbitrary Java object.
Converting Between Property Type and
Representation
Holding properties in Items
The Item interface provides access to a set of named properties.
Each property is identified by a property identifier (PID) and a reference to such a property can
be queried from an Item with getItemProperty() using the identifier.
Wrapping a Bean in a BeanItem
The BeanItem
implementation of the
Item interface is a wrapper
for Java Bean objects.
In fact, only the setters
and getters are required
while serialization and
other bean features are
not, so you can wrap
almost any POJOs with
minimal requirements.
Nested Beans
You may often have composite classes where one class "has a" another class.
Nested Beans
When shown in a Form, for example, you would
want to list the properties of the nested bean
along the properties of the composite bean.
You can do that by binding the properties of the
nested bean individually with a MethodProperty
or NestedMethodProperty.
The difference is that NestedMethodProperty
does not access the nested bean immediately but
only when accessing the property values, while
when using MethodProperty the nested bean is
accessed when creating the method property.
The difference is only significant if the nested
bean can be null or be changed later.
A Form with Nested Bean Properties
A Form with Nested Bean Properties
The item could be any item type, as described earlier.
A Form with Nested Bean Properties
Design a form for editing the data.
A Form with Nested Bean Properties
Bind the fields to the data as follows:
Collecting Items in Containers
All of the user interface components using containers also implement the relevant container
interfaces themselves, so that the access to the underlying data source is delegated through the
component.
Creating and Binding a Container
More details about Data Model
https://vaadin.com/book/-/page/datamodel.html
Vaadin JPAContainer
Three-Layer Architecture
The data binding model in Vaadin can be used to bind user interface components to a domain
layer.
Role of JPAContainer in binding Vaadin
components to a database
Vaadin JPAContainer allows connecting Vaadin user interface components directly to the
persistent model objects.
You can use the container to display data in a table, tree, any other selection component, or
edit the data in a form.
Properties
Atomic data is represented as Property objects that have a value and a type. Properties can be
bound to Field components, such as a TextField, or a table cell.
The ObjectProperty used above is just one implementation of the Property interface – in
JPAContainer we use a different property type.
Items
An Item is a collection of properties that is typically bound to a Form or a row in a Table or
some other selection component. Properties of an item are identified by a property identifier
(PID).
Containers
A Container is a collection of items, usually bound to a Table, Tree, or some other selection
component. Items in a container are identified by an item identifier (IID). Normally, all the items
in a container have the same type and the same properties.
Normal (Non-Persistent) Binding to
JavaBeans
Vaadin core library provides BeanItem implementation of the Item interface to bind bean objects. At the
Container level, Vaadin provides the BeanItemContainer and BeanContainer implementations.
They are very useful for handling transient (non-persistent) objects.
Java Persistence API
Java Persistence API (JPA) is an API for object-
relational mapping (ORM) of Java objects to a
relational database.
In JPA and entity-relationship modeling in general,
a Java class is considered an entity.
Class (or entity) instances correspond with a row in
a database table and member variables of a class
with columns.
Entities can also have relationships with other
entities.
Installing Vaadin JPAContainer
https://vaadin.com/book/-/page/jpacontainer.installation.html
https://vaadin.com/directory#!addon/vaadin-jpacontainer
JPAContainer AddressBook Demo
Next Lab
https://vaadin.com/tutorial

More Related Content

PDF
Vaadin 8 with Spring Frameworks AutoConfiguration
PPTX
Data binding в массы! (1.2)
PDF
Anton Minashkin Dagger 2 light
PPTX
Android data binding
PPTX
Introduction to JPA (JPA version 2.0)
PDF
Deep dive into Android Data Binding
PPTX
Jpa 2.1 Application Development
PDF
MVVM & Data Binding Library
Vaadin 8 with Spring Frameworks AutoConfiguration
Data binding в массы! (1.2)
Anton Minashkin Dagger 2 light
Android data binding
Introduction to JPA (JPA version 2.0)
Deep dive into Android Data Binding
Jpa 2.1 Application Development
MVVM & Data Binding Library

What's hot (20)

ODP
JPA Best Practices
PPT
Entity Persistence with JPA
PPTX
Metaworks3
PDF
"Android Data Binding в массы" Михаил Анохин
PDF
Михаил Анохин "Data binding 2.0"
PPT
Java Persistence API (JPA) Step By Step
PDF
Java persistence api 2.1
PPT
Complex Data Binding
PDF
JPA 2.1 performance tuning tips
ODP
Hibernate complete Training
DOCX
TY.BSc.IT Java QB U2
ODP
Java Persistence API
DOCX
Ecom lec4 fall16_jpa
PDF
New Features of JSR 317 (JPA 2.0)
PDF
J2EE jsp_03
ODP
Polyglot persistence with Spring Data
PPT
Introduction to hibernate
PDF
ButterKnife
PDF
Backendless apps
PPTX
Develop a native application that uses GPS location.pptx
JPA Best Practices
Entity Persistence with JPA
Metaworks3
"Android Data Binding в массы" Михаил Анохин
Михаил Анохин "Data binding 2.0"
Java Persistence API (JPA) Step By Step
Java persistence api 2.1
Complex Data Binding
JPA 2.1 performance tuning tips
Hibernate complete Training
TY.BSc.IT Java QB U2
Java Persistence API
Ecom lec4 fall16_jpa
New Features of JSR 317 (JPA 2.0)
J2EE jsp_03
Polyglot persistence with Spring Data
Introduction to hibernate
ButterKnife
Backendless apps
Develop a native application that uses GPS location.pptx
Ad

Viewers also liked (20)

PDF
Binding business data to vaadin components
PDF
Vaadin 8 - Data Binding with Binder
PDF
[강의소개] 안드로이드 앱 개발 입문 캠프 4기
PDF
Remote controlling Parrot AR Drone with Spring Boot & Vaadin (JavaCro15)
PPTX
Java JPA
PDF
자바 8 스트림 API
PDF
Redis edu 1
PDF
간단 Ip 필터 구현 이야기
PPTX
mongodb와 mysql의 CRUD 연산의 성능 비교
PPTX
이것이 레디스다.
PPTX
Mongo DB 성능최적화 전략
PDF
자바8 스트림 API 소개
PPTX
Vermont Code Camp 2014 Simple Rover with RaspberryPi
PPTX
Bebetter powerpoint
PPTX
Система работы методической службы
PPTX
Video Techniques and Influences
PPTX
Chris
PDF
EL PUNTO, LA linea Y EL PLANO
PPT
The aztecs
PPTX
лр1 (петреченко)
Binding business data to vaadin components
Vaadin 8 - Data Binding with Binder
[강의소개] 안드로이드 앱 개발 입문 캠프 4기
Remote controlling Parrot AR Drone with Spring Boot & Vaadin (JavaCro15)
Java JPA
자바 8 스트림 API
Redis edu 1
간단 Ip 필터 구현 이야기
mongodb와 mysql의 CRUD 연산의 성능 비교
이것이 레디스다.
Mongo DB 성능최적화 전략
자바8 스트림 API 소개
Vermont Code Camp 2014 Simple Rover with RaspberryPi
Bebetter powerpoint
Система работы методической службы
Video Techniques and Influences
Chris
EL PUNTO, LA linea Y EL PLANO
The aztecs
лр1 (петреченко)
Ad

Similar to Vaadin JPAContainer (20)

PDF
Introduction to Spring Framework
PPTX
P20CSP105-AdvJavaProg.pptx
PPT
Session 5 Tp5
PPTX
Ado.Net Tutorial
PPT
Metamorphosis from Forms to Java: A technical lead's perspective, part II
PDF
Spring 2
PPTX
Java Beans
PPTX
Entity Frame Work Core.pptx
PDF
Dao pattern
PPTX
Data Binding for Xamarin Forms In-Depth
PPT
PPT
Ado.net
PPTX
Ef code first
PPT
Introduction to java beans
PPT
Hibernate Session 1
PDF
Oracle application-development-framework-best-practices
PPT
Jdbc Lecture5
DOCX
TY.BSc.IT Java QB U6
PDF
Data Binding in Silverlight
PPTX
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad
Introduction to Spring Framework
P20CSP105-AdvJavaProg.pptx
Session 5 Tp5
Ado.Net Tutorial
Metamorphosis from Forms to Java: A technical lead's perspective, part II
Spring 2
Java Beans
Entity Frame Work Core.pptx
Dao pattern
Data Binding for Xamarin Forms In-Depth
Ado.net
Ef code first
Introduction to java beans
Hibernate Session 1
Oracle application-development-framework-best-practices
Jdbc Lecture5
TY.BSc.IT Java QB U6
Data Binding in Silverlight
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad

More from cmkandemir (20)

PDF
Temel HTML Etiketleri ve Kullanım Örnekleri
PDF
Yapay Zeka Nedir?
PDF
Zekayı Anlamak
PDF
PHP - Kullanıcı Girişlerinin İşlenmesi
PDF
Chapter 2-8085 Microprocessor Architecture and Microcomputer Systems
PDF
Chapter 1-Microprocessors, Microcomputers, and Assembly Language
PDF
Chapter 7 - Programming Techniques with Additional Instructions
PDF
Chapter 6 - Introduction to 8085 Instructions
PDF
Canvas Öğrenme Yönetim Sistemi Kullanım Kılavuzu Bölüm 2
PDF
Canvas Öğrenme Yönetim Sistemi Kullanım Kılavuzu Bölüm 1
PDF
Matching Game In Java
PDF
impress.js Framework
PDF
openCV and Java - Face Detection
PDF
PHP ve MySQL Bağlantısı - Temel İşlemler
PDF
CSS Uygulamaları 1
PDF
CSS - Sunum Bileşenleri
PDF
Kod Akış Kontrolü - Döngüler, Fonksiyonlar
PDF
Web Sitesi Geliştirme Adımları
PDF
CSS - Genel Bakış
PDF
Threads and Game Programming In Java
Temel HTML Etiketleri ve Kullanım Örnekleri
Yapay Zeka Nedir?
Zekayı Anlamak
PHP - Kullanıcı Girişlerinin İşlenmesi
Chapter 2-8085 Microprocessor Architecture and Microcomputer Systems
Chapter 1-Microprocessors, Microcomputers, and Assembly Language
Chapter 7 - Programming Techniques with Additional Instructions
Chapter 6 - Introduction to 8085 Instructions
Canvas Öğrenme Yönetim Sistemi Kullanım Kılavuzu Bölüm 2
Canvas Öğrenme Yönetim Sistemi Kullanım Kılavuzu Bölüm 1
Matching Game In Java
impress.js Framework
openCV and Java - Face Detection
PHP ve MySQL Bağlantısı - Temel İşlemler
CSS Uygulamaları 1
CSS - Sunum Bileşenleri
Kod Akış Kontrolü - Döngüler, Fonksiyonlar
Web Sitesi Geliştirme Adımları
CSS - Genel Bakış
Threads and Game Programming In Java

Recently uploaded (20)

PDF
Computing-Curriculum for Schools in Ghana
PPTX
A powerpoint presentation on the Revised K-10 Science Shaping Paper
PDF
Hazard Identification & Risk Assessment .pdf
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PDF
What if we spent less time fighting change, and more time building what’s rig...
PPTX
Lesson notes of climatology university.
PDF
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
RMMM.pdf make it easy to upload and study
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
PDF
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
PDF
1_English_Language_Set_2.pdf probationary
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
Computing-Curriculum for Schools in Ghana
A powerpoint presentation on the Revised K-10 Science Shaping Paper
Hazard Identification & Risk Assessment .pdf
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
What if we spent less time fighting change, and more time building what’s rig...
Lesson notes of climatology university.
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
Final Presentation General Medicine 03-08-2024.pptx
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
Chinmaya Tiranga quiz Grand Finale.pdf
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
RMMM.pdf make it easy to upload and study
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
1_English_Language_Set_2.pdf probationary
Practical Manual AGRO-233 Principles and Practices of Natural Farming

Vaadin JPAContainer

  • 1. Vaadin Data Model and JPAContainer YRD.DOÇ.DR. CELAL MURAT KANDEMİR ESKİSEHİR OSMANGAZI UNIVERSITY – FACULTY OF EDUCATION This work is licensed under a Creative Commons Attribution 4.0 International License. http://creativecommons.org/licenses/by-nc/4.0/
  • 2. Three-Layer Architecture The data binding model in Vaadin can be used to bind user interface components to a domain layer.
  • 3. Role of JPAContainer in binding Vaadin components to a database Vaadin JPAContainer allows connecting Vaadin user interface components directly to the persistent model objects. You can use the container to display data in a table, tree, any other selection component, or edit the data in a form.
  • 5. Vaadin Data Model-Binding Components to Data The model allows binding user interface components directly to the data that they display and possibly allow to edit. There are three nested levels of hierarchy in the data model: property, item, and container. Using a spreadsheet application as an analogy, these would correspond to a cell, a row, and a table, respectively. The Data Model is realized as a set of interfaces in the com.vaadin.data package. The package contains the Property, Item, and Container interfaces, along with a number of more specialized interfaces and classes.
  • 6. Vaadin Data Model-Binding Components to Data The Data Model has many important and useful features, such as support for change notification. Especially containers have many helper interfaces, including ones that allow indexing, ordering, sorting, and filtering the data. Field components provide a number of features involving the data model, such as buffering, validation, and lazy loading.
  • 7. Properties The Property interface is the base of the Vaadin Data Model. It provides a standardized API for a single data value object that can be read (get) and written (set). You can set the value of a property with setValue() and read with getValue()
  • 8. Property Viewers and Editors A property can be bound to a component implementing the Viewer interface with setPropertyDataSource() You can use the same method in the Editor interface to bind a component that allows editing a particular property type to a property.
  • 10. ObjectProperty Implementation The ObjectProperty class is a simple implementation of the Property interface that allows storing an arbitrary Java object.
  • 11. Converting Between Property Type and Representation
  • 12. Holding properties in Items The Item interface provides access to a set of named properties. Each property is identified by a property identifier (PID) and a reference to such a property can be queried from an Item with getItemProperty() using the identifier.
  • 13. Wrapping a Bean in a BeanItem The BeanItem implementation of the Item interface is a wrapper for Java Bean objects. In fact, only the setters and getters are required while serialization and other bean features are not, so you can wrap almost any POJOs with minimal requirements.
  • 14. Nested Beans You may often have composite classes where one class "has a" another class.
  • 15. Nested Beans When shown in a Form, for example, you would want to list the properties of the nested bean along the properties of the composite bean. You can do that by binding the properties of the nested bean individually with a MethodProperty or NestedMethodProperty. The difference is that NestedMethodProperty does not access the nested bean immediately but only when accessing the property values, while when using MethodProperty the nested bean is accessed when creating the method property. The difference is only significant if the nested bean can be null or be changed later.
  • 16. A Form with Nested Bean Properties
  • 17. A Form with Nested Bean Properties The item could be any item type, as described earlier.
  • 18. A Form with Nested Bean Properties Design a form for editing the data.
  • 19. A Form with Nested Bean Properties Bind the fields to the data as follows:
  • 20. Collecting Items in Containers All of the user interface components using containers also implement the relevant container interfaces themselves, so that the access to the underlying data source is delegated through the component.
  • 21. Creating and Binding a Container
  • 22. More details about Data Model https://vaadin.com/book/-/page/datamodel.html
  • 24. Three-Layer Architecture The data binding model in Vaadin can be used to bind user interface components to a domain layer.
  • 25. Role of JPAContainer in binding Vaadin components to a database Vaadin JPAContainer allows connecting Vaadin user interface components directly to the persistent model objects. You can use the container to display data in a table, tree, any other selection component, or edit the data in a form.
  • 26. Properties Atomic data is represented as Property objects that have a value and a type. Properties can be bound to Field components, such as a TextField, or a table cell. The ObjectProperty used above is just one implementation of the Property interface – in JPAContainer we use a different property type.
  • 27. Items An Item is a collection of properties that is typically bound to a Form or a row in a Table or some other selection component. Properties of an item are identified by a property identifier (PID).
  • 28. Containers A Container is a collection of items, usually bound to a Table, Tree, or some other selection component. Items in a container are identified by an item identifier (IID). Normally, all the items in a container have the same type and the same properties.
  • 29. Normal (Non-Persistent) Binding to JavaBeans Vaadin core library provides BeanItem implementation of the Item interface to bind bean objects. At the Container level, Vaadin provides the BeanItemContainer and BeanContainer implementations. They are very useful for handling transient (non-persistent) objects.
  • 30. Java Persistence API Java Persistence API (JPA) is an API for object- relational mapping (ORM) of Java objects to a relational database. In JPA and entity-relationship modeling in general, a Java class is considered an entity. Class (or entity) instances correspond with a row in a database table and member variables of a class with columns. Entities can also have relationships with other entities.
  • 32. JPAContainer AddressBook Demo Next Lab https://vaadin.com/tutorial