View source | Discuss this page | Page history | Printable version   
Toolbox
Main Page
Upload file
What links here
Recent changes
Help

PDF Books
Show collection (0 pages)
Collections help

Search

ERP 2.50:Developers Guide/Concepts/AD/Base References in Modules

Bulbgraph.png   All the contents defined within this article are available from 2.50MP12.

Contents

Introduction

This document aims to explain from a general point of view how to implement base references within modules. The concept of reference is explained in the Data Model article. Additionally there is a example where the technical aspects are explained in detail and illustrated with code.

Creating base references allows to define data types for columns and/or visualization widgets for fields in generated windows different to the ones defined in the base ones in core.

Once a base reference is created it is possible to add subreferences to this one if needed. The purpose of this is to be able to have a generic implementation for the base reference that behaves differently according with the subreference. For example let's suppose we want to have a new way to visualize fields of foreign key columns, which in core are displayed by default as a drop down list. We could create a new base reference, let's call it FK reference where we would implement all the logic for the new widget. Additionally we would create a new subreference with this FK reference as parent for each of the tables we want to use it with.

AD Definition

References are defined from Application Dictionary || Reference window.

A reference is set to be a base one by checking the Base Reference field. As there are 2 levels of references (base and subreferences), when a reference is not base, it is mandatory to set which is its parent one.

References define 3 implementators, they are java classes which implement the reference logic. These implementators can be defined at base reference level or at subreference. When the subreference has not implementation class, the ones in its parent's reference will be used, other case the ones in the subreference.

The implementations for references are:

Reference Implementators

As explained in the previous section each reference can have 3 implementators which are java classes. In the following points it is described the purpose of each of them and the main methods they should implement.

Model Implementation

It must implement org.openbravo.base.model.domaintype.DomainType interface.

WAD Implementation

It extends org.openbravo.wad.controls.WADControl class. This class must be in the src-wad directory of the module. When WAD is compiled (ant wad) this class will be part of the openbravo-wad.jar library and will be used to create the code for generated windows. As WAD does not depend on DAL, it is not possible to use DAL to access to database.

Bulbgraph.png   To include this class in the eclipse OpenbravoWAD project, it is necessary to add the module's src-wad directory as a linked resource in the Java Build Path. The steps to do so are:
  • Right click on the OpenbravoWAD project folder.
  • Select Properties.
  • Go to Java Build Path > Source
  • Click on Link Source
  • Set in the Linked folder location your module's src-wad directory.
  • In the Folder name type the way you want to see that folder in your project.

Model Implementation

This class extends org.openbravo.reference.ui.UIReference.

Retrieved from "http://wiki.openbravo.com/wiki/ERP_2.50:Developers_Guide/Concepts/AD/Base_References_in_Modules"

This page has been accessed 1,954 times. This page was last modified on 14 June 2011, at 11:03. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.