-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
I have a radLabel
linked to a property which is a Date
type, and uses the TimeAgo
date format, like this:
<radLabel tag="Symbol.lastRefresh" dateFormat="TimeAgo" component.uiid="RefreshLabel" />
When the property value is null
, I'd like to see "N/A"
, which is how the TimeAgoDateFormatter
handles a null
(quite nice, in my opinion). However, the logic in LabelPropertyView
skips the formatter if the property value is null
, and instead formats it as text (meaning I eventually see the text "null"
).
This is due to the implementation of LabelPropertyView._getText()
:
private String _getText() {
Property prop = getPropertySelector().getLeafProperty();
if (prop == null) {
return "";
}
if (prop.getContentType().getRepresentationClass() == Date.class) {
DateFormatterAttribute formatter = getField().getDateFormatter();
if (formatter != null) {
Date val = getPropertySelector().getDate(null);
if (val != null) {
return formatter.getValue().format(val);
}
}
}
return getPropertySelector().getText("");
}
Checking the various DateFormatter
implementations, I think they all handle null
in their own way, so I'd suggest removing the if (val != null)
check.
Metadata
Metadata
Assignees
Labels
No labels