Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.richfaces.renderkit;
import java.io.IOException;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.el.ELException;
import javax.el.MethodExpression;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.PartialResponseWriter;
import javax.faces.context.PartialViewContext;
import javax.faces.model.ArrayDataModel;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import javax.faces.model.ResultDataModel;
import javax.faces.model.ResultSetDataModel;
import javax.servlet.jsp.jstl.sql.Result;
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.RendererUtils;
import org.ajax4jsf.util.InputUtils;
import org.richfaces.component.AbstractAutocomplete;
import org.richfaces.component.AutocompleteLayout;
import org.richfaces.component.MetaComponentResolver;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterators;
/**
* @author Nick Belaevski
*
*/
@ResourceDependencies({ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
@ResourceDependency(name = "jquery.js"), @ResourceDependency(name = "jquery.position.js"),
@ResourceDependency(name = "richfaces.js"), @ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"), @ResourceDependency(name = "richfaces-selection.js"),
@ResourceDependency(library = "org.richfaces", name = "AutocompleteBase.js"),
@ResourceDependency(library = "org.richfaces", name = "Autocomplete.js"),
@ResourceDependency(library = "org.richfaces", name = "Autocomplete.ecss")
})
public abstract class AutocompleteRendererBase extends InputRendererBase implements MetaComponentRenderer {
public String getScriptOptions(UIComponent component) {
Map attributes = component.getAttributes();
Map options = new HashMap();
RendererUtils utils = getUtils();
utils.addToScriptHash(options, "buttonId", component.getClientId() + "Button");
utils.addToScriptHash(options, "selectedItemClass", attributes.get("selectedItemClass"));
utils.addToScriptHash(options, "minChars", attributes.get("minChars"), "1");
utils.addToScriptHash(options, "mode", attributes.get("mode"), "ajax");
utils.addToScriptHash(options, "filterFunction", attributes.get("filterFunction"));
utils.addToScriptHash(options, "autofill", attributes.get("autofill"), "true");
utils.addToScriptHash(options, "disabled", attributes.get("disabled"), "false");
utils.addToScriptHash(options, "selectFirst", attributes.get("selectFirst"), "true");
utils.addToScriptHash(options, "tokens", attributes.get("tokens"));
utils.addToScriptHash(options, "onbegin", attributes.get("onbegin"));
utils.addToScriptHash(options, "oncomplete", attributes.get("oncomplete"));
utils.addToScriptHash(options, "onerror", attributes.get("onerror"));
utils.addToScriptHash(options, "onbeforedomupdate", attributes.get("onbeforedomupdate"));
utils.addToScriptHash(options, "onchange", attributes.get("onchange"));
if (attributes.get("mode").equals("ajax")){
utils.addToScriptHash(options, "isCachedAjax", false, "true");
} else if (attributes.get("mode").equals("client")) {
utils.addToScriptHash(options, "ajaxMode", false, "true");
}
StringBuilder builder = new StringBuilder();
builder.append(ScriptUtils.toScript(options));
return builder.toString();
}
// TODO nick - handle parameter
@SuppressWarnings("unchecked")
private DataModel