openxava
博客

2021年10月28号

OpenXava 6.6 released

In OpenXava 6.6 all visited modules are remembered with tabs on top of the page, we have improved the UI behavior on scrolling and resizing, you can associate a custom editor to any annotation so now you can use annotations as alternative to stereotypes, we have improved the editor for uploading files, and you can use maps in your application by means of the new @Coordinates annotation, etc. Read below, to know more about these and many other things included in this latest version.

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

Download OpenXava 6.6 for Windows
Download OpenXava 6.6 for Linux
Download OpenXava 6.6 for Mac

Tabs for already visited modules

When the user goes to a new module a new tab is opened on top of the page for it, remaining the tabs for the already opened modules, so the user can come back to a previous module just with a click. Like shown in the next screenshot:



This was a feature of OpenXava 5 that we dropped in version 6, since then you have asked many times to put it back. You said that is a very practical way of working, while practically there are no business applications that work in that way. So it conferes a competitive advantage to your OpenXava applications.
By default, the visited modules are remembered among sessions for each user, although you can disable it adding the next entry to naviox.properties:

rememberVisitedModules=false 
Moreover, you can define some modules to be fixed on the top for all users by default. For example, if you want that the Invoice and Order modules would be always present add the next entry to naviox.properties:
fixModulesOnTopMenu=Invoice, Order

Better behavior on scroll

Top button bar with actions is fixed on top of the page when the user scrolls the detail or list view. Like this:



Note as the action buttons are always visible even after scrolling. Also, note as the left menu with modules is fixed, when you scroll the main view, the left menu doesn't move. Now the scrolling of the left modules menu and the main view are independent.

Responsive button bar

When you narrow your browser, the labels of the actions in button bar are hidden, so they fit well in a narrow window:



Also we have improved the tooltip for actions, including the action name. 

Java annotations instead of stereotypes

Don't worry, stereotypes are still supported, but you can use annotation instead, if you prefer. Annotations have three advantages over stereotypes. First, the compiler assures that you have written it well, second, the IDE auto completes the annotation while you write and third, the annotation can have attributes, so we can modify the way it behaves.
Now you can attach an editor to a Java annotation, so when a property is annotated with that annotation the corresponding editor is used. For example, you can define an annotation like this one:

package com.mycompany.myapp.annotations;

import java.lang.annotation.*;

@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.FIELD, ElementType.METHOD })
public @interface Colorful {

    String color() default "black";

}
Note as it's a regular Java annotation with no special requirements, you can even use already existing annotations from any Java library.
Then you annotate a property of your entity with your annotation, in this way:
@Column(length=40) @Required
@Colorful(color = "green") 
String name;
Now you want that the name property will be displayed using your own editor instead of the regular one for String properties. For that, define your editor in editors.xml and assign it to your annotation using for-annotation:
<editor name="Colorful" url="colorfulEditor.jsp">
  <for-annotation 
    annotation="com.mycompany.myapp.annotations.Colorful"/>
</editor>
Here you're linking the Colorful annotation to the colorfulEditor.jsp editor. Apart from editors.xml you can also use for-annotation in default-size.xml and validators.xml, making annotations a complete replacement of stereotypes.
Therefore, we have created new annotations for most of the classic OpenXava stereotypes, we have added these annotations: @Password, @Money, @TextArea, @Label, @DateTime, @Discussion, @Icon, @Telephone, @IP, @EmailList, @MAC, @StringTime, @HtmlText, @File and @Files.
The two last ones deserve their own section.

@File and @Files

Now you can use @File instead of @Stereotype("FILE") and @Files instead of @Stereotype("FILES"). They are 100% compatible even at database level, you can change it in your code with no problem. Moreover, we have improved the editor for @File and @Files to display a preview if the uploaded file is an image, in this way:



It allows you to use @File as a replacement for @Stereotype("PHOTO") and @Files for @Stereotype("IMAGES_GALLERY"), though in this case they are not compatible at database level, so use it for new code only. @File is more performant than PHOTO and @File/@Files allows you to save on database, filesystem or define your own storage system.
When you use @File or @Files you can define attributes like acceptFileTypes or maxFileSizeInKb to restrict the files the user can upload. For example, with this code:

@File(acceptFileTypes="image/*", maxFileSizeInKb=90)
@Column(length=32)
private String photo;
The user can only upload images of 90 Kb or less.

Moreover, we have done these other improvements related to upload files editor:

  • @File/FILE displays a small preview image in list mode if the file is of image type.
  • FILES stereotype is shown inside a frame by default.
  • Property maxFileSizeInKb in editors.xml definition to restrict the size of files to upload.
  • Property acceptFileTypes in editors.xml definition to restrict the type of files to upload.        
  • New @FileItemUpload annotation to configure properties of FileItem type.
  • PHOTO/IMAGE and IMAGES_GALLERY stereotypes only allow uploading images.
  • Import data in list mode only allows uploading CSV, XLS and XLSX files.

@Coordinates

A coordinates property allows your user to choose a point in a map and store it. To define it annotate your property with @Coordinates or @Stereotype("COORDINATES"):
@Coordinates @Column(length=50)
private String location;
Note the type, String, and the length, 50, enough to store coordinates. From the above code you get:



The user can mark in any part of the map then the coordinates change. Also if he types or pastes the coordinates in the field the map and the mark are repositioned.
You can use @Coordinates without any special setup, however you have the option of changing the tile provider in xava.properties. OpenXava can use OpenTopoMap, MaxBox, Stamen, OpenStreeMap or Thunderforest as tile providers. The above image is from OpenTopoMax. The same map using MaxBox would be:

Other improvements

We have done a lot of improvements in other areas:

  • PDF reports show the filter name in the header for saved filters.
  • When a row in any collection is checked the delete action of the module is hidden. 
  • InvoiceDemo includes examples of @Coordinates, @Files and @File.        
  • Dropped support for Internet Explorer.
  • Startup time for application in development (embedded Tomcat) improved (x2).
  • Lesson 2 and 4 of course divided into several smaller lessons.        
  • Automated testing content of the course moved to appendix D.
  • Last lesson of course, about references and collections, upgraded to the latest OpenXava version.
  • Lessons 2, 3 and 4 of course include video.
  • New isImage() method in org.openxava.util.Files utility class.    
  • New moveRow() methods in ModuleTestBase to test moving rows in @OrderColumn collections.             
  • Top bar button and left menu adapted to look better in iPad.    
  • Some new common use labels to be used in applications.
  • Labels and messages for Serbian upgraded.

Bug fixes

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

  • Fix: IP stereotype not linked to its corresponding validator, so no validation was done for IPs.
  • Fix: @OrderColumn collection order altered when a collection element is modified from its module.
  • Fix: Broken links in Customizing chapter of Reference Guide.
  • Fix: Minor errors in Spanish course version.
Download OpenXava 6.6 for Windows
Download OpenXava 6.6 for Linux
Download OpenXava 6.6 for Mac

blog comments powered by Disqus

English - Español