DashboardFilter dashboardFilter = (DashboardFilter) dataFilter;
DashboardFilterProperty filterProp = dashboardFilter.getFilterPropertyById(propId);
if (filterProp == null) return "[" + name + ", property '" + propId + "' not found]";
String commandName = getName();
DataPropertyFormatter dpf = DataFormatterRegistry.lookup().getPropertyFormatter(propId);
Locale locale = LocaleManager.currentLocale();
if (FILTER_MIN_VALUE.equals(commandName)) {
Comparable min = filterProp.getPropertyMinValue();
return dpf.formatValue(propId, min, locale);
}
if (FILTER_MAX_VALUE.equals(commandName)) {
Comparable max = filterProp.getPropertyMaxValue();
return dpf.formatValue(propId, max, locale);
}
if (FILTER_SELECTED.equals(commandName)) {
List values = filterProp.getPropertySelectedValues();
if (values.isEmpty()) return null;
Collections.sort(values);
String separator = getArgument(1);
if (separator == null) separator = ", ";
StringBuffer result = new StringBuffer();
Iterator it = values.iterator();
while (it.hasNext()) {
Object value = it.next();
if (result.length() > 0) result.append(separator);
result.append(dpf.formatValue(propId, value, locale));
}
return result.toString();
}
if (FILTER_ALL.equals(commandName)) {
List values = filterProp.getPropertyDistinctValues();
if (values.isEmpty()) return null;
Collections.sort(values);
String separator = getArgument(1);
if (separator == null) separator = ", ";
StringBuffer result = new StringBuffer();
Iterator it = values.iterator();
while (it.hasNext()) {
Object value = it.next();
if (result.length() > 0) result.append(separator);
result.append(dpf.formatValue(propId, value, locale));
}
return result.toString();
}
return "[" + commandName + ", command not supported]";
}