Apply patch from OFBIZ-6415 renderTextFindField doesn't reselect operation dropdown or ignoreCase checkbox by christian carlow

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1682342 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nicolas Malin
2015-05-28 21:41:52 +00:00
parent 0027619e9e
commit 1e015b79ba
2 changed files with 28 additions and 2 deletions
@@ -3880,6 +3880,19 @@ public class ModelFormField {
return this.defaultOption;
}
public String getDefaultOption(Map<String, Object> context) {
String defaultOption = getDefaultOption();
Map<String, Object> parameters = UtilGenerics.checkMap(context.get("parameters"), String.class, Object.class);
if (UtilValidate.isNotEmpty(parameters)) {
String fieldName = this.getModelFormField().getName();
if (parameters.containsKey(fieldName)) {
defaultOption = (String) parameters.get(fieldName.concat("_op"));
}
}
return defaultOption;
}
public boolean getHideIgnoreCase() {
return this.hideIgnoreCase;
}
@@ -3892,6 +3905,19 @@ public class ModelFormField {
return this.ignoreCase;
}
public boolean getIgnoreCase(Map<String, Object> context) {
Boolean ignoreCase = getIgnoreCase();
Map<String, Object> parameters = UtilGenerics.checkMap(context.get("parameters"), String.class, Object.class);
if (UtilValidate.isNotEmpty(parameters)) {
String fieldName = this.getModelFormField().getName();
if (parameters.containsKey(fieldName)) {
ignoreCase = "Y".equals((String) parameters.get(fieldName.concat("_ic")));
}
}
return ignoreCase;
}
@Override
public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer)
throws IOException {
@@ -1741,7 +1741,7 @@ public final class MacroFormRenderer implements FormStringRenderer {
public void renderTextFindField(Appendable writer, Map<String, Object> context, TextFindField textFindField) throws IOException {
ModelFormField modelFormField = textFindField.getModelFormField();
String defaultOption = textFindField.getDefaultOption();
String defaultOption = textFindField.getDefaultOption(context);
String className = "";
String alert = "false";
String opEquals = "";
@@ -1782,7 +1782,7 @@ public final class MacroFormRenderer implements FormStringRenderer {
titleStyle = modelFormField.getTitleStyle();
}
String ignoreCase = UtilProperties.getMessage("conditional", "ignore_case", locale);
boolean ignCase = textFindField.getIgnoreCase();
boolean ignCase = textFindField.getIgnoreCase(context);
boolean hideIgnoreCase = textFindField.getHideIgnoreCase();
String tabindex = modelFormField.getTabindex();
StringWriter sr = new StringWriter();