Package org.apache.tapestry.spec

Examples of org.apache.tapestry.spec.ComponentSpecification


        worker.setComponentScript(compScript);
        worker.setEventEngine(engine);
        worker.setScriptSource(scriptSource);
       
        IDirectEvent component = newMock(IDirectEvent.class);
        IComponentSpecification spec = new ComponentSpecification();
       
        IComponent comp1 = newMock(IComponent.class);
        IComponentSpecification comp1Spec = new ComponentSpecification();
       
        IComponent comp2 = newMock(IComponent.class);
        IComponentSpecification comp2Spec = new ComponentSpecification();
       
        IForm form = newMock(IForm.class);
        IComponentSpecification formSpec = new ComponentSpecification();
       
        // now test render
        spec.addEventListener("comp1", new String[] {"onclick"}, "testMethod", "form1", false, true, false, false);
        invoker.addEventListener("comp1", spec);
        invoker.addFormEventListener("form1", spec);
View Full Code Here


        worker.setEventInvoker(invoker);
        worker.setEventEngine(engine);
        worker.setScriptSource(scriptSource);
       
        IDirectEvent component = newMock(IDirectEvent.class);
        IComponentSpecification spec = new ComponentSpecification();
       
        // now test render
        invoker.addEventListener("comp1", spec);
        spec.addEventListener("comp1", new String[] {"onclick"}, "testMethod", "form1", false, false, false, false);
       
        expect(cycle.isRewinding()).andReturn(false);
       
        expect(cycle.getAttribute(TapestryUtils.PAGE_RENDER_SUPPORT_ATTRIBUTE)).andReturn(prs);
       
View Full Code Here

        IComponent comp = newMock(IComponent.class);
        checkOrder(comp, false);
        WebContext context = newMock(WebContext.class);
        IRequestCycle cycle = newMock(IRequestCycle.class);

        IComponentSpecification spec = new ComponentSpecification();
        WebContextResource base = new WebContextResource(context, "/WEB-INF/MyComponent.jwc");
        spec.setSpecificationLocation(base);
       
        ComponentResourceResolverImpl resolver = new ComponentResourceResolverImpl();

        expect(comp.getSpecification()).andReturn(spec).anyTimes();
        expect(context.getResource("/WEB-INF/MyComponent.html")).andReturn(newURL());
View Full Code Here

        IComponent comp = newMock(IComponent.class);
        checkOrder(comp, false);
        WebContext context = newMock(WebContext.class);
        IRequestCycle cycle = newMock(IRequestCycle.class);

        IComponentSpecification spec = new ComponentSpecification();
        WebContextResource base = new WebContextResource(context, "/WEB-INF/MyComponent.jwc");
        spec.setSpecificationLocation(base);

        ComponentResourceResolverImpl resolver = new ComponentResourceResolverImpl();

        expect(comp.getSpecification()).andReturn(spec).anyTimes();
        expect(context.getResource("/WEB-INF/MyComponent_en.html")).andReturn(newURL()).anyTimes();
View Full Code Here

        checkOrder(comp, false);

        INamespace namespace = newMock(INamespace.class);
        IRequestCycle cycle = newMock(IRequestCycle.class);

        IComponentSpecification spec = new ComponentSpecification();
        ClasspathResource base = new ClasspathResource(new DefaultClassResolver(), "/org/apache/tapestry/resolver/MyComponent.jwc");
        spec.setSpecificationLocation(base);
        spec.setComponentClassName("org.apache.tapestry.resolver.MyComponent");

        AssetFactory classpathFactory = newMock(AssetFactory.class);
        AssetFactory contextFactory = newMock(AssetFactory.class);
        Resource contextRoot = newMock(Resource.class);
        Resource webinfLocation = newMock(Resource.class);
View Full Code Here

        checkOrder(comp, false);

        INamespace namespace = newMock(INamespace.class);
        IRequestCycle cycle = newMock(IRequestCycle.class);

        IComponentSpecification spec = new ComponentSpecification();
        ClasspathResource base = new ClasspathResource(new DefaultClassResolver(), "/org/apache/tapestry/resolver/MyComponent.jwc");
        spec.setSpecificationLocation(base);
        spec.setComponentClassName("org.apache.tapestry.resolver.MyComponent");

        AssetFactory classpathFactory = newMock(AssetFactory.class);
        AssetFactory contextFactory = newMock(AssetFactory.class);
        Resource contextRoot = newMock(Resource.class);
        Resource webinfLocation = newMock(Resource.class);
View Full Code Here

        checkOrder(comp, false);

        INamespace namespace = newMock(INamespace.class);
        IRequestCycle cycle = newMock(IRequestCycle.class);

        IComponentSpecification spec = new ComponentSpecification();
        ClasspathResource base = new ClasspathResource(new DefaultClassResolver(), "/org/apache/tapestry/resolver/MyComponent.jwc");
        spec.setSpecificationLocation(base);
        spec.setComponentClassName("org.apache.tapestry.resolver.MyComponent");

        AssetFactory classpathFactory = newMock(AssetFactory.class);
        AssetFactory contextFactory = newMock(AssetFactory.class);
        Resource contextRoot = newMock(Resource.class);
        Resource webinfLocation = newMock(Resource.class);
View Full Code Here

    private IComponentSpecification newSpec(String path)
    {
        Resource resource = new ClasspathResource(new DefaultClassResolver(), path);

        IComponentSpecification spec = new ComponentSpecification();
        spec.setSpecificationLocation(resource);

        return spec;
    }
View Full Code Here

public class ComponentEventInvokerTest extends BaseComponentTestCase
{
   
    public void test_Event_Properties()
    {
        IComponentSpecification spec = new ComponentSpecification();
        spec.addEventListener("comp1", new String[] {"onClick"}, "testFoo", null, false, false, false, false);
       
        assert spec.getComponentEvents("comp1") != null;
        assert spec.getComponentEvents("comp1").getEvents().size() == 1;
       
        ComponentEventProperty prop = spec.getComponentEvents("comp1");
        assertNotNull(prop);
        assertEquals(prop.getEventListeners("onClick").size(), 1);
       
        prop = spec.getComponentEvents("comp2");
        assert prop == null;
    }
View Full Code Here

        assert prop == null;
    }
   
    public void test_Form_Event_Properties()
    {
        IComponentSpecification spec = new ComponentSpecification();
        spec.addEventListener("comp1", new String[] {"onClick"}, "testFoo", "form", false, true, false, false);
        spec.addEventListener("comp1", new String[] {"onClick"}, "testBar", "form", false, true, false, false);
       
        assert spec.getComponentEvents("comp1") != null;
       
        ComponentEventProperty p = spec.getComponentEvents("comp1");
       
        // should be only form events bound
        assertEquals(p.getEvents().size(), 0);
        assertEquals(p.getEventListeners("onClick").size(), 0);
       
View Full Code Here

TOP

Related Classes of org.apache.tapestry.spec.ComponentSpecification

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.