protected void setMaxlength(UIInput input, int maxlength) { if (input instanceof HtmlInputText) { ((HtmlInputText) input).setMaxlength(maxlength); } else if (input instanceof HtmlInputSecret) { ((HtmlInputSecret) input).setMaxlength(maxlength); } else if (input instanceof InputTextarea) { ((InputTextarea) input).setMaxlength(maxlength); } }
protected void setMaximumLength( UIComponent component, Map<String, String> attributes ) { String maximumLength = attributes.get( MAXIMUM_LENGTH ); if ( maximumLength != null && !"".equals( maximumLength ) ) { if ( component instanceof HtmlInputText ) { ( (HtmlInputText) component ).setMaxlength( Integer.parseInt( maximumLength ) ); } else if ( component instanceof HtmlInputSecret ) { ( (HtmlInputSecret) component ).setMaxlength( Integer.parseInt( maximumLength ) ); } } }
protected void setMaximumLength( UIComponent component, Map<String, String> attributes ) { String maximumLength = attributes.get( MAXIMUM_LENGTH ); if ( maximumLength != null && !"".equals( maximumLength ) ) { if ( component instanceof HtmlInputText ) { ( (HtmlInputText) component ).setMaxlength( Integer.parseInt( maximumLength ) ); } else if ( component instanceof HtmlInputSecret ) { ( (HtmlInputSecret) component ).setMaxlength( Integer.parseInt( maximumLength ) ); } } }
protected void setMaxlength(UIInput input, int maxlength) { if (input instanceof HtmlInputText) { ((HtmlInputText) input).setMaxlength(maxlength); } else if (input instanceof HtmlInputSecret) { ((HtmlInputSecret) input).setMaxlength(maxlength); } else if (input instanceof InputTextarea) { ((InputTextarea) input).setMaxlength(maxlength); } }
private static UIInput createInputForPasswordProperty() { HtmlInputSecret inputSecret = FacesComponentUtility.createComponent(HtmlInputSecret.class, null); inputSecret.setStyleClass(CssStyleClasses.PROPERTY_VALUE_INPUT); inputSecret.setMaxlength(PropertySimple.MAX_VALUE_LENGTH); // TODO: Remove the below line, as it's not secure, and improve support for displaying/validating password fields. inputSecret.setRedisplay(true); // Disable browser auto-completion. inputSecret.setAutocomplete("off"); return inputSecret; }
@Override public UIInput createInput() { HtmlInputSecret inputUser = new HtmlInputSecret(); LengthValidator validator = new LengthValidator(); if (getMaxLenght() != null) { inputUser.setSize(getMaxLenght()); inputUser.setMaxlength(getMaxLenght()); validator.setMaximum(getMaxLenght()); } validator.setMinimum(getMinLenght()); inputUser.addValidator(validator); return inputUser; }
inputPwd.setMaxlength(User.PASSWORD_MAX_LENGHT); inputPwd.setSize(User.PASSWORD_MAX_LENGHT); panel.getChildren().add(inputPwd);