Package org.apache.tapestry.spec

Examples of org.apache.tapestry.spec.ComponentSpecification


        assertEquals(p.getFormEvents().size(), 1);
    }

    public void test_Get_Event_Property_Listeners()
    {
        IComponentSpecification spec = new ComponentSpecification();
        spec.setComponentClassName("first.test");
        spec.addEventListener("comp1", new String[] {"onClick"}, "testFoo", null, false, true, false, false);
        spec.addEventListener("comp1", new String[] {"onClick"}, "testBar", null, false, true, false, false);

        IComponentSpecification spec2 = new ComponentSpecification();
        spec.setComponentClassName("second.test"); // to make .equals unique
        spec2.addEventListener("comp1", new String[] {"onClick"}, "testFoo", null, false, true, false, false);
        spec2.addEventListener("comp1", new String[] {"onClick"}, "testBar", null, false, true, false, false);

        ComponentEventInvoker invoker = new ComponentEventInvoker();
        invoker.addEventListener("comp1", spec);
        invoker.addEventListener("comp1", spec2);
View Full Code Here


        IPage page = newMock(IPage.class);
        ListenerInvoker listenerInvoker = newMock(ListenerInvoker.class);
        ListenerMap listenerMap = newMock(ListenerMap.class);
        IActionListener listener1 = newMock(IActionListener.class);

        IComponentSpecification spec = new ComponentSpecification();
       
        Map comps = new HashMap();
        comps.put("testId", comp);
       
        Map tprops = new HashMap();
        tprops.put("id", "testId");
        BrowserEvent event = new BrowserEvent("onSelect", new EventTarget(tprops));
       
        ComponentEventInvoker invoker = new ComponentEventInvoker();
        invoker.setInvoker(listenerInvoker);
       
        spec.addEventListener("testId", new String[] { "onSelect" },
                "fooListener", null, false, false, false, false);
        invoker.addEventListener("testId", spec);

        expect(comp.getExtendedId()).andReturn("testId").anyTimes();
        expect(comp.getSpecification()).andReturn(spec).anyTimes();
View Full Code Here

        IRequestCycle cycle = newCycle();
        IComponent comp = newComponent();
        checkOrder(comp, false);
       
        IPage page = newMock(IPage.class);
        IComponentSpecification spec = new ComponentSpecification();
       
        ListenerInvoker listenerInvoker = newMock(ListenerInvoker.class);
        ListenerMap listenerMap = newMock(ListenerMap.class);
        IActionListener listener = newMock(IActionListener.class);
       
        Map comps = new HashMap();
        comps.put("testId", comp);
       
        Map tprops = new HashMap();
        tprops.put("id", "testId");
        BrowserEvent event = new BrowserEvent("onSelect", new EventTarget(tprops));
       
        ComponentEventInvoker invoker = new ComponentEventInvoker();
        invoker.setInvoker(listenerInvoker);
       
        spec.addElementEventListener("testId", new String[] { "onSelect" },
                "fooListener", null, false, true, true);
        invoker.addEventListener("testId", spec);
       
        expect(comp.getExtendedId()).andReturn("testId").anyTimes();
        expect(comp.getSpecification()).andReturn(spec).anyTimes();
View Full Code Here

    {
        IRequestCycle cycle = newCycle();
        IForm form = newForm();
        checkOrder(form, false);
        FormSupport formSupport = newMock(FormSupport.class);
        IComponentSpecification spec = new ComponentSpecification();
        IValidationDelegate delegate = newMock(IValidationDelegate.class);
        ListenerInvoker listenerInvoker = newMock(ListenerInvoker.class);
        ListenerMap listenerMap = newMock(ListenerMap.class);
        IActionListener listener = newMock(IActionListener.class);
        IPage page = newMock(IPage.class);
        checkOrder(page, false);
       
        Map comps = new HashMap();
        comps.put("form1", form);
       
        Map tprops = new HashMap();
        tprops.put("id", "form1");
        BrowserEvent event = new BrowserEvent("onSelect", new EventTarget(tprops));
       
        ComponentEventInvoker invoker = new ComponentEventInvoker();
        invoker.setInvoker(listenerInvoker);
       
        spec.addEventListener("form1", new String[] { "onSelect" }, "fooListener",
                "form1", false, false, false, false);
        invoker.addFormEventListener("form1", spec);
       
        expect(formSupport.getForm()).andReturn(form);
        expect(form.getExtendedId()).andReturn("form1").anyTimes();
View Full Code Here

    {
        IRequestCycle cycle = newCycle();
        IForm form = newForm();
        checkOrder(form, false);
        FormSupport formSupport = newMock(FormSupport.class);
        IComponentSpecification spec = new ComponentSpecification();
        IValidationDelegate delegate = newMock(IValidationDelegate.class);
       
        ListenerInvoker listenerInvoker = newMock(ListenerInvoker.class);
        ListenerMap listenerMap = newMock(ListenerMap.class);
        IActionListener listener = newMock(IActionListener.class);
        IPage page = newMock(IPage.class);
        checkOrder(page, false);
       
        Map comps = new HashMap();
        comps.put("form1", form);
       
        Map tprops = new HashMap();
        tprops.put("id", "form1");
        BrowserEvent event = new BrowserEvent("onSelect", new EventTarget(tprops));
       
        ComponentEventInvoker invoker = new ComponentEventInvoker();
        invoker.setInvoker(listenerInvoker);
       
        spec.addEventListener("form1", new String[] { "onSelect" }, "fooListener",
                "form1", false, false, true, false);
        invoker.addFormEventListener("form1", spec);
       
        expect(formSupport.getForm()).andReturn(form);
        expect(form.getExtendedId()).andReturn("form1").anyTimes();
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

        IForm form = new MockForm(delegate);
        IMarkupWriter writer = newBufferWriter();

        IBinding binding = newMock(IBinding.class);
        Location l = newLocation();
        ComponentSpecification spec = new ComponentSpecification();
       
        Suggest comp = newInstance(Suggest.class,
                                   "response", resp,
                                   "templateTagName", "input",
                                   "name", "suggest",
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

        assertEquals(p.getFormEvents().size(), 1);
    }

    public void test_Get_Event_Property_Listeners()
    {
        IComponentSpecification spec = new ComponentSpecification();
        spec.setComponentClassName("first.test");
        spec.addEventListener("comp1", new String[] {"onClick"}, "testFoo", null, false, true, false, false);
        spec.addEventListener("comp1", new String[] {"onClick"}, "testBar", null, false, true, false, false);

        IComponentSpecification spec2 = new ComponentSpecification();
        spec.setComponentClassName("second.test"); // to make .equals unique
        spec2.addEventListener("comp1", new String[] {"onClick"}, "testFoo", null, false, true, false, false);
        spec2.addEventListener("comp1", new String[] {"onClick"}, "testBar", null, false, true, false, false);

        ComponentEventInvoker invoker = new ComponentEventInvoker();
        invoker.addEventListener("comp1", spec);
        invoker.addEventListener("comp1", spec2);
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.