katratxo on Software Development

tail -f /var/log/brain | grep -i software

Archive for September 2011

Development tips – Part III

with one comment

FreeMarker syntax highlighting

As you may know, we are using Freemarker as templating engine to produce code. By default, you don’t have syntax highlighting in Eclipse, but you can fix this limitation installing JBoss Tools.

Since we are using Eclipse Indigo, you need use the Development Release


FreeMarker IDE plugin

After installing the plugin and restarting Eclipse, you’ll have some colored syntax when opening a .ftl file


Identifying field names

A very common question is how to identify the name of the INPUT that is used when sending requests to the server. In 2.50 was quite easy, you just had to check the generated HTML code and search for an input tag and check the name attribute. This name is that one you use as request parameter in your servlet (e.g. a Callout).

In Openbravo 3, the code is generated in the client side by SmartClient, and most of the time you don’t have control over it. However you can use Elements tab in Chrome Dev Tools to check the resulting code.

Business Partner field name

You’ll find that wrapping the actual INPUT there are several DIVs and TDs. This wrapping code contains references to JavaScript variables you can use to access some properties, e.g. In the image above, the Business Partner selector has refereces to isc_OBSelectorItem_1.

If you use the console, you can access the JavaScript object and some of the properties:


For backward compatibility, each field has a inpColumnName that can be used as request parameter in your servlet.

Choosing the proper Java package name

This section of the article goes mainly to Openbravo core developers. It’s important to know that that org.openbravo.* is reserved for Openbravo developments.

I started a sample module and picked the Java package, org.openbravo.test.security, after that I registered a ComponentProvider and some Component generating some JavaScript response. When I tried the code it didn’t work. After more than one hour trying to figure out what’s going on, I read the following:

Weld will analyze the classpath to find components which have specific annotations. To prevent searching all classes specific exclusion filters have been specified. They can be found in the META-INF/beans.xml file in the Weld module.

Bingo! To avoid trying to analyze the JUnit test cases in the org.openbravo.test package, we exclude any package that contains org.openbravo.**.test.** pattern.

Removing the test part of my test module Java package solved the problem.


Written by katratxo

September 6, 2011 at 9:50 am

Posted in Openbravo

Tagged with , , ,