Package org.apache.tapestry.listener

Examples of org.apache.tapestry.listener.ListenerMap


    }

    public void testInvokeAndPageRedirect()
    {
        IComponent component = newComponent();
        ListenerMap map = newListenerMap();
        IActionListener listener = newListener();
        Location l = newLocation();
        ValueConverter vc = newValueConverter();
        IComponent sourceComponent = newComponent();
        IRequestCycle cycle = newCycle();
View Full Code Here


    }

    public void testInvokeAndRedirect()
    {
        IComponent component = newComponent();
        ListenerMap map = newListenerMap();
        IActionListener listener = newListener();
        Location l = newLocation();
        ValueConverter vc = newValueConverter();
        IComponent sourceComponent = newComponent();
        IRequestCycle cycle = newCycle();
View Full Code Here

    }

    public void testInvokeListenerFailure()
    {
        IComponent component = newComponent();
        ListenerMap map = newListenerMap();
        IActionListener listener = newListener();
        Location l = newLocation();
        ValueConverter vc = newValueConverter();
        IComponent sourceComponent = newComponent();
        IRequestCycle cycle = newCycle();
View Full Code Here

        IComponent comp = newComponent();
        checkOrder(comp, false);

        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 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();
        expect(comp.getPage()).andReturn(page);

        expect(page.getNestedComponent(null)).andReturn(comp);
        expect(comp.getListeners()).andReturn(listenerMap);

        expect(listenerMap.getListener("fooListener")).andReturn(listener1);

        listenerInvoker.invokeListener(listener1, comp, cycle);

        replay();
View Full Code Here

        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 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();
        expect(comp.getPage()).andReturn(page);

        expect(comp.getListeners()).andReturn(listenerMap);

        expect(listenerMap.getListener("fooListener")).andReturn(listener);

        listenerInvoker.invokeListener(listener, comp, cycle);

        replay();
View Full Code Here

        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 tprops = new HashMap();
        tprops.put("id", "form1");
        BrowserEvent event = new BrowserEvent("onSelect", "form1", "form1", 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();

        expect(form.getPage()).andReturn(page);
        expect(page.getNestedComponent(null)).andReturn(form);       
        expect(form.getDelegate()).andReturn(delegate).anyTimes();

        delegate.clearErrors();
        expectLastCall().anyTimes();

        expect(form.getListeners()).andReturn(listenerMap);
        expect(listenerMap.getListener("fooListener")).andReturn(listener);

        form.addDeferredRunnable(isA(Runnable.class));

        cycle.disableFocus();
View Full Code Here

        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", "form1", "form1", 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();

        expect(form.getPage()).andReturn(page);
        expect(page.getNestedComponent(null)).andReturn(form);
       
        expect(form.getDelegate()).andReturn(delegate).anyTimes();

        delegate.clearErrors();
        expectLastCall().anyTimes();

        expect(form.getListeners()).andReturn(listenerMap);

        expect(listenerMap.getListener("fooListener")).andReturn(listener);

        form.addDeferredRunnable(isA(Runnable.class));

        replay();
View Full Code Here

public class TestListenerMethodBinding extends BindingTestCase
{
    public void testInvokeListener()
    {
        IComponent component = newComponent();
        ListenerMap map = newListenerMap();
        IActionListener listener = newListener();
        Location l = newLocation();
        IComponent sourceComponent = newComponent();
        IRequestCycle cycle = newCycle();
        ValueConverter vc = newValueConverter();
View Full Code Here

    }

    public void testInvokeAndPageRedirect()
    {
        IComponent component = newComponent();
        ListenerMap map = newListenerMap();
        IActionListener listener = newListener();
        Location l = newLocation();
        ValueConverter vc = newValueConverter();
        IComponent sourceComponent = newComponent();
        IRequestCycle cycle = newCycle();
View Full Code Here

    }

    public void testInvokeAndRedirect()
    {
        IComponent component = newComponent();
        ListenerMap map = newListenerMap();
        IActionListener listener = newListener();
        Location l = newLocation();
        ValueConverter vc = newValueConverter();
        IComponent sourceComponent = newComponent();
        IRequestCycle cycle = newCycle();
View Full Code Here

TOP

Related Classes of org.apache.tapestry.listener.ListenerMap

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.