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.
I have a
radLabellinked to a property which is aDatetype, and uses theTimeAgodate format, like this:When the property value is
null, I'd like to see"N/A", which is how theTimeAgoDateFormatterhandles anull(quite nice, in my opinion). However, the logic inLabelPropertyViewskips the formatter if the property value isnull, and instead formats it as text (meaning I eventually see the text"null").This is due to the implementation of
LabelPropertyView._getText():Checking the various
DateFormatterimplementations, I think they all handlenullin their own way, so I'd suggest removing theif (val != null)check.