else serviceForEditMode(httpServletRequest, httpServletResponse);
}
}
protected void serviceForProperties(HttpServletRequest request, HttpServletResponse response) {
DashboardFilter filter = getDashboardFilterHandler().getFilter();
List properties = getDashboardFilterHandler().getProperties();
renderFragment("outputStart");
// Show properties
if (properties.size() ==0) renderFragment("outputEmpty");
Iterator it = properties.iterator();
while (it.hasNext()) {
DashboardFilterProperty dashboardFilterProperty = (DashboardFilterProperty) it.next();
if (dashboardFilterProperty.isBeingFiltered()) continue;
if (!dashboardFilterProperty.isVisible()) continue;
renderFragment("outputStartRow");
renderPropertyName(dashboardFilterProperty);
if (dashboardFilterProperty.isLabelProperty()) {
// Get the property allowed values.
String allowedValue = null;
List allowedValues = dashboardFilterProperty.getPropertyDistinctValues();
if (filter != null && filter.containsProperty(dashboardFilterProperty.getPropertyId())) {
List filterAllowedValues = filter.getPropertyAllowedValues(dashboardFilterProperty.getPropertyId());
if (filterAllowedValues.size() == 1) allowedValue = (String) filterAllowedValues.get(0);
}
String[] keys = new String[allowedValues.size()+2];
String[] values = new String[allowedValues.size()+2];
keys[0] = DashboardFilterHandler.PARAM_NULL_VALUE;
values[0] = " - " + getBundle().getString(DashboardFilterHandler.I18N_PREFFIX + "select") + " " + StringEscapeUtils.escapeHtml(dashboardFilterProperty.getPropertyName(getLocale())) + " - ";
keys[1]=DashboardFilterHandler.PARAM_CUSTOM_VALUE;
values[1]= " - " + getBundle().getString(DashboardFilterHandler.I18N_PREFFIX + "custom") + " - ";
Iterator it1 = allowedValues.iterator();
for (int i = 2; it1.hasNext(); i++) {
Object value = it1.next();
keys[i]= Integer.toString(i);
if (value != null && value.equals(allowedValue)) setAttribute("selected", Integer.toString(i));
values[i] = StringEscapeUtils.escapeHtml(dashboardFilterProperty.formatPropertyValue(value, getLocale()));
}
if (allowedValue == null) setAttribute("selected","0");
setAttribute("keys",keys);
setAttribute("values",values);
setDefaultTypeAttributes(dashboardFilterProperty);
setAttribute("submitOnChange",getDashboardFilterHandler().isShowSubmitOnChange());
renderFragment("outputPropertyTypeLabel");
} else if (dashboardFilterProperty.isNumericProperty()) {
setDefaultTypeAttributes(dashboardFilterProperty);
Object minValue = null;
Object maxValue = null;
if (filter != null && filter.containsProperty(dashboardFilterProperty.getPropertyId())) {
maxValue = dashboardFilterProperty.getPropertyMaxValue();
minValue = dashboardFilterProperty.getPropertyMinValue();
}
setAttribute("minValue",minValue);
setAttribute("maxValue",maxValue);
renderFragment("outputPropertyTypeNumeric");
} else if (dashboardFilterProperty.isDateProperty()) {
setDefaultTypeAttributes(dashboardFilterProperty);
Object minValue = null;
Object maxValue = null;
if (filter != null && filter.containsProperty(dashboardFilterProperty.getPropertyId())) {
maxValue = dashboardFilterProperty.getPropertyMaxValue();
minValue = dashboardFilterProperty.getPropertyMinValue();
}
setAttribute("minValue",minValue);
setAttribute("maxValue",maxValue);