Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.richfaces.renderkit;
 import  javax.faces.application.ResourceDependencies;
 import  javax.faces.application.ResourceDependency;
 import  javax.faces.context.FacesContext;
 import  org.ajax4jsf.javascript.JSLiteral;
 import  org.richfaces.application.ServiceTracker;
import  org.richfaces.javascript.JavaScriptService;
@ResourceDependencies({ @ResourceDependency(library = "org.richfaces", name = "base-component.reslib"),
        @ResourceDependency(library = "com.jqueryui", name = "jquery.ui.core.js"),
        @ResourceDependency(library = "org.richfaces", name = "focus.js") })
public class FocusRendererBase extends RendererBase implements FocusRendererInterface {
    public static final String RENDERER_TYPE = "org.richfaces.FocusRenderer";
Determines whether the currently rendered Focus should be rendered or not based on if request is postback and if Focus belongs to form which has been submitted.
    public boolean shouldApply(FacesContext contextAbstractFocus component) {
        return getStrategy(component).shouldApply(contextcomponent);

Get space-separated list of clientIds as component candidates to be focused on client.
    public String getFocusCandidatesAsString(FacesContext contextAbstractFocus component) {
        return getStrategy(component).getFocusCandidatesAsString(contextcomponent);
    public void postAddToView(FacesContext contextAbstractFocus component) {

This method ensures that component which should be focused will be present in the page in the time of running script (oncomplete).
    public void renderOncompleteScript(FacesContext contextString script) {
        JavaScriptService javaScriptService = ServiceTracker.getService(JavaScriptService.class);
        javaScriptService.addScript(contextnew JSLiteral(script));
    private FocusRenderStrategy getStrategy(AbstractFocus component) {
        switch (component.getMode()) {
            case :
                return ;
            case :
                return ;
                throw new UnsupportedOperationException("Retrieving focus candidates in " + component.getMode()
                        + " mode is not supported");
New to GrepCode? Check out our FAQ X