Package javax.faces.component

Examples of javax.faces.component.UIComponent


        assertNull(RenderKitUtils.decodeBehaviors(facesContext, component));
    }

    @Test
    public void testDecodeNoSubmittedBehavior() throws Exception {
        UIComponent component = setupTestDecodeBehaviors(CLIENT_ID, null);

        // nothing should be called - no behavior event information was submitted

        facesEnvironment.replay();
View Full Code Here


        assertNull(RenderKitUtils.decodeBehaviors(facesContext, component));
    }

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

        // nothing should be called - no context menu behaviors were created

        facesEnvironment.replay();
View Full Code Here

    @Test
    public void when_component_has_defined_facet_and_it_is_rendered_then_hasFacet_should_return_true() {
        // given

        UIComponent component = createMockComponent();
        UIComponent facetComponent = createMockComponent();

        expect(component.getFacet(FACET_NAME)).andReturn(facetComponent).times(2);
        expect(facetComponent.isRendered()).andReturn(true);

        facesEnvironment.replay();

        // when
        boolean hasFacet = RenderKitUtils.hasFacet(component, FACET_NAME);
View Full Code Here

    }

    @Test
    public void when_component_has_defined_facet_but_it_is_not_rendered_then_hasFacet_should_return_false() {
        // given
        UIComponent component = createMockComponent();
        UIComponent facetComponent = createMockComponent();

        expect(component.getFacet(FACET_NAME)).andReturn(facetComponent).times(2);
        expect(facetComponent.isRendered()).andReturn(false);

        facesEnvironment.replay();

        // when
        boolean hasFacet = RenderKitUtils.hasFacet(component, FACET_NAME);
View Full Code Here

    }

    @Test
    public void when_component_has_not_defined_facet_then_hasFacet_should_return_false() {
        // given
        UIComponent component = createMockComponent();

        expect(component.getFacet(FACET_NAME)).andReturn(null);

        facesEnvironment.replay();

        // when
        boolean hasFacet = RenderKitUtils.hasFacet(component, FACET_NAME);
View Full Code Here

        // given
        Map<String, Object> attributes = Maps.newTreeMap();
        Object value = new Object();
        attributes.put("value", value);

        UIComponent component = createMockComponent();

        expect(component.getAttributes()).andReturn(attributes);
        expect(component.getValueExpression("value")).andReturn(null);

        facesEnvironment.replay();

        // when
        Object evaluated = RenderKitUtils.evaluateAttribute("value", component, facesContext);
View Full Code Here

        ELContext elContext = facesEnvironment.getElContext();

        ValueExpression valueExpression = facesEnvironment.createMock(ValueExpression.class);


        UIComponent component = createMockComponent();

        expect(facesContext.getELContext()).andReturn(elContext);
        expect(component.getValueExpression("value")).andReturn(valueExpression);
        expect(valueExpression.getValue(elContext)).andReturn(null);
        expect(component.getAttributes()).andReturn(attributes);

        facesEnvironment.replay();

        // when
        Object evaluated = RenderKitUtils.evaluateAttribute("value", component, facesContext);
View Full Code Here

        attributes.put("value", attributeValue);
        ELContext elContext = facesEnvironment.getElContext();

        ValueExpression valueExpression = facesEnvironment.createMock(ValueExpression.class);

        UIComponent component = createMockComponent();

        expect(facesContext.getELContext()).andReturn(elContext);
        expect(component.getValueExpression("value")).andReturn(valueExpression);
        expect(valueExpression.getValue(elContext)).andReturn(valueExpressionValue);

        facesEnvironment.replay();

        // when
View Full Code Here

            @Override
            public void handle() {
                assertEquals(getVarValue(), data.get(getAndIncrement()));
            }
        };
        UIComponent child = createCallbackComponent(childCallback);
        child.setId("child");

        TestCallback facetCallback = new TestCallback() {
            @Override
            public void handle() {
                assertEquals(getVarValue(), data.get(getAndIncrement()));
            }
        };
        UIComponent facet = createCallbackComponent(facetCallback);
        child.getFacets().put("f", facet);
        facet.setId("facet");

        TestCallback immediateFacetCallback = new TestCallback() {
            @Override
            public void handle() {
                getAndIncrement();
                assertNull(getVarValue());
            }
        };
        UIComponent immediateFacet = createCallbackComponent(immediateFacetCallback);
        immediateFacet.setId("immediateFacet");

        mockDataAdaptor.getChildren().add(child);
        mockDataAdaptor.getFacets().put("facet", immediateFacet);

        mockDataAdaptor.processDecodes(facesContext);
View Full Code Here

            throw new NullPointerException();
        }

        // if the clientId is not yet set
        if (this.clientId == null) {
            UIComponent namingContainerAncestor = this.getNamingContainer();
            String parentId = null;

            // give the parent the opportunity to first
            // grab a unique clientId
            if (namingContainerAncestor != null) {
                parentId = namingContainerAncestor.getContainerClientId(context);
            }

            // now resolve our own client id
            String clientId = getId();
            if (clientId == null) {
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.