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.
/*
* Copyright 2009-2014 PrimeTek.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.primefaces.component.inputtextarea;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.event.PhaseId;
import org.primefaces.component.autocomplete.AutoComplete;
import org.primefaces.context.RequestContext;
import org.primefaces.event.AutoCompleteEvent;
import org.primefaces.expression.SearchExpressionFacade;
import org.primefaces.renderkit.InputRenderer;
import org.primefaces.util.ComponentUtils;
import org.primefaces.util.HTML;
import org.primefaces.util.WidgetBuilder;
public class InputTextareaRenderer extends InputRenderer {
@Override
public void decode(FacesContext context, UIComponent component) {
InputTextarea inputTextarea = (InputTextarea) component;
if(inputTextarea.isDisabled() || inputTextarea.isReadonly()) {
return;
}
decodeBehaviors(context, inputTextarea);
String clientId = inputTextarea.getClientId(context);
Map params = context.getExternalContext().getRequestParameterMap();
String submittedValue = params.get(clientId);
inputTextarea.setSubmittedValue(submittedValue);
//AutoComplete event
String query = params.get(clientId + "_query");
if(query != null) {
AutoCompleteEvent autoCompleteEvent = new AutoCompleteEvent(inputTextarea, query);
autoCompleteEvent.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
inputTextarea.queueEvent(autoCompleteEvent);
}
}
@Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
InputTextarea inputTextarea = (InputTextarea) component;
Map params = context.getExternalContext().getRequestParameterMap();
String query = params.get(inputTextarea.getClientId(context) + "_query");
if(query != null) {
encodeSuggestions(context, inputTextarea, query);
}
else {
encodeMarkup(context, inputTextarea);
encodeScript(context, inputTextarea);
}
}
@SuppressWarnings("unchecked")
public void encodeSuggestions(FacesContext context, InputTextarea inputTextarea, String query) throws IOException {
ResponseWriter writer = context.getResponseWriter();
List