Package javax.faces.component

Examples of javax.faces.component.UIComponent


        componentAttributes.put("src", "urn:abc");
        componentAttributes.put("facelets.Mark", 123);
        componentAttributes.put("lang", "ru");
        componentAttributes.put("styleClass", "rich-component");

        UIComponent component = createMockComponent();

        responseWriter.writeAttribute(eq("disabled"), eq(Boolean.TRUE), EasyMock.<String>isNull());
        // checked attribute shouldn't be rendered - it's 'false'
        responseWriter.writeAttribute(eq("style"), eq("color:red"), EasyMock.<String>isNull());
        responseWriter.writeURIAttribute(eq("src"), eq("urn:abc"), EasyMock.<String>isNull());
View Full Code Here


        behaviorsMap.put("keypress", Arrays.asList(keypressBehavior));
        behaviorsMap.put("action", Arrays.asList(actionBehavior1, actionBehavior2, actionBehavior3));
        behaviorsMap.put("contextmenu", Arrays.asList(contextmenuBehavior));

        ClientBehaviorHolder behaviorHolder = createMockClientBehaviorHolder();
        UIComponent component = (UIComponent) behaviorHolder;

        responseWriter.writeAttribute(eq("onkeypress"),
                eq("return jsf.util.chain(this, event, 'alert(keypress)','prompt(keypress)')"), EasyMock.<String>isNull());
        responseWriter.writeAttribute(eq("onclick"),
                eq("return jsf.util.chain(this, event, 'alert(click)','prompt(action1)','prompt(action2)')"),
View Full Code Here

        ClientBehavior actionBehavior1 = createClientBehavior("action1", emptyHintsSet);
        behaviorsMap.put("action", Arrays.asList(actionBehavior1));

        ClientBehaviorHolder behaviorHolder = createMockClientBehaviorHolder();
        UIComponent component = (UIComponent) behaviorHolder;
        return component;
    }
View Full Code Here

    }

    @Test
    public void testBehaviorsForDisabledComponent() throws Exception {
        componentAttributes.put("disabled", Boolean.TRUE);
        UIComponent component = setupBehaviorsTestForDisabledComponent();

        responseWriter.writeAttribute(eq("style"), eq("color:green"), EasyMock.<String>isNull());

        facesEnvironment.replay();
View Full Code Here

    }

    @Test
    public void testBehaviorsForNonDisabledComponent() throws Exception {
        componentAttributes.put("disabled", Boolean.FALSE);
        UIComponent component = setupBehaviorsTestForDisabledComponent();

        responseWriter.writeAttribute(eq("onclick"),
                eq("return jsf.util.chain(this, event, 'alert(click)','prompt(action1)')"), EasyMock.<String>isNull());
        responseWriter.writeAttribute(eq("onmousemove"), eq("alert(mousemove)"), EasyMock.<String>isNull());
        responseWriter.writeAttribute(eq("style"), eq("color:green"), EasyMock.<String>isNull());
View Full Code Here

    }

    public void checkDisabled(Object attributeValue, boolean expectedValue) throws Exception {
        componentAttributes.put("disabled", attributeValue);

        UIComponent component = createMockComponent();
        facesEnvironment.replay();
        assertTrue(expectedValue == RenderKitUtils.isDisabled(component));
    }
View Full Code Here

        checkDisabled(null, false);
    }

    private UIComponent setupTestDecodeBehaviors(String behaviorSourceId, String behaviorEventName) throws Exception {
        ClientBehaviorHolder behaviorHolder = createMockClientBehaviorHolder();
        UIComponent component = (UIComponent) behaviorHolder;

        Map<String, String> requestParameterMap = new HashMap<String, String>();
        requestParameterMap.put(RenderKitUtils.BEHAVIOR_SOURCE_ID, behaviorSourceId);
        requestParameterMap.put(RenderKitUtils.BEHAVIOR_EVENT_NAME, behaviorEventName);
        expect(externalContext.getRequestParameterMap()).andStubReturn(requestParameterMap);
View Full Code Here

        return component;
    }

    @Test
    public void testDecodeActionBehaviors() throws Exception {
        UIComponent component = setupTestDecodeBehaviors(CLIENT_ID, "action");

        List<ClientBehavior> behaviors = behaviorsMap.get("action");
        for (ClientBehavior clientBehavior : behaviors) {
            clientBehavior.decode(same(facesContext), same(component));
            expectLastCall();
View Full Code Here

        assertEquals("action", RenderKitUtils.decodeBehaviors(facesContext, component));
    }

    @Test
    public void testDecodeBlurBehaviors() throws Exception {
        UIComponent component = setupTestDecodeBehaviors(CLIENT_ID, "blur");

        List<ClientBehavior> behaviors = behaviorsMap.get("blur");
        for (ClientBehavior clientBehavior : behaviors) {
            clientBehavior.decode(same(facesContext), same(component));
            expectLastCall();
View Full Code Here

        assertEquals("blur", RenderKitUtils.decodeBehaviors(facesContext, component));
    }

    @Test
    public void testDecodeNonMatchingClientId() throws Exception {
        UIComponent component = setupTestDecodeBehaviors("wrongId", "action");

        // nothing should be called - clientId is not matched

        facesEnvironment.replay();
View Full Code Here

TOP

Related Classes of javax.faces.component.UIComponent

Copyright © 2018 www.massapicom. 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.