in plugins/struts2-dojo-plugin/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java [249:340]
public void evaluateExtraParams() {
super.evaluateExtraParams();
if (forceValidOption != null)
addParameter("forceValidOption", findValue(forceValidOption,
Boolean.class));
if (searchType != null) {
String type = findString(searchType);
if(type != null)
addParameter("searchType", type.toUpperCase());
}
if (autoComplete != null)
addParameter("autoComplete", findValue(autoComplete, Boolean.class));
if (delay != null)
addParameter("delay", findValue(delay, Integer.class));
if (disabled != null)
addParameter("disabled", findValue(disabled, Boolean.class));
if (href != null) {
addParameter("href", findString(href));
addParameter("mode", "remote");
}
if (dropdownHeight != null)
addParameter("dropdownHeight", findValue(dropdownHeight, Integer.class));
if (dropdownWidth != null)
addParameter("dropdownWidth", findValue(dropdownWidth, Integer.class));
if (formFilter != null)
addParameter("formFilter", findString(formFilter));
if (formId != null)
addParameter("formId", findString(formId));
if (listenTopics != null)
addParameter("listenTopics", findString(listenTopics));
if (notifyTopics != null)
addParameter("notifyTopics", findString(notifyTopics));
if (indicator != null)
addParameter("indicator", findString(indicator));
if (loadOnTextChange != null)
addParameter("loadOnTextChange", findValue(loadOnTextChange, Boolean.class));
if (loadMinimumCount != null)
addParameter("loadMinimumCount", findValue(loadMinimumCount, Integer.class));
if (showDownArrow != null)
addParameter("showDownArrow", findValue(showDownArrow, Boolean.class));
else
addParameter("showDownArrow", Boolean.TRUE);
if (templateCssPath != null)
addParameter("templateCssPath", findString(templateCssPath));
if (iconPath != null)
addParameter("iconPath", findString(iconPath));
if (dataFieldName != null)
addParameter("dataFieldName", findString(dataFieldName));
if (keyName != null)
addParameter("keyName", findString(keyName));
else {
keyName = name + "Key";
addParameter("keyName", findString(keyName));
}
if (transport != null)
addParameter("transport", findString(transport));
if (preload != null)
addParameter("preload", findValue(preload, Boolean.class));
if (keyValue != null)
addParameter("nameKeyValue", findString(keyValue));
else {
String keyNameExpr = "%{" + keyName + "}";
addParameter("nameKeyValue", findString(keyNameExpr));
}
if (beforeNotifyTopics != null)
addParameter("beforeNotifyTopics", findString(beforeNotifyTopics));
if (afterNotifyTopics != null)
addParameter("afterNotifyTopics", findString(afterNotifyTopics));
if (errorNotifyTopics != null)
addParameter("errorNotifyTopics", findString(errorNotifyTopics));
if (valueNotifyTopics != null)
addParameter("valueNotifyTopics", findString(valueNotifyTopics));
if (resultsLimit != null)
addParameter("searchLimit", findString(resultsLimit));
// generate a random ID if not explicitly set and not parsing the content
Boolean parseContent = (Boolean)stack.getContext().get(Head.PARSE_CONTENT);
boolean generateId = (parseContent != null ? !parseContent : true);
addParameter("pushId", generateId);
if ((this.id == null || this.id.length() == 0) && generateId) {
// resolves Math.abs(Integer.MIN_VALUE) issue reported by FindBugs
// http://findbugs.sourceforge.net/bugDescriptions.html#RV_ABSOLUTE_VALUE_OF_RANDOM_INT
int nextInt = RANDOM.nextInt();
nextInt = nextInt == Integer.MIN_VALUE ? Integer.MAX_VALUE : Math.abs(nextInt);
this.id = "widget_" + String.valueOf(nextInt);
}
}