openxava
Blog

February 27, 2020

OpenXava 6.3 released

This colorful 6.3 version includes new themes, support for IntelliJ, asks for confirmation when leaving an editing record, root context for deploying applications and enums with icon. Additionally, we include a lot of new minor useful features and some fixes.

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

Download OpenXava 6.3

Themes and colors

We have softened the Terra theme:


And modernized the Light theme:


We have a new Dark theme:


A new Blank & White theme:


And finally the Blue theme:


However, the most important improvement is that we have refactor the CSS in order you can define a new theme with just a few lines of CSS. You can define a new theme from an existing theme, for example, if you want a light theme with the left menu in gold color, you can define an golden.css style in this way:

/* golden.css */

@import 'light.css';

:root {

    --my-gold: #cda434;
    --my-highlight: var(--my-gold);
    
    /* Modules left menu */    
    --modules-list-color: var(--my-lightgray); 
    --modules-list-background: var(--my-gold);

}


Note that we use @import 'light.css' to extend Light style. We redefine the --my-highlight variable that is the color for the main button, this variable is from light.css, and then just define the colors for the left menu. Now I change the styleCSS value in xava.properties:

styleCSS=golden.css

To get this result:

On the other hand to define your own color scheme, not just a refinement, extends directly from base.css. For example, to define a Pink style create a pink.css like this:

/* pink.css */

@import 'base.css';

:root {
    --my-pink: #E94E77;
    --my-dark-pink: #D68189;
    --my-beige: #F4EAD5;
    --my-brown: #C6A49A;
    --transparent-pink: rgb(198, 164, 154, 0.2); 
    
     
    /* Modules left menu */
    --modules-list-color: var(--my-beige);
    --modules-list-background: var(--my-pink);
    --modules-list-selected-color: white;
     
    /* Module header */ 
    --module-header-color: white;
    --module-header-background: var(--my-pink);        
    
    /* Button bar */     
    --button-bar-button-color: var(--my-beige);
    --button-bar-background: var(--my-dark-pink);
    --list-formats-color: var(--my-beige);
    --list-formats-hover-color: white;
    
    /* Backgrounds & labels */
    --background: var(--my-beige);
    --color: var(--my-brown);
    
    /* Frames */    
    --frame-background: var(--transparent-pink);
    
    /* Actions */
    --action-color: var(--my-dark-pink);    
    --action-hover-color: var(--my-pink);
    --action-hover-background: white;
    --default-action-button-background: var(--my-pink);
    
    /* Editors */
    --required-editor-border: var(--my-dark-pink);
    
}


Note as we extend from base.css and define the colors for the main parts of the interface. Just with the above code you'll get:

You define just a few colors and all the other colors are derived from those, therefore you have a consistent color scheme with little effort. Moreover, you have the option of the define individually the color for each single part of the interface, look at the base.css file to see all the color variables available, more than 200.

In v6.3 the user has the option of choosing the style to use for himself with a theme chooser on bottom of the page:

In order to determine the available themes you have to enumerate them in the themes property of xava.properties:

themes=terra.css, light.css, dark.css, black-and-white.css, blue.css

If you want to remove the theme chooser completely just define themes as empty, or just don't define it.

IntelliJ IDEA

From time to time some of you say us: "OpenXava is pretty cool but I hate Eclipse, could I use my loved IntelliJ?". We have heard your clamor and this version has IntelliJ IDEA support:

We have modified some code in order to compile with IntelliJ and some Ant scripts in order to run with no errors, so now OpenXava runs fine in IntelliJ. Moreover, we have written a detailed documentation to use IntelliJ with OpenXava.
Although we now have a first class support for IntelliJ, Eclipse is still the preferred IDE for OpenXava.

Asks for confirmation when leaving a record

If the user go to a record, makes a change and then leaves the record, clicking on new, navigating, returning to list, etc. without clicking on save first, OpenXava will ask him for confirmation:

This works for standard OpenXava actions without touching any code. If you want it works for your own actions you can mark them with a new attribute, loses-changed-data, in controllers.xml:

<action name="doSomething"
    class="com.yourcompany.yourapp.actions.DoSomethingAction"
    loses-changed-data="true"/>


In this case you're saying that when the user executes the doSomething action without saving before the changed data would be lost.

Root context

Executing your OpenXava application in root context is now possible. That is, you can use http://localhost:8080/ from your browser to run your application, without the application name in the URL. For that, just name your war ROOT.war to deploy on Tomcat.
Optionally, if you want to use the root context in development, then starts your application from your IDE with this code in your launcher class:

AppServer.run(""); // Instead of AppServer.run("MyApp");

Moreover, if you want to test against the application running in root context, add the next entry to xava-junit.properties:

contextPath=/
 

Enums with icon

You can associate an icon to each enum option using org.openxava.model.IIconEnum:

public enum Priority implements IIconEnum { 

    LOW("transfer-down"), MEDIUM("square-medium"), HIGH("transfer-up");

    private String icon;

    private Priority(String icon) {
        this.icon = icon;
    }

    public String getIcon() {
        return icon;
    } 
        
};
private Priority priority;


Just make your enum to implement IIconEnum that forces you to have a getIcon() method. This method has to return an icon id from Material Design Icons. OpenXava can use these icons in several parts of the UI, for example in list:

Other improvements

We have done a lot of improvements in other areas:

  • Blank option can be removed from dynamic combos with View.removeBlankValidValue().
  • New methods in View for dynamic combos: clearValidValues(), disableValidValues() and hasBlankValidValue(). 
  • Material Design Icons upgraded to 4.9.95. Now with 4996 icons available.
  • Lessons from 1 to 3 of course upgraded to latest features.
  • Workspace in distribution upgraded to Eclipse 2019-12, though it still works with Neon (4.6).
  • Maven documentation updated.
  • Some new common use labels to be used in applications.

Bug fix

Though this is not a maintenance version we have done a fix:

  • Fix: List formatters do not apply to enums in @OrderColumn lists, calculated and many to many collections.
Download OpenXava 6.3

blog comments powered by Disqus

Espaņol