Examples of AjaxBehavior


Examples of javax.faces.component.behavior.AjaxBehavior

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

Examples of javax.faces.component.behavior.AjaxBehavior

     * e.g. alert('test') has to become alert(\'test\')
     */
    public void testClientBehaviorUserCodeJavaScriptEscaping()
    {
        inputText.getAttributes().put("onchange", "alert('test')");
        inputText.addClientBehavior("change", new AjaxBehavior());
        try
        {
            inputText.encodeAll(facesContext);
            String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
            // onchange="jsf.util.chain(document.getElementById('j_id0'), event,
View Full Code Here

Examples of javax.faces.component.behavior.AjaxBehavior

     * e.g. test = 'a\'b'; has to become test = \'a\\\'b\';
     */
    public void testClientBehaviorUserCodeJavaScriptDoubleEscaping()
    {
        inputText.getAttributes().put("onchange", "var test = \'a\\\'b\'; alert(test);");
        inputText.addClientBehavior("change", new AjaxBehavior());
        try
        {
            inputText.encodeAll(facesContext);
            String output = ((StringWriter) writer.getWriter()).getBuffer().toString();
            // onchange="jsf.util.chain(document.getElementById('j_id0'), event,
View Full Code Here

Examples of javax.faces.component.behavior.AjaxBehavior

       
        for (int i = 0; i < attrs.length; i++)
        {
            UIComponent component = createComponentToTest();
            ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component;
            clientBehaviorHolder.addClientBehavior(attrs[i].getClientEvent(), new AjaxBehavior());
            try
            {
                component.encodeAll(facesContext);
                String output = outputWriter.toString();
                Assert.assertTrue(output.matches(".+ id=\".+\".+"));
View Full Code Here

Examples of javax.faces.component.behavior.AjaxBehavior

                    return;
                }
            }
        }

        AjaxBehavior ajaxBehavior = createBehavior(context);

        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));
        }
        if (_delay != null)
        {
            if (_delay.isLiteral())
            {
                ajaxBehavior.setDelay(_delay.getValue(faceletContext));
            }
            else
            {
                ajaxBehavior.setValueExpression("delay", _delay
                    .getValueExpression(faceletContext, String.class));
            }
        }
       if (_resetValues != null)
        {
            if (_resetValues.isLiteral())
            {
                ajaxBehavior
                        .setResetValues(_resetValues.getBoolean(faceletContext));
            }
            else
            {
                ajaxBehavior.setValueExpression("resetValues", _resetValues
                        .getValueExpression(faceletContext, Boolean.class));
            }
        }
        cvh.addClientBehavior(eventName, ajaxBehavior);
    }
View Full Code Here

Examples of javax.faces.component.behavior.AjaxBehavior

                    return;
                }
            }
        }

        AjaxBehavior ajaxBehavior = createBehavior(context);

        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));
        }
        if (_delay != null)
        {
            if (_delay.isLiteral())
            {
                ajaxBehavior.setDelay(_delay.getValue(faceletContext));
            }
            else
            {
                ajaxBehavior.setValueExpression("delay", _delay
                    .getValueExpression(faceletContext, String.class));
            }
        }
       if (_resetValues != null)
        {
            if (_resetValues.isLiteral())
            {
                ajaxBehavior
                        .setResetValues(_resetValues.getBoolean(faceletContext));
            }
            else
            {
                ajaxBehavior.setValueExpression("resetValues", _resetValues
                        .getValueExpression(faceletContext, Boolean.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

       
        for (int i = 0; i < attrs.length; i++)
        {
            UIComponent component = createComponentToTest();
            ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component;
            clientBehaviorHolder.addClientBehavior(attrs[i].getClientEvent(), new AjaxBehavior());
            try
            {
                component.encodeAll(facesContext);
                String output = outputWriter.toString();
                Assert.assertTrue(output.indexOf(" id=\""+component.getClientId(facesContext)+"\"") > -1);
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.