Package codetroopers.wicket.web.parsley.tagmodifier

Source Code of codetroopers.wicket.web.parsley.tagmodifier.ParsleyNotNullTagModifier

package codetroopers.wicket.web.parsley.tagmodifier;

import codetroopers.wicket.web.parsley.validator.ParsleyValidationBehavior;
import org.apache.wicket.bean.validation.ITagModifier;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.html.form.FormComponent;

import javax.validation.constraints.NotNull;

/**
* @author cgatay
*/
public class ParsleyNotNullTagModifier implements ITagModifier<NotNull>{
    /**
     * required is put automatically if the ParsleyValidationBehavior is manually added to a component,
     * there is no need to extract a not null behavior.
     */
    @Override
    public void modify(final FormComponent<?> component, final ComponentTag tag, final NotNull annotation) {
        final ParsleyValidationBehavior validationBehavior = new ParsleyValidationBehavior();
        validationBehavior.require(true);
        validationBehavior.onComponentTag(component, tag);
    }
}
TOP

Related Classes of codetroopers.wicket.web.parsley.tagmodifier.ParsleyNotNullTagModifier

TOP
Copyright © 2018 www.massapi.com. 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.