One of the main USP’s of Openbravo ERP 3.0 is its RIA (Rich Internet Architecture) based on the smartclient framework. Openbravo was one of the pioneers in the Opensource ERP industry to move to a fluid client based architecture. In my earlier post , I attempted to dissect the User Interface elements in Openbravo. In this post, I tend to explain briefly the way the client side scripting is segregated which would be quite useful while debugging and also while extending the module and creating new scripts.
The main client side scripts are present in the module org.openbravo.client.application. Here is the folder structure of the user interface module.
I am not going to explain in detail all the templates, but layout.js.ftl is the main template that acts as the base of the user interface and contains the top menu section and the tabbed workspace. The other templates are quite self-explanatory from their names and if there are any doubts in this, please drop in a comment.
Next coming to the Application scripts, here are the key scripts.
1. Main View
The main view contains the scripts necessary for the rendering and manipulation of data in the tabs, The ob-tab.js is the base script file for the tab and ob-standard-window.js is the main container inside the tab. The ob-standard-view contains the form view and grid view of each tab. ob-messagebar.js is also contained in ob-standard-view so that it is displayed properly in both form view as well as grid view.
- ob-messagebar.js (the form and grid components are detailed below)
All the scripts related to grid layout is present in the grid folder. Here ob-grid.js is the main grid definition extended from smartclient grid. The ob-view-grid.js is the file that is used to render the grid layout for all the normal windows. ob-tree-grid.js is an extension of smartclient tree grid and used in tree grid reference in Openbravo. The ob-tree-view-grid.js is the grid layout that is rendered in windows where tree grid is being used. For eg., Organization window.
3. Form View
The form view contains all the scripts related to the form view. The interesting thing here is, note that there are separate scripting files for the status bar, attachment section, linked item, notes. Any improvements made to these will not adversely affect the form view and similarly it is easier to add new components to the form view similar to these. The ob-view-form.js is the base script for rendering the form view. Another interesting thing to note here is the formitem folder. The formitem folder is nothing but scripts for each of the reference types being used by Openbravo. This again improves code readability, maintainability and is easily extendable.
Another more used feature is the toolbar. Here ob-action-button.js contains the generic actions to be performed for all toolbar and button fields and of course with some exceptions. But ob-toolbar.js is the file where all the toolbar elements like New, Delete, Save, Export are defined. ob-clone-order.js is a custom button developed specifically for order window. So this is defined separately again to make sure that core functionality is not affected by newer developments.
You can check the other folders and see how cool and simple it is to understand the application scripting architecture in Openbravo. Feel free to comment on any mistake that I may have made (in this blog post) and also for any doubts or clarifications.
Happy Working !!!