Package org.apache.tapestry.listener

Examples of org.apache.tapestry.listener.ListenerInvoker


        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.getId()).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();
       
        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

        IForm form = newForm();
        checkOrder(form, false);
        FormSupport formSupport = newMock(FormSupport.class);
        IComponentSpecification spec = new ComponentSpecification();
       
        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 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();

        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 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();

        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

        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
        FormSupport support = newFormSupport();
        IValidationDelegate delegate = newDelegate();
        IActionListener listener = newListener();
        ListenerInvoker invoker = newListenerInvoker();

        Form form = newInstance(FormFixture.class, new Object[]
        { "id", "myform", "expectedWriter", writer, "expectedRequestCycle", cycle,
                "formSupport", support, "listener", listener, "listenerInvoker", invoker,
                "delegate", delegate });

        expect(cycle.renderStackPush(form)).andReturn(form);
       
        trainStoreForm(cycle, form);
       
        trainIsRewinding(support, true);
       
        expect(support.rewind()).andReturn(FormConstants.SUBMIT_NORMAL);
       
        expect(delegate.getHasErrors()).andReturn(false);

        invoker.invokeListener(listener, form, cycle);
       
        TapestryUtils.removeForm(cycle);
       
        delegate.setFormComponent(null);
       
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 Object[])
          {
            cycle.setListenerParameters((Object[]) parameters);
          }
            else 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

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.