Package org.apache.tapestry.internal.event.impl

Examples of org.apache.tapestry.internal.event.impl.ComponentEventInvoker


    public void test_Rewind_Extra_Reserved_Ids(FormSupportFactory factory)
    {
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
        IValidationDelegate delegate = newDelegate();
        ComponentEventInvoker invoker =
          org.easymock.classextension.EasyMock.createMock(ComponentEventInvoker.class);

        MockForm form = new MockForm(delegate);

        trainIsRewound(cycle, form, true);

        trainGetPageRenderSupport(cycle, null);

        replay();

        final FormSupport fs = factory.createFormSupport(writer, cycle, form);

        verify();

        delegate.clear();

        trainCycleForRewind(cycle, "action_0", "action");

        final IFormComponent component = newFormComponent("action", "action_0");

        IRender body = newComponentRenderBody(fs, component, writer);

        form.setBody(body);
        form.setEventInvoker(invoker);

        trainExtractBrowserEvent(cycle);

        invoker.invokeFormListeners(eq(fs), eq(cycle), isA(BrowserEvent.class));

        replay();

        assertEquals(FormConstants.SUBMIT_NORMAL, fs.rewind());
View Full Code Here


    {
        Location l = newLocation();
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
        IValidationDelegate delegate = newDelegate();
        ComponentEventInvoker invoker = org.easymock.classextension.EasyMock.createMock(ComponentEventInvoker.class);

        MockForm form = new MockForm(delegate, l);

        trainIsRewound(cycle, form, true);
        trainGetPageRenderSupport(cycle, null);

        replay();

        final FormSupport fs = factory.createFormSupport(writer, cycle, form);

        verify();

        delegate.clear();

        // So, the scenario here is that component "barney" was inside
        // some kind of loop that executed twice on the render, but only once
        // on the rewind (i.e., the object was deleted in between).

        trainCycleForRewind(cycle, "barney,wilma,barney$0", null);

        final IFormComponent barney1 = newFormComponent("barney", "barney");
        final IFormComponent wilma = newFormComponent("wilma", "wilma");

        IRender body = newComponentsRenderBody(fs, new IFormComponent[]{barney1, wilma}, writer);

        form.setBody(body);
        form.setEventInvoker(invoker);

        trainExtractBrowserEvent(cycle);

        invoker.invokeFormListeners(eq(fs), eq(cycle), isA(BrowserEvent.class));

        replay();

        try {
            fs.rewind();
View Full Code Here

    {
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
        IValidationDelegate delegate = newDelegate();
        MockForm form = new MockForm(delegate);
        ComponentEventInvoker invoker =
          org.easymock.classextension.EasyMock.createMock(ComponentEventInvoker.class);

        trainIsRewound(cycle, form, true);

        trainGetPageRenderSupport(cycle, null);

        replay();

        final FormSupport fs = factory.createFormSupport(writer, cycle, form);

        verify();

        delegate.clear();

        trainCycleForRewind(cycle, "barney", null);

        final IFormComponent component = newFormComponent("barney", "barney");

        IRender body = newComponentRenderBody(fs, component, writer);

        form.setBody(body);
        form.setEventInvoker(invoker);

        trainExtractBrowserEvent(cycle);

        invoker.invokeFormListeners(eq(fs), eq(cycle), isA(BrowserEvent.class));

        replay();

        assertEquals(FormConstants.SUBMIT_NORMAL, fs.rewind());
View Full Code Here

    {
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
        IValidationDelegate delegate = newDelegate();
        MockForm form = new MockForm(delegate);
        ComponentEventInvoker invoker =
          org.easymock.classextension.EasyMock.createMock(ComponentEventInvoker.class);

        trainIsRewound(cycle, form, true);

        trainGetPageRenderSupport(cycle, null);

        replay();

        final FormSupport fs = factory.createFormSupport(writer, cycle, form);

        verify();

        delegate.clear();

        trainCycleForRewind(cycle, "", null);
        trainExtractBrowserEvent(cycle);

        writer.print("DEFERRED");

        invoker.invokeFormListeners(eq(fs), eq(cycle), isA(BrowserEvent.class));

        replay();

        IRender body = new IRender() {
View Full Code Here

    {
        EnhancementOperation op = newOp();
        IComponentSpecification spec = new ComponentSpecification();
        Resource resource = newResource(AnnotatedPage.class);
       
        IComponentEventInvoker invoker = new ComponentEventInvoker();
       
        EventListenerAnnotationWorker worker = new EventListenerAnnotationWorker();
        worker.setInvoker(invoker);
       
        replay();
       
        Method m = findMethod(AnnotatedPage.class, "eventListener");
       
        assertTrue(worker.canEnhance(m));
        assertFalse(worker.canEnhance(findMethod(AnnotatedPage.class, "getPersistentProperty")));
        worker.peformEnhancement(op, spec, m, resource);
       
        verify();
       
        assertEquals(1, invoker.getEventListeners("email").size());
       
        ComponentEventProperty property = spec.getComponentEvents("email");
        assertNotNull(property);
       
        List listeners = property.getEventListeners("onClick");
View Full Code Here

    public void test_Form_Event_Connection()
    {
        EnhancementOperation op = newOp();
        IComponentSpecification spec = new ComponentSpecification();
        Resource resource = newResource(AnnotatedPage.class);
        IComponentEventInvoker invoker = new ComponentEventInvoker();
       
        EventListenerAnnotationWorker worker = new EventListenerAnnotationWorker();
        worker.setInvoker(invoker);
       
        replay();
       
        Method m = findMethod(AnnotatedPage.class, "formListener");
       
        assertTrue(worker.canEnhance(m));
        worker.peformEnhancement(op, spec, m, resource);
       
        verify();
       
        assertEquals(1, invoker.getEventListeners("email").size());
        assertEquals(1, invoker.getFormEventListeners("testForm").size());
       
        ComponentEventProperty property = spec.getComponentEvents("email");
        assertNotNull(property);
       
        List listeners = property.getFormEventListeners("onClick");
View Full Code Here

    {
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
        IValidationDelegate delegate = newDelegate();
        MockForm form = new MockForm(delegate);
        ComponentEventInvoker invoker = org.easymock.classextension.EasyMock.createMock(ComponentEventInvoker.class);
       
        trainIsRewound(cycle, form, true);

        trainGetPageRenderSupport(cycle, null);

        replay();

        final FormSupport fs = newFormSupport(writer, cycle, form);

        verify();

        delegate.clear();

        trainCycleForRewind(cycle, "refresh", "barney", null);

        final IFormComponent component = newFormComponent("barney", "barney");

        IRender body = newComponentRenderBody(fs, component, writer);

        form.setBody(body);
        form.setEventInvoker(invoker);
       
        trainExtractBrowserEvent(cycle);
       
        invoker.invokeFormListeners(eq(fs), eq(cycle), isA(BrowserEvent.class));
       
        replay();

        assertEquals(FormConstants.SUBMIT_REFRESH, fs.rewind());
View Full Code Here

    public void test_Rewind_Extra_Reserved_Ids()
    {
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
        IValidationDelegate delegate = newDelegate();
        ComponentEventInvoker invoker =
            org.easymock.classextension.EasyMock.createMock(ComponentEventInvoker.class);
       
        MockForm form = new MockForm(delegate);

        trainIsRewound(cycle, form, true);

        trainGetPageRenderSupport(cycle, null);

        replay();

        final FormSupport fs = newFormSupport(writer, cycle, form);

        verify();

        delegate.clear();

        trainCycleForRewind(cycle, "action_0", "action");

        final IFormComponent component = newFormComponent("action", "action_0");

        IRender body = newComponentRenderBody(fs, component, writer);

        form.setBody(body);
        form.setEventInvoker(invoker);
       
        trainExtractBrowserEvent(cycle);
       
        invoker.invokeFormListeners(eq(fs), eq(cycle), isA(BrowserEvent.class));
       
        replay();

        assertEquals(FormConstants.SUBMIT_NORMAL, fs.rewind());
View Full Code Here

    {
        Location l = newLocation();
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
        IValidationDelegate delegate = newDelegate();
        ComponentEventInvoker invoker =
            org.easymock.classextension.EasyMock.createMock(ComponentEventInvoker.class);
       
        MockForm form = new MockForm(delegate, l);

        trainIsRewound(cycle, form, true);
        trainGetPageRenderSupport(cycle, null);

        replay();

        final FormSupport fs = newFormSupport(writer, cycle, form);

        verify();

        delegate.clear();

        // So, the scenario here is that component "barney" was inside
        // some kind of loop that executed twice on the render, but only once
        // on the rewind (i.e., the object was deleted in between).

        trainCycleForRewind(cycle, "barney,wilma,barney$0", null);

        final IFormComponent barney1 = newFormComponent("barney", "barney");
        final IFormComponent wilma = newFormComponent("wilma", "wilma");

        IRender body = newComponentsRenderBody(fs, new IFormComponent[]
        { barney1, wilma }, writer);

        form.setBody(body);
        form.setEventInvoker(invoker);
       
        trainExtractBrowserEvent(cycle);
       
        invoker.invokeFormListeners(eq(fs), eq(cycle), isA(BrowserEvent.class));
       
        replay();

        try
        {
View Full Code Here

    {
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
        IValidationDelegate delegate = newDelegate();
        MockForm form = new MockForm(delegate);
        ComponentEventInvoker invoker =
            org.easymock.classextension.EasyMock.createMock(ComponentEventInvoker.class);
       
        trainIsRewound(cycle, form, true);

        trainGetPageRenderSupport(cycle, null);

        replay();

        final FormSupport fs = newFormSupport(writer, cycle, form);

        verify();

        delegate.clear();

        trainCycleForRewind(cycle, "barney", null);

        final IFormComponent component = newFormComponent("barney", "barney");

        IRender body = newComponentRenderBody(fs, component, writer);

        form.setBody(body);
        form.setEventInvoker(invoker);
       
        trainExtractBrowserEvent(cycle);
       
        invoker.invokeFormListeners(eq(fs), eq(cycle), isA(BrowserEvent.class));
       
        replay();

        assertEquals(FormConstants.SUBMIT_NORMAL, fs.rewind());
View Full Code Here

TOP

Related Classes of org.apache.tapestry.internal.event.impl.ComponentEventInvoker

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.