Home » Liferay Portal » English » 9. Announcements

Combination View Flat View Tree View
Threads [ Previous | Next ]
Javier Paniza
OpenXava 4.0: Rapid AJAX Development for Liferay
November 24, 2010 11:19 AM

Javier Paniza

Rank: Junior Member

Posts: 37

Join Date: August 25, 2009

Recent Posts

OpenXava is a framework for rapid development of business applications for LIferay. It is easy to learn and one can have an application up in no time. At the same time, OpenXava is extensible, customizable and the application code is structured in a very pure object oriented way, allowing you to develop arbitrarily complex applications.

The OpenXava approach for rapid development differs from those that use visual environments (like Visual Basic or Delphi) or scripting (like PHP). Instead, OpenXava uses a model-driven development approach, where the core of your application are Java classes that model your problem. This means you can stay productive while still maintaining a high level of encapsulation.

OpenXava application are deployabled in Liferay 6.0, 5.x and 4.x. Moreover the OpenXava portlets has the Liferay native look & feel.

The all-new version of OpenXava, OpenXava 4.0, improves significantly the user experience, producing a Rich Internet Application user interface. Additionally, some interesting improvements has been done for the developers, such as Groovy, JPA 2.0 or Dependency Injection.

The best way to taste the new features of OpenXava 4.0 is downloading it and following the Quick Start guide.
Below you have some of the main new features present in OpenXava 4.0.

Better User Experience
The next screenshot of a simple OpenXava 4.0 module shows some of the new features:

Another new useful feature of OpenXava is the use of dialogs. OpenXava use them for creating and editing reference and collection elements, though the developer can show his own dialogs in his own actions. Moreover, the user has the possibility of hidding and showing any frame in the view. So he can hide any reference, group or collection to adapt the user interface to his necessities and preferences. The next screenshot shows these features:

These are only some of the user interface new features. OpenXava 4.0 has around 40 improvements of the user interface.
More Options for Developers
OpenXava 4.0 allows to use Groovy for coding all the parts of your application, now it uses JPA 2.0, you can use Dependency Injection in you actions and the way for doing typical tasks has been simplified.
For example, you can use Groovy to define you entity, as following:
 4    year, number, date;
 5    customer;
 6    details;
 7    amount;
 8    remarks
 9    """
11class Order extends Identifiable {
13    @Column(length=4)
14    @DefaultValueCalculator(CurrentYearCalculator.class)
15    int year
17    @Column(length=6)   
18    int number
20    @Required
21    @DefaultValueCalculator(CurrentDateCalculator.class)
22    Date date   
24    @ManyToOne(fetch=FetchType.LAZY, optional=false)
25    @ReferenceView("Simplest")
26    Customer customer   
28    @OneToMany(mappedBy="parent", cascade=CascadeType.ALL)   
29    @ListProperties("product.number, product.description, quantity, product.unitPrice, amount")
30    Collection<OrderDetail> details = new ArrayList<OrderDetail>() 
32    @Stereotype("MEMO")
33    String remarks
35    @Stereotype("MONEY")
36    BigDecimal getAmount() {
37        BigDecimal result = 0
38        details.each { OrderDetail detail ->
39            result += detail.amount
40        }
41        return result
42    }
44    @PrePersist
45    void calculateNumber() throws Exception {         
46        Query query = XPersistence.getManager()
47            .createQuery("select max(o.number) from Order o " +
48                    "where o.year = :year")
49        query.setParameter("year", year)       
50        Integer lastNumber = (Integer) query.getSingleResult()
51        this.number = lastNumber == null?1:lastNumber + 1
52    }

You can use the Java standard for Dependency Injection, JSR-330:
 1public class ChangeActiveYearAction extends ViewBaseAction {
 3    @Inject  // Standard annotation from JSR-330
 4    private int activeYear; // Getter and setter are not needed
 6    public void execute() throws Exception {
 7        assert activeYear == 2010; // The value from session object
 8        activeYear = 2012; // It changes the value of session object
 9    }

Thus the activeYear session object is injected in the activeYear field before call to execute(); and after execute() execution the value of the activeYear field is assigned back to the actionYear session object. So, you can change session objects state from inside an action, even with immutable and primitive types.

There are some improvements to the actions that do not add new functionality, but allows you to simplify the coding of some typical cases. For example, now it's easy to add and remove actions programatically from an action thanks to the new methods addActions(), removeActions(), clearActions(), setControllers(), returnToPreviousControllers() and setDefaultControllers() present in BaseAction. Other new methods of BaseAction such as getRequest(), getContext() and getManager() add a lot of possibilities with little effort.

These are only some of the new features for developers. OpenXava 4.0 has around 90 improvements for the developers.

Download OpenXava 4.0 and try it

Participate in the State of Liferay Community 2017. Help the community and even win some prizes!