Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.
EMF.Edit
A Story of Adapters
Mikaël Barbero
Obeo
Eclipse Con North America 2014
March 20, 2014
©JohnWilhelmhttp://500px.co...
Super
Java
Beans
© Rangizzz http://500px.com/photo/30648317
On Steroids
© Max Ellis http://500px.com/photo/57968110
© Rangizzz http://500px.com/photo/43660830
Today’s Workout Routine
Connecting the Viewer
Changing the Labels
Changing the Content
Connecting the
viewers
Exercise 1
Model View
Controller
Listening for Reacting to
CHANGES
notifies
adapts
Notifier Adapter
Listener pattern
Notifier is the observable and Adapter is the observer
5
Notification
Message from the Observable to the Observer
TreeViewer
Chain of notifications
Explains the importance of calling dispose()
Adapter
Factory Content
& Label
Provider
Ite...
Update or Refresh
Or how to be smart when notifying the viewer
TreeViewer
Adapter
Factory Content
& Label
Provider
Item
Provider
Adapter
Factory
Item
Provider
EObject
#notifyChanged
Upd...
Provider type
Singleton
Book
Item
Provider
Book
Book
Book
Provider type
Stateful
Book
Item
Provider
Book
Book
Book
Book
Item
Provider
Book
Item
Provider
TreeViewer
Composed Adapter Factory
Look for the proper adapter factory for each type of object
Item
Provider
Adapter
Fact...
Code is Available
https://github.com/mbarbero/econ-na-2014-emf-edit
Tags demo1 and demo2
Changing the Labels
Exercise 2
XXXItemProvider#getText(Object)
Easy
src
src-gen
Generation gap pattern
Treat generated code as byte code
Item
Book Periodical
BookOn
Tape
Video
Cassette
TreeViewer
Adapter
Factory Content
& Label
Provider
Item
Provider
Adapter
Factory
Item
Provider
EObject
Decorators
of Adap...
TreeViewer
Decorators
of AdapterFactory and ItemProvider
Item
Adapter
Factory Content
& Label
Provider
Item
Provider
Adapt...
Code is Available
https://github.com/mbarbero/econ-na-2014-emf-edit
Tag demo3
Changing the Contents
Exercise 3
XXXItemProvider#getChildren(Object)
Easy
TreeNode
Tree Model
Wrap EObjects
EObject
data
TreeViewer
Tree Model
Wrap EObjects
Item
Adapter
Factory Content
& Label
Provider
Item
Provider
Adapter
Factory
Item Item
...
Beware of too many notifications
Make your item providers stateful
EObject
EObject
EObject
Beware of too many notifications
Make your item providers stateful
Tree
Node
Tree
Node
Tree
Node
Beware of too many notifications
Make your item providers stateful
Tree
NodeItem
Provider
Tree
NodeItem
Provider
Tree
NodeI...
Beware of too many notifications
Make your item providers stateful
EObject
ItemProvider
Beware of too many notifications
Make your item providers stateful
EObject
ItemProvider
Beware of too many notifications
Make your item providers stateful
Code is Available
https://github.com/mbarbero/econ-na-2014-emf-edit
Tag demo4
Connecting the Viewer
Changing the Labels
Changing the Content
Recap
Q
&
A
Mikaël Barbero
mikael.barbero@obeo.fr
+Mikaël Barbero
@mikbarbero
Obeo
http://www.obeo.fr
EMF.Edit: a Story of Adapters
EMF.Edit: a Story of Adapters
EMF.Edit: a Story of Adapters
EMF.Edit: a Story of Adapters
EMF.Edit: a Story of Adapters
EMF.Edit: a Story of Adapters
EMF.Edit: a Story of Adapters
EMF.Edit: a Story of Adapters
EMF.Edit: a Story of Adapters
Próxima SlideShare
Cargando en…5
×

EMF.Edit: a Story of Adapters

2.060 visualizaciones

Publicado el

Slides from my talk at Eclipse Con North America 2014 (https://www.eclipsecon.org/na2014/session/emfedit-story-adapters)

So you need to build a Java application for desktop, mobile or web? You already know that EMF could be helpful in many ways because it handles the burden of writing the data classes (entities) and provides RESTful serialization of those data? Yeah, that is perfectly correct. But how does it help you with changing, or editing, your data? What is the point behind the so-called EMF.Edit framework?

During this talk, you will learn how to build the foundations for a rich client application in any widget toolkit (SWT, JavaFX...). Among other things you will learn how to customize the generated EMF editor without messing up with the generated classes. You will learn how the content and label providers are working under the hood to help create your own beautiful, robust and maintainable applications. By the end of this talk you will finally untangle the gordian knot between Adapters, ItemProvider, AdapterFactory, ItemProviderAdapterFactory, AdapterFactoryLabelProvider, AdapterFactoryContentProvider, etc.

This talk is dedicated to EMF rookies who know EMF as a generator of JavaBeans on Steroids and want to know more about the steroids themselves (the Adapter framework, the ItemProvider framework and the amazing helper classes around those two). This talk will be full of sample code and demo. All of this material is available on Github https://github.com/mbarbero/econ-na-2014-emf-edit.

Publicado en: Tecnología
  • Sé el primero en comentar

  • Sé el primero en recomendar esto

EMF.Edit: a Story of Adapters

  1. 1. EMF.Edit A Story of Adapters Mikaël Barbero Obeo Eclipse Con North America 2014 March 20, 2014 ©JohnWilhelmhttp://500px.com/photo/59208448
  2. 2. Super Java Beans © Rangizzz http://500px.com/photo/30648317
  3. 3. On Steroids © Max Ellis http://500px.com/photo/57968110
  4. 4. © Rangizzz http://500px.com/photo/43660830
  5. 5. Today’s Workout Routine Connecting the Viewer Changing the Labels Changing the Content
  6. 6. Connecting the viewers Exercise 1
  7. 7. Model View Controller
  8. 8. Listening for Reacting to CHANGES
  9. 9. notifies adapts Notifier Adapter Listener pattern Notifier is the observable and Adapter is the observer
  10. 10. 5 Notification Message from the Observable to the Observer
  11. 11. TreeViewer Chain of notifications Explains the importance of calling dispose() Adapter Factory Content & Label Provider Item Provider Adapter Factory Item Provider EObject
  12. 12. Update or Refresh Or how to be smart when notifying the viewer
  13. 13. TreeViewer Adapter Factory Content & Label Provider Item Provider Adapter Factory Item Provider EObject #notifyChanged Update or Refresh Or how to be smart when notifying the viewer
  14. 14. Provider type Singleton Book Item Provider Book Book Book
  15. 15. Provider type Stateful Book Item Provider Book Book Book Book Item Provider Book Item Provider
  16. 16. TreeViewer Composed Adapter Factory Look for the proper adapter factory for each type of object Item Provider Adapter Factory Item Provider Adapter Factory Item Provider Adapter Factory Adapter Factory Content & Label Provider Item Provider Adapter Factory Item Provider EObject
  17. 17. Code is Available https://github.com/mbarbero/econ-na-2014-emf-edit Tags demo1 and demo2
  18. 18. Changing the Labels Exercise 2
  19. 19. XXXItemProvider#getText(Object) Easy
  20. 20. src src-gen Generation gap pattern Treat generated code as byte code
  21. 21. Item Book Periodical BookOn Tape Video Cassette
  22. 22. TreeViewer Adapter Factory Content & Label Provider Item Provider Adapter Factory Item Provider EObject Decorators of AdapterFactory and ItemProvider
  23. 23. TreeViewer Decorators of AdapterFactory and ItemProvider Item Adapter Factory Content & Label Provider Item Provider Adapter Factory Item Item Provider EObject
  24. 24. Code is Available https://github.com/mbarbero/econ-na-2014-emf-edit Tag demo3
  25. 25. Changing the Contents Exercise 3
  26. 26. XXXItemProvider#getChildren(Object) Easy
  27. 27. TreeNode Tree Model Wrap EObjects EObject data
  28. 28. TreeViewer Tree Model Wrap EObjects Item Adapter Factory Content & Label Provider Item Provider Adapter Factory Item Item Item Provider EObject
  29. 29. Beware of too many notifications Make your item providers stateful EObject EObject EObject
  30. 30. Beware of too many notifications Make your item providers stateful Tree Node Tree Node Tree Node
  31. 31. Beware of too many notifications Make your item providers stateful Tree NodeItem Provider Tree NodeItem Provider Tree NodeItem Provider
  32. 32. Beware of too many notifications Make your item providers stateful EObject ItemProvider
  33. 33. Beware of too many notifications Make your item providers stateful EObject ItemProvider
  34. 34. Beware of too many notifications Make your item providers stateful
  35. 35. Code is Available https://github.com/mbarbero/econ-na-2014-emf-edit Tag demo4
  36. 36. Connecting the Viewer Changing the Labels Changing the Content Recap
  37. 37. Q & A
  38. 38. Mikaël Barbero mikael.barbero@obeo.fr +Mikaël Barbero @mikbarbero Obeo http://www.obeo.fr

×