Friday, February 15, 2013

Custom model handlers

Hello everybody.

A new concept is being introduced in Kitto. Model handlers are basically an abstraction layer between views and the database. The idea is that you can define and declare a custom model handler (a Delphi class), on a model-by-model basis, to override database operations (read and write) on that model performed through views.
The basic, or built-in model handler will be used by default and will just perform database operations the same way as ever.
Model handlers enable you to create virtual models, that is models that are not database-bound, and to leverage the power of tools such as the Form controller to do more than edit database records.

Custom parameterized actions

One example of custom model handler is when implementing custom parameterized actions/tools. An action of this type is often a button that opens a form in which you enter some parameters and then click a button to do a custom operation. Using a custom model handler to implement your cuatom action yields the following advantages:
  • Using a virtual model to define the parameters allows you to have advanced validation.
  • Using the Form controller as an input form for the parameters gives you layouts and all other form features.
  • The custom action you implement in Delphi can be bound to the data displayed in a List view, for example. So, you can have context-sensitive parameterized actions.
A first implementation of model handlers will be created in the next few weeks.

No comments:

Post a Comment