Created
November 15, 2014 23:19
-
-
Save wakim/66ea22b3c3a4d7b42025 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.com.wakim.teste_jsf.util; | |
import javax.faces.component.UIComponent; | |
import javax.faces.component.html.HtmlDataTable; | |
import javax.faces.component.visit.VisitCallback; | |
import javax.faces.component.visit.VisitContext; | |
import javax.faces.component.visit.VisitResult; | |
import javax.faces.context.FacesContext; | |
import javax.faces.validator.FacesValidator; | |
import javax.faces.validator.Validator; | |
import javax.faces.validator.ValidatorException; | |
@FacesValidator("visitValidator") | |
public class VisitValidator implements Validator { | |
@Override | |
public void validate(FacesContext facesContext, UIComponent component, Object value) throws ValidatorException { | |
HtmlDataTable dt = (HtmlDataTable) component.findComponent("dt"); | |
VisitContext vc = VisitContext.createVisitContext(facesContext); | |
dt.visitTree(vc, new VisitCallback() { | |
@Override | |
public VisitResult visit(VisitContext context, UIComponent target) { | |
System.out.println(target.getClientId(context.getFacesContext()) + " : " + target.getId() + " -> " + target + " " + target.getClass()); | |
return VisitResult.ACCEPT; | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment