Search in sources :

Example 1 with DateIntervalValue

use of com.haulmont.cuba.gui.components.filter.dateinterval.DateIntervalValue in project cuba by cuba-platform.

the class AppliedFilter method formatParamValue.

protected String formatParamValue(Param param) {
    Object value = param.getValue();
    if (value == null)
        return "";
    if (param.isDateInterval()) {
        DateIntervalValue dateIntervalValue = AppBeans.getPrototype(DateIntervalValue.NAME, (String) value);
        return dateIntervalValue.getLocalizedValue();
    }
    if (value instanceof Instance)
        return ((Instance) value).getInstanceName();
    if (value instanceof Enum)
        return messages.getMessage((Enum) value);
    if (value instanceof ArrayList) {
        ArrayList<String> names = new ArrayList<>();
        ArrayList list = ((ArrayList) value);
        for (Object obj : list) {
            if (obj instanceof Instance)
                names.add(((Instance) obj).getInstanceName());
            else {
                names.add(FilterConditionUtils.formatParamValue(param, obj));
            }
        }
        return names.toString();
    }
    return FilterConditionUtils.formatParamValue(param, value);
}
Also used : Instance(com.haulmont.chile.core.model.Instance) ArrayList(java.util.ArrayList) DateIntervalValue(com.haulmont.cuba.gui.components.filter.dateinterval.DateIntervalValue)

Aggregations

Instance (com.haulmont.chile.core.model.Instance)1 DateIntervalValue (com.haulmont.cuba.gui.components.filter.dateinterval.DateIntervalValue)1 ArrayList (java.util.ArrayList)1