use of javax.faces.component.html.HtmlInputTextarea in project liferay-faces-alloy by liferay.
the class OutputRemainingChars method getMaxLength.
@Override
public Integer getMaxLength() {
Integer maxLength = super.getMaxLength();
// try to get the maxlength from the associated input component.
if (maxLength == null) {
String forComponent = getFor();
if (forComponent == null) {
logger.error("getMaxLength: Please specify a 'for' attribute for the outputRemainingChars component.");
} else {
UIComponent inputComponent = findComponent(forComponent);
if (inputComponent != null) {
if (inputComponent instanceof HtmlInputText) {
HtmlInputText htmlInputText = (HtmlInputText) inputComponent;
maxLength = htmlInputText.getMaxlength();
} else if (inputComponent instanceof HtmlInputTextarea) {
HtmlInputTextarea htmlInputTextarea = (HtmlInputTextarea) inputComponent;
Object maxLengthObject = htmlInputTextarea.getAttributes().get("maxlength");
if (maxLengthObject != null) {
maxLength = Integer.parseInt(maxLengthObject.toString());
}
}
}
}
}
return maxLength;
}
use of javax.faces.component.html.HtmlInputTextarea in project empire-db by apache.
the class TextAreaInputControl method createInputComponents.
@Override
protected void createInputComponents(UIComponent parent, InputInfo ii, FacesContext context, List<UIComponent> compList) {
// check params
if (!compList.isEmpty())
throw new InvalidArgumentException("compList", compList);
// create
HtmlInputTextarea input = InputControlManager.createComponent(context, this.inputComponentClass);
// once
copyAttributes(parent, ii, input);
// cols
int cols = getFormatInteger(ii, FORMAT_COLS, FORMAT_COLS_ATTRIBUTE);
if (cols > 0)
input.setCols(cols);
// rows
int rows = getFormatInteger(ii, FORMAT_ROWS, FORMAT_ROWS_ATTRIBUTE);
if (rows > 0)
input.setRows(rows);
// add
compList.add(input);
// update
updateInputState(compList, ii, context, context.getCurrentPhaseId());
}
use of javax.faces.component.html.HtmlInputTextarea in project empire-db by apache.
the class TextAreaInputControl method updateInputState.
@Override
protected void updateInputState(List<UIComponent> compList, InputInfo ii, FacesContext context, PhaseId phaseId) {
UIComponent comp = compList.get(0);
if (!(comp instanceof HtmlInputTextarea)) {
throw new UnexpectedReturnValueException(comp.getClass().getName(), "compList.get(0)");
}
HtmlInputTextarea input = (HtmlInputTextarea) comp;
// disabled
DisabledType disabled = ii.getDisabled();
if (disabled != null) {
input.setReadonly((disabled == DisabledType.READONLY));
input.setDisabled((disabled == DisabledType.DISABLED));
}
// Set Value
if (phaseId == PhaseId.RENDER_RESPONSE) {
// style
addRemoveDisabledStyle(input, (disabled != null && disabled != DisabledType.NO));
addRemoveInvalidStyle(input, ii.hasError());
// set value
setInputValue(input, ii);
}
}
Aggregations