Examples of AjaxBehavior


Examples of javax.faces.component.behavior.AjaxBehavior

    private static final String IDENTIFYER_MARKER = "@";

    public void decode(FacesContext context, UIComponent component,
                       ClientBehavior behavior) {

        AjaxBehavior ajaxBehavior = (AjaxBehavior) behavior;
        assertBehavior(behavior);
        if (ajaxBehavior.isDisabled() || !component.isRendered()) {
            return;
        }

        dispatchBehaviorEvent(component, ajaxBehavior);
    }
View Full Code Here

Examples of javax.faces.component.behavior.AjaxBehavior

    }


    public String getScript(ClientBehaviorContext behaviorContext,
                            ClientBehavior behavior) {
        AjaxBehavior ajaxBehavior = (AjaxBehavior) behavior;
       
        if (ajaxBehavior.isDisabled()) {
            return null;
        }
       
        return makeAjax(behaviorContext, ajaxBehavior).toString();
    }
View Full Code Here

Examples of javax.faces.component.behavior.AjaxBehavior

                    return;
                }
            }
        }

        AjaxBehavior ajaxBehavior = (AjaxBehavior) context.getApplication()
                .createBehavior(AjaxBehavior.BEHAVIOR_ID);

        if (_disabled != null)
        {
            if (_disabled.isLiteral())
            {
                ajaxBehavior.setDisabled(_disabled.getBoolean(faceletContext));
            }
            else
            {
                ajaxBehavior.setValueExpression("disabled", _disabled
                        .getValueExpression(faceletContext, Boolean.class));
            }
        }
        if (_execute != null)
        {
            ajaxBehavior.setValueExpression("execute", _execute
                    .getValueExpression(faceletContext, Object.class));
        }
        if (_immediate != null)
        {
            if (_immediate.isLiteral())
            {
                ajaxBehavior
                        .setImmediate(_immediate.getBoolean(faceletContext));
            }
            else
            {
                ajaxBehavior.setValueExpression("immediate", _immediate
                        .getValueExpression(faceletContext, Boolean.class));
            }
        }
        if (_listener != null)
        {
            MethodExpression expr = _listener.getMethodExpression(
                    faceletContext, Void.TYPE, AJAX_BEHAVIOR_LISTENER_SIG);
            AjaxBehaviorListener abl = new AjaxBehaviorListenerImpl(expr);
            ajaxBehavior.addAjaxBehaviorListener(abl);
        }
        if (_onerror != null)
        {
            if (_onerror.isLiteral())
            {
                ajaxBehavior.setOnerror(_onerror.getValue(faceletContext));
            }
            else
            {
                ajaxBehavior.setValueExpression("onerror", _onerror
                        .getValueExpression(faceletContext, String.class));
            }
        }
        if (_onevent != null)
        {
            if (_onevent.isLiteral())
            {
                ajaxBehavior.setOnevent(_onevent.getValue(faceletContext));
            }
            else
            {
                ajaxBehavior.setValueExpression("onevent", _onevent
                        .getValueExpression(faceletContext, String.class));
            }
        }
        if (_render != null)
        {
            ajaxBehavior.setValueExpression("render", _render
                    .getValueExpression(faceletContext, Object.class));
        }
       
        cvh.addClientBehavior(eventName, ajaxBehavior);
    }
View Full Code Here

Examples of javax.faces.component.behavior.AjaxBehavior

    /**
     * Components that render client behaviors should always render "id" and "name" attribute
     */
    public void testClientBehaviorHolderRendersIdAndName()
    {
        dataTable.addClientBehavior("keypress", new AjaxBehavior());
        try
        {
            dataTable.encodeAll(facesContext);
            String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
            assertTrue(output.matches("(?s).+id=\".+\".+"));
View Full Code Here

Examples of javax.faces.component.behavior.AjaxBehavior

    /**
     * Components that render client behaviors should always render "id" and "name" attribute
     */
    public void testClientBehaviorHolderRendersIdAndName()
    {
        inputTextarea.addClientBehavior("keypress", new AjaxBehavior());
        try
        {
            inputTextarea.encodeAll(facesContext);
            String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
            assertTrue(output.matches("(?s).+id=\".+\".+"));
View Full Code Here

Examples of javax.faces.component.behavior.AjaxBehavior

    /**
     * Components that render client behaviors should always render "id" and "name" attribute
     */
    public void testClientBehaviorHolderRendersIdAndName()
    {
        inputText.addClientBehavior("keypress", new AjaxBehavior());
        try
        {
            inputText.encodeAll(facesContext);
            String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
            assertTrue(output.matches(".+id=\".+\".+"));
View Full Code Here

Examples of javax.faces.component.behavior.AjaxBehavior

    public void decode(FacesContext context, UIComponent component,
                       ClientBehavior behavior)
    {
        assertBehavior(behavior);
        AjaxBehavior ajaxBehavior = (AjaxBehavior) behavior;
        if (ajaxBehavior.isDisabled() || !component.isRendered())
        {
            return;
        }

        dispatchBehaviorEvent(component, ajaxBehavior);
View Full Code Here

Examples of javax.faces.component.behavior.AjaxBehavior

    public String getScript(ClientBehaviorContext behaviorContext,
                            ClientBehavior behavior)
    {
        assertBehavior(behavior);
        AjaxBehavior ajaxBehavior = (AjaxBehavior) behavior;

        if (ajaxBehavior.isDisabled())
        {
            return null;
        }

        return makeAjax(behaviorContext, ajaxBehavior).toString();
View Full Code Here

Examples of javax.faces.component.behavior.AjaxBehavior

        // In the wrapping case, we assume that some wrapped component
        // is going to be Ajax enabled and install the Ajax resource.
        installAjaxResourceIfNecessary();

        AjaxBehavior ajaxBehavior = createAjaxBehavior(ctx, eventName);

        // We leverage AjaxBehaviors to support the wrapping case.  We
        // push/pop the AjaxBehavior instance on AjaxBehaviors so that
        // child tags will have access to it.
        FacesContext context = ctx.getFacesContext();
View Full Code Here

Examples of javax.faces.component.behavior.AjaxBehavior

                throw new TagException(this.tag,
                    getUnsupportedEventMessage(eventName, eventNames, parent));
            }
        }

        AjaxBehavior ajaxBehavior = createAjaxBehavior(ctx, eventName);
        bHolder.addClientBehavior(eventName, ajaxBehavior);
        installAjaxResourceIfNecessary();
    }
View Full Code Here
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.