Package org.apache.tapestry.listener

Examples of org.apache.tapestry.listener.ListenerInvoker


        final IActionListener action = getAction();

        if (listener == null && action == null)
            return;

        final ListenerInvoker listenerInvoker = getListenerInvoker();

        Object parameters = getParameters();
        if (parameters != null)
        {
            if (parameters instanceof Collection)
            {
                cycle.setListenerParameters(((Collection) parameters).toArray());
            }
            else
            {
                cycle.setListenerParameters(new Object[]
                { parameters });
            }
        }
       
        // Invoke 'listener' now, but defer 'action' for later
        if (listener != null)
            listenerInvoker.invokeListener(listener, AbstractSubmit.this, cycle);
       
        if (action != null) {
            Runnable notify = new Runnable()
            {
                public void run()
                {
                    listenerInvoker.invokeListener(action, AbstractSubmit.this, cycle);
                }
            };

            form.addDeferredRunnable(notify);
        }
View Full Code Here


        final IActionListener listener = getListener();

        if (listener == null)
            return;

        final ListenerInvoker listenerInvoker = getListenerInvoker();

        Object parameters = getParameters();
        if (parameters != null)
        {
            if (parameters instanceof Collection)
            {
                cycle.setListenerParameters(((Collection) parameters).toArray());
            }
            else
            {
                cycle.setListenerParameters(new Object[]
                { parameters });
            }
        }

        // Have a listener; notify it now, or defer for later?

        Runnable notify = new Runnable()
        {
            public void run()
            {
                listenerInvoker.invokeListener(listener, AbstractSubmit.this, cycle);
            }
        };

        if (getDefer())
            form.addDeferredRunnable(notify);
View Full Code Here

        final IActionListener action = getAction();

        if (listener == null && action == null)
            return;

        final ListenerInvoker listenerInvoker = getListenerInvoker();

        Object parameters = getParameters();
        if (parameters != null)
        {
            if (parameters instanceof Collection)
            {
                cycle.setListenerParameters(((Collection) parameters).toArray());
            }
            else
            {
                cycle.setListenerParameters(new Object[] { parameters });
            }
        }
       
        // Invoke 'listener' now, but defer 'action' for later
        if (listener != null)
            listenerInvoker.invokeListener(listener, AbstractSubmit.this, cycle);
       
        if (action != null)
        {
            Runnable notify = new Runnable()
            {
                public void run()
                {
                    listenerInvoker.invokeListener(action, AbstractSubmit.this, cycle);
                }
            };

            form.addDeferredRunnable(notify);
        }
View Full Code Here

    {
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
        IValidationDelegate delegate = newDelegate();
        MockForm form = new MockForm(delegate);
        ListenerInvoker listenerInvoker = newMock(ListenerInvoker.class);
       
        ComponentEventInvoker invoker = new ComponentEventInvoker();
        invoker.setInvoker(listenerInvoker);
       
        trainIsRewound(cycle, form, true);
View Full Code Here

        IRequestCycle cycle = newCycle();
        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();
       
        invoker.invokeListeners(comp, cycle, event);
       
View Full Code Here

        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();
        expect(comp.getPage()).andReturn(page);
        expect(page.getComponents()).andReturn(comps);
        expect(comp.getListeners()).andReturn(listenerMap);
       
        expect(listenerMap.getListener("fooListener")).andReturn(listener);
       
        listenerInvoker.invokeListener(listener, comp, cycle);
       
        replay();
       
        invoker.invokeListeners(comp, cycle, event);
       
View Full Code Here

        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);
       
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);
       
View Full Code Here

        IRequestCycle cycle = newCycle();
        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();
       
        invoker.invokeListeners(comp, cycle, event);
       
View Full Code Here

        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();
        expect(comp.getPage()).andReturn(page);
        expect(page.getComponents()).andReturn(comps);
        expect(comp.getListeners()).andReturn(listenerMap);
       
        expect(listenerMap.getListener("fooListener")).andReturn(listener);
       
        listenerInvoker.invokeListener(listener, comp, cycle);
       
        replay();
       
        invoker.invokeListeners(comp, cycle, event);
       
View Full Code Here

TOP

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

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.