Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.richfaces.renderkit.focus;
 
 import  javax.faces.component.UIForm;
 import  javax.faces.context.FacesContext;
 
Strategy for rendering Focus in AbstractFocus.Mode.VIEW
    @Override
    public void postAddToView(FacesContext contextAbstractFocus component) {
        FocusRendererUtils.markViewWithFocus(context.getViewRoot());
    }
    @Override
    public boolean shouldApply(FacesContext contextAbstractFocus component) {
        if (FocusRendererUtils.isFocusEnforced(context)) {
            return false;
        }
        if (!context.isPostback()) {
            return true;
        } else {
            UIForm form = (UIForm) .getSubmittedForm(context);
            if (!FocusRendererUtils.hasFormFocus(form)) {
                return true;
            }
        }
        return false;
    }
    @Override
    public String getFocusCandidatesAsString(FacesContext contextAbstractFocus component) {
        if (!context.isPostback()) {
            // candidate will be selected on client-side
            return null;
        } else {
            UIForm form = (UIForm) .getSubmittedForm(context);
            return getFocusCandidatesAsString(contextcomponentform);
        }
    }
New to GrepCode? Check out our FAQ X