Package org.apache.tapestry.listener

Examples of org.apache.tapestry.listener.ListenerMap$SyntheticListener


    }

    public void testListenerMethods()
    {
        Listener l = new Listener();
        ListenerMap m = new ListenerMap(l);

        attempt("actualListenerMethod", l, m);
        attempt("listenerThrows", l, m);
    }
View Full Code Here


    }

    public void testListenerNames()
    {
        Listener l = new Listener();
        ListenerMap m = new ListenerMap(l);

        List names = new ArrayList(m.getListenerNames());
        Collections.sort(names);

        checkList(
                "Method names.",
                new String[]
View Full Code Here

    }

    public void testSubclassMethods()
    {
        Listener l = new ListenerSubclass();
        ListenerMap m = new ListenerMap(l);

        attempt("actualListenerMethod", l, m);
        attempt("listenerThrows", l, m);
        attempt("subclassMethod", l, m);
    }
View Full Code Here

    }

    public void testSubclassListenerNames()
    {
        Listener l = new ListenerSubclass();
        ListenerMap m = new ListenerMap(l);

        List names = new ArrayList(m.getListenerNames());
        Collections.sort(names);

        checkList("Method names.", new String[]
        { "actualListenerMethod", "invokeAndThrow", "invokeAndThrowRuntime", "listenerThrows",
                "subclassMethod" }, names);
View Full Code Here

    }

    public void testInvokeAndThrow() throws Exception
    {
        Listener l = new ListenerSubclass();
        ListenerMap m = new ListenerMap(l);
        IActionListener listener = (IActionListener) m.getListener("invokeAndThrow");

        try
        {
            listener.actionTriggered(null, null);
View Full Code Here

    }

    public void testInvokeAndThrowRuntime() throws Exception
    {
        Listener l = new ListenerSubclass();
        ListenerMap m = new ListenerMap(l);
        IActionListener listener = (IActionListener) m.getListener("invokeAndThrowRuntime");

        try
        {
            listener.actionTriggered(null, null);
View Full Code Here

    }

    public void testToString() throws Exception
    {
        Listener l = new Listener();
        ListenerMap m = new ListenerMap(l);

        IActionListener listener = (IActionListener) m.getListener("actualListenerMethod");

        assertEquals(
                "ToString",
                "SyntheticListener[TestListenerMap.Listener[0] public void org.apache.tapestry.junit.TestListenerMap$Listener.actualListenerMethod(org.apache.tapestry.IRequestCycle)]",
                listener.toString());

        assertEquals("ToString", "ListenerMap[TestListenerMap.Listener[0]]", m.toString());
    }
View Full Code Here

    }

    public void testIsCached() throws Exception
    {
        Listener l = new Listener();
        ListenerMap m = new ListenerMap(l);

        IActionListener listener = (IActionListener) m.getListener("actualListenerMethod");

        assertSame("Listener", listener, m.getListener("actualListenerMethod"));
    }
View Full Code Here

    {
        MockControl cc = newControl(IComponent.class);
        IComponent component = (IComponent) cc.getMock();

        MockControl lmc = newControl(ListenerMap.class);
        ListenerMap lm = (ListenerMap) lmc.getMock();

        Object listener = "LISTENER";

        component.getListeners();
        cc.setReturnValue(lm);

        lm.getListener("foo");
        lmc.setReturnValue(listener);

        ValueConverter vc = newValueConverter();

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

        expect(page.getComponents()).andReturn(comps);
        expect(comp.getListeners()).andReturn(listenerMap);
       
        expect(listenerMap.getListener("fooListener")).andReturn(listener1);
       
        listenerInvoker.invokeListener(listener1, comp, cycle);
       
        replay();
       
View Full Code Here

TOP

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

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.