Package org.apache.shale.validator.validator

Examples of org.apache.shale.validator.validator.IntegerValidator


     * registered on our corresponding <code>UIComponent</code>.</p>
     */
    protected Validator createValidator() {

        FacesContext context = FacesContext.getCurrentInstance();
        IntegerValidator validator = new IntegerValidator();

        if (client != null) {
            Boolean value = null;
            if (UIComponentTag.isValueReference(client)) {
                ValueBinding vb = context.getApplication().createValueBinding(client);
                value = (Boolean) vb.getValue(context);
            } else {
                value = (Boolean) HELPER.asObject(context, Boolean.class, client);
            }
            validator.setClient(value.booleanValue());
        }

        if (maximum != null) {
            Integer value = null;
            if (UIComponentTag.isValueReference(maximum)) {
                ValueBinding vb = context.getApplication().createValueBinding(maximum);
                value = (Integer) vb.getValue(context);
            } else {
                value = (Integer) HELPER.asObject(context, Integer.class, maximum);
            }
            validator.setMaximum(value.intValue());
        }

        if (message != null) {
            String value = null;
            if (UIComponentTag.isValueReference(message)) {
                ValueBinding vb = context.getApplication().createValueBinding(message);
                value = (String) vb.getValue(context);
            } else {
                value = message;
            }
            validator.setMessage(value);
        }

        if (minimum != null) {
            Integer value = null;
            if (UIComponentTag.isValueReference(minimum)) {
                ValueBinding vb = context.getApplication().createValueBinding(minimum);
                value = (Integer) vb.getValue(context);
            } else {
                value = (Integer) HELPER.asObject(context, Integer.class, minimum);
            }
            validator.setMinimum(value.intValue());
        }

        return validator;

    }
View Full Code Here

TOP

Related Classes of org.apache.shale.validator.validator.IntegerValidator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.