Welcome!

Java Authors: Carmen Gonzalez, Elizabeth White, Dana Gardner, Ivan Antsipau, Esmeralda Swartz

Related Topics: Java, Open Source, Eclipse, AJAX & REA

Java: News Item

OpenXava 4.6: Rapid Java Web Development

OpenXava allows you to develop applications just by writing simple domain classes with Java or Groovy

You have to define a @Tab in your entity as following:

@Tab ( name ="Cards", editor="CustomerCardList",
   properties="number, name, type, address.city, address.state.name"
)

And also define the editor in the editors.xml file of your project:

<editor name="CustomerCardList" url="customerCardListEditor.jsp"/>

Of course, you have to write customerCardListEditor.jsp to render the customers in your own way. Learn more details about how to choose an editor for a @Tab in the reference guide.

Moreover, it's possible to define an editor for all the lists of a model or even for all the lists of your application. Look at the customizing chapter of the reference guide.

With the addition of lists now we have editors for properties, references, collections and lists, thus the customization of the UI generated by OpenXava is total. You get exactly the UI you want.

Assigning model objects directly to View

Until now to put and get the data from a view based on a transient class you needed to use getView().get/setValue() with simple values or getView().get/setValues() with maps, you couldn't use the model object directly. Since OpenXava 4.6 you can use model objects to populate the view. So, a code like this is possible:

DateRange range = ... // DateRange can be an entity or a transient class

...

getView().setModel(range); // Populate the view with range data

This code populate the view with data from the DateRange object, even if the view currently is not displaying a DateRange the view is changed to display it.

Asserting PDF content in jUnit tests
Now you can verify that the content of the generated PDFs in your jUnit tests is the correct one. To do this ModuleTestBase has the following new methods: getPopupPDFAsText(), printPopupPDFAsText(), getPopupPDFLine(), assertPopupPDFLine(), assertPopupPDFLinesCount() and getPopupPDFLinesCount(). From now on you can write test code as following:

execute("CustomReport.generatePdf");

assertPopupPDFLinesCount(5);

assertPopupPDFLine(1, "jUnit Carrier report");

assertPopupPDFLine(2, "Name Number Zone");

assertPopupPDFLine(3, "CUATRO 4 1");

A good news for all of us that love automated testing.

@RowAction for collections

@RowAction allows to define an action to be show in each row, but not in the collection button bar. If you write a code like this:

@OneToMany(mappedBy="parent", cascade=CascadeType.ALL)

@RowAction("OrderDetail.reduceQuantity")

Collection<OrderDetail> details = new ArrayList<OrderDetail>()

You'll get the next user interface for the collection:

Note as Reduce quantity action is in the row but not in the button bar. Read more about @RowAction at wiki.

And more

See changelog for the complete list of new features and fixes.

Download OpenXava 4.6 and try it

More Stories By Javier Paniza

Javier Paniza is the project lead for OpenXava project. He works as software developer at Gestión 400, a software company for public administration in Spain. He has been developing with Java Enterprise since 1998. Also he has been J2EE mentor for development teams in banking projects.