Chapter 9. The Editor framework

 

This chapter covers

  • Introducing the Editor framework
  • Moving data from objects using editors and drivers
  • Using adapters that provide reusable editor logic

In the previous chapter you learned how to store and transfer data from beans residing on the server side to a client. In this chapter we’ll take a closer look at how you can plug this data into form fields on the client side through the use of the Editor framework, which saves you writing a bunch of code for copying data from widgets to bean objects.

The Editor framework is perhaps best explained with an example. Suppose you have a form with 10 TextBox fields, and when the user clicks Submit, you want to copy this data to a Java object that you can then send to the server for processing. If you think about this, the code is somewhat cumbersome. You need to write the code that copies the value of each TextBox into the JavaBean, which means a minimum of 10 lines of code. Now, what about when you want to allow the user to fetch that same JavaBean from the server and edit those values? You just added 10 additional lines of code.

The Editor framework is meant to perform this work for you by automatically mapping bean fields to, usually, UI elements. It does this by using a driver, known as SimpleBeanEditorDriver, to take defined values from your UI, known as the editor, and synchronize them with a local (on the client) JavaBean.

9.1. Framework and editor overview

9.2. Examining the chapter’s examples

9.3. Editor types

9.4. Constructing your first editor

9.5. Binding an editor with drivers

9.6. Editor subinterfaces

9.7. Accessing the RequestContext

9.8. Alternate way to construct an editor

9.9. Adapters

9.10. Summary