Blogs Blogs

OpenXava 4.2.2 released OpenXava 4.2.2 released

OpenXava 5.7 released

May 16, 2017

In OpenXava 5.7 the user can see the list mode in cards format, he can use permalinks to access individual records or execute an action directly, in collections we added subcontrollers to have drop-down menus, it's possible to active a responsive mode where the fields layout adapts to screen size,  there are a new @Calculation annotation for properties, it's allowed to create and modify elements directly from any @OneToMany collection, and many more things.

We invite you to download it and upgrade your OpenXava applications. Look at the migration instructions.

Cards format and custom list formats

A new button on top right corner allows the user to see the list  in cards format:

But it's not just a new cards format, we have a new list formats mechanism customizable by the developer. The user can choose the format using the buttons on the right of top button bar:

The available formats are all the editors assigned to tab (using <for-tabs/>) in default-editors.xml or editors.xml. However, you can change the editors available for a specific tab with the editors attribute of @Tab. For example, if you write a @Tab like this:

@Tab ( name ="WithCards", editors ="List, Charts, CustomerCardList",
    properties="number, name, type,,"

This tab will have List and Charts formats, that are standard, and a custom format, CustomerCardList. CustomerCardList is a custom editor defined in editors.xml.
Note that you can use this new feature to remove charts from your modules:

@Tab ( name ="OnlyList", editors ="List",
    properties="number, name, type,,"

Thus you can get a module without charts, just the plain original OpenXava list. Given that there are only one editor, no button for selecting format is shown.
The difference between editor and editors, is that with editor we indicate the editor for the default format, while with editors we specify all the available formats.
To remove Charts for all the lists of your application in one shot you can use tabs-default-values.xml:

<?xml version = "1.0" encoding = "ISO-8859-1"?>
<!DOCTYPE tabs-default-values SYSTEM "dtds/tabs-default-values.dtd">
    <tab editors="List">

This technique is not just for removing Charts, it's for restricting the list formats available for all modules. If not all the editors <for-tabs/> are used.


When the user chooses a record the URL in the browser is modified with the record id:

In this way the user can copy and paste the URL, and send it by email, for example, to send a reference to a specific record.
Also you can add the action to execute in the URL like this: to execute the new action, or to go list mode.

Drop-down menu in collections

With @ListSubcontroller we can grouping several actions and show them in a drop-down button. If you put a collection as:

@OneToMany(mappedBy="team", cascade=CascadeType.ALL)
private Collection<TeamMember> members;

You obtain this:

In @ListSubcontroller you define the controller name, also you have forViews and notForViews attributes. If you want that the subcontroller has an image you can define it in the controller:

<controller name="Stuff" icon="exclamation">
     <action name="viewNames" 
     <action name="viewRoles" 
        <set value="true" property="roles"/>


Responsive user interface

If your users access to your application with devices of different sizes, such as 7" tablets, 10" iPads, 15" laptops, 22" desktops, etc. you have a hard time designing a view that fit all sizes. To alleviate this problem OpenXava introduces a new renderer mode called flow layout. To active it add the next entry in your


Then the elements in @View will be shown, but the layout of plain fields will be decided by OpenXava in real time depending on page size. Active it in your project and try to resize the browser to see the effect.


With @Calculation you can define an arithmetic expression to do the calculation for the property. The expression can contain +, -, *, /, (), numeric values and properties names of the same entity. For example:

@Calculation("((hours * worker.hourPrice) + tripCost - discount) * vatPercentage / 100")
private BigDecimal total;

Note as worker.hourPrice is used to get the value from the reference.
The calculation is executed and displayed when the user changes any value of the properties used in the expression in the user interface, however the value is not saved until the user clicks on save button.
@Calculation has two nice things: first, we can avoid the clumsy BigDecimal syntax, and second, the calculation has no latency, given that is executed in the browser without server call.

Creation and modification in collections

Until now the user only could add and modify elements in collections with cascade remove, in the rest of the collections the user could add elements from a list and view the existing element, but no modifying them. Now, the user can add and modify elements in any @OneToMany collection. In this way:

Given that now we have two actions to add new elements, we added a new annotation, @AddAction, to overwriting the 'Add' action, while the classic @NewAction is now used only to define the 'New' action.

Other improvements

We have done a lot of improvements in other areas:

  • The user can remove any query from the combo of recent queries in list mode.
  • Rounded corners changed by squared corners in all the UI.
  • The last list format (chart, cards or list) is remembered between sessions by user.
  • Better default values for list and collections properties when @Tab and @ListProperties are omitted.
  • Added font size and format to SIMPLE_HTML_TEXT and removing some rarely used options to keep it simple.
  • Labels for properties of references in list use the reference label if the property is name, description or title.
  • Delete selected action not available for Charts.
  • Formatter for HTML_TEXT in list mode, now uses the plain text until 200 characters.
  • New method executeAction() in BaseAction to execute actions from an action.
  • New attribute selectable-items in editor of editors.xml for list editors that allows selecting items.
  • New attribute process-selected-items in action of controllers.xml to hide the action when selecting item is not available.
  • Chunk size to get data from database for list mode now is 120 records, it was 50.
  • Japanese translation of labels and messages.
  • Mail API available for using in your project.
  • New multiline() method in Strings to create platform independent multiline string.
  • Default size for stereotypes IMAGES_GALLERY, GALERIA_IMAGENES, FILES and ARCHIVOS.
  • New method waitAJAX() in ModuleTestBase to wait until the current AJAX request is done.
  • New method assertValidValueNotExists() in ModuleTestBase.
  • Some new common use labels to be used in applications.
  • New get/assertValueInList() methods without column param in ModuleTestBase to work with values of list elements in columnless formats.
  • SessionData class to access session data from any part of your application: actions, calculators, validators, even from entities.
  • Logging of time of each AJAX request, in debug level.
  • New methods getDiscussionCommentText(), getDiscussionCommentContentText() and assertDiscussionCommentContentText() in ModuleTestBase.
  • More intuitive messages in English.
  • New method toMap() in Maps utility to create a Map from a varargs of objects.
  • Library jsoup to manage HTML included.


Bug fixes

Though this is not a maintenance version we have done some fixes:

  • Fix: Clicking New from Charts with calculated collections breaks the module.
  • Fix: SchemaTool fails with entities with @Table(schema=).
  • Fix: "Yes" is shown besides the check symbol in list for boolean values with column resizing disable.
  • Fix: Error "Action ... not available" on refresh after session lost.
  • Fix: List customization not saved in some cases.
  • Fix: ModuleTestBase.assertDiscussionCommentText() only works for row 0.

Download OpenXava 5.7


blog comments powered by Disqus