if (clientId.equals(page.getActionId())) {
// this is a inputSuggest
encodeAjax(facesContext, component);
} else {
AbstractUIInput input = (AbstractUIInput) component;
String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, input);
final String currentValue = getCurrentValue(facesContext, input);
final boolean password = ComponentUtils.getBooleanAttribute(input, Attributes.PASSWORD);
if (LOG.isDebugEnabled()) {
LOG.debug("currentValue = '"
+ (password && currentValue != null ? StringUtils.leftPad("", currentValue.length(), '*') : currentValue)
+ "'");
}
final String type = password ? HtmlInputTypes.PASSWORD : HtmlInputTypes.TEXT;
// Todo: check for valid binding
boolean renderAjaxSuggest = false;
if (input instanceof UIIn) {
renderAjaxSuggest = ((UIIn) input).getSuggestMethod() != null;
}
String id = input.getClientId(facesContext);
TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
writer.startElement(HtmlElements.INPUT, input);
writer.writeAttribute(HtmlAttributes.TYPE, type, false);
writer.writeNameAttribute(id);
writer.writeIdAttribute(id);
HtmlRendererUtils.writeDataAttributes(facesContext, writer, input);
if (currentValue != null) {
writer.writeAttribute(HtmlAttributes.VALUE, currentValue, true);
}
if (title != null) {
writer.writeAttribute(HtmlAttributes.TITLE, title, true);
}
int maxLength = 0;
for (Validator validator : input.getValidators()) {
if (validator instanceof LengthValidator) {
LengthValidator lengthValidator = (LengthValidator) validator;
maxLength = lengthValidator.getMaximum();
}
}
if (maxLength > 0) {
writer.writeAttribute(HtmlAttributes.MAXLENGTH, maxLength);
}
writer.writeAttribute(HtmlAttributes.READONLY, ComponentUtils.getBooleanAttribute(input, Attributes.READONLY));
writer.writeAttribute(HtmlAttributes.DISABLED, ComponentUtils.getBooleanAttribute(input, Attributes.DISABLED));
Integer tabIndex = input.getTabIndex();
if (tabIndex != null) {
writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
}
Style style = new Style(facesContext, input);
writer.writeStyleAttribute(style);