I have an entity Issue with a reference to an entity Priority. I want in the list mode of my OpenXava module, a different color and visual style for each row depending on the value of priority.
This is the code for my Issue entity:
package com.yourcompany.tracker.model;
import java.time.*;
import javax.persistence.*;
import org.openxava.annotations.*;
import org.openxava.calculators.*;
import org.openxava.model.*;
import lombok.*;
@Entity @Getter @Setter
public class Issue extends Identifiable {
@Column(length=100) @Required
String title;
@Stereotype("SIMPLE_HTML_TEXT")
String description;
@ReadOnly
@DefaultValueCalculator(CurrentLocalDateCalculator.class)
LocalDate createdOn;
@ManyToOne(fetch=FetchType.LAZY, optional=true)
@DescriptionsList
Priority priority;
}
And this for Priority:
package com.yourcompany.tracker.model;
import javax.persistence.*;
import javax.validation.constraints.*;
import org.openxava.annotations.*;
import lombok.*;
@Entity @Getter @Setter
public class Priority {
@Id @Max(9)
int level;
@Column(length=40) @Required
String description;
}
And this the effect I would like to achieve:
Note as rows with LOW priority are gray, and rows with HIGH priority are bold.
I know that there is a @RowStyle annotation, but it seems that it is for simple properties. How can I define a different style for each row depending on a reference (@ManyToOne) value?