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 @OneToManycollection, and many more things.

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:

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:

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:

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.

Permalink

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: http://www.mysite.com/MyApp/m/Customer?action=CRUD.new to execute the new action, or http://www.mysite.com/MyApp/m/Customer?action=Mode.list 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:

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:

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 xava.properties:

flowLayout=true

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.

@Calculation

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:

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.