Package org.apache.tapestry.dojo

Examples of org.apache.tapestry.dojo.IWidget


        worker.setElementScript(elemScript);
        worker.setEventEngine(engine);
        worker.setScriptSource(scriptSource);
       
        IDirectEvent component = newMock(IDirectEvent.class);
        IWidget widget = newMock(IWidget.class);
       
        assertNotNull(worker.getScript(component));
        assertEquals(compScript, worker.getScript(component).getPath());
       
        assertNotNull(worker.getScript(widget));
        assertEquals(widScript, worker.getScript(widget).getPath());
       
        assertNotNull(worker.getElementScript());
        assertEquals(elemScript, worker.getElementScript().getPath());
       
        // now test render
        invoker.addEventListener("comp1", spec);
        spec.addEventListener("comp1", new String[] {"onclick"}, "testMethod", null, false, true, false, false);
        spec.addElementEventListener("elementId", new String[] {"onclick"}, "testMethod", null, false, true, false);
       
        /////////////////////////////////
       
        Map elmEvents = spec.getElementEvents();
        Iterator keyIt = elmEvents.keySet().iterator();
       
        while (keyIt.hasNext()) {
            String elem = (String)keyIt.next();
            assertEquals(elem, "elementId");
           
            ComponentEventProperty prop = (ComponentEventProperty)elmEvents.get(elem);
            assertNotNull(prop);
           
            Object[][] events = worker.getEvents(prop, elem);
           
            assertNotNull(events);
            assertEquals(events.length, 1);
            assertEquals(events[0].length, 2);
        }
       
        ////////////////////////////////////////////
       
        expect(cycle.isRewinding()).andReturn(false);
        expect(cycle.getAttribute(TapestryUtils.FIELD_PRERENDER)).andReturn(null);
       
        expect(component.getExtendedId()).andReturn("comp1").anyTimes();
        expect(component.getClientId()).andReturn("comp1").anyTimes();
       
        expect(cycle.getAttribute(TapestryUtils.PAGE_RENDER_SUPPORT_ATTRIBUTE)).andReturn(prs).anyTimes();
        expect(component.getSpecification()).andReturn(spec);
       
        trainGetLinkCheckIgnoreParameter(engine, cycle, false, new Object(), link);
        trainGetURL(link, "/some/url");
       
        expect(scriptSource.getScript(compScriptResource)).andReturn(script);
        script.execute(eq(component), eq(cycle), eq(prs), isA(Map.class));
       
        expect(component.getSpecification()).andReturn(spec);
       
        trainGetLinkCheckIgnoreParameter(engine, cycle, false, new Object(), link);
        trainGetURL(link, "/some/url");
       
        expect(scriptSource.getScript(elemScriptResource)).andReturn(script);
       
        script.execute(eq(component), eq(cycle), eq(prs), isA(Map.class));
       
        replay();
       
        worker.renderComponent(cycle, component);
       
        verify();
       
        assertEquals(0, worker.getDefferedFormConnections().size());
       
        // test widget render
       
        invoker.addEventListener("wid1", widgetSpec);
        widgetSpec.addEventListener("wid1", new String[] {"onclick"}, "testMethod", null, false, true, false, false);
       
        checkOrder(cycle, false);
        expect(cycle.isRewinding()).andReturn(false);
        expect(cycle.getAttribute(TapestryUtils.PAGE_RENDER_SUPPORT_ATTRIBUTE)).andReturn(prs).anyTimes();
       
        expect(widget.getSpecification()).andReturn(widgetSpec);
       
        expect(cycle.getAttribute(TapestryUtils.FIELD_PRERENDER)).andReturn(null);
       
        expect(widget.getExtendedId()).andReturn("wid1").anyTimes();
        expect(widget.getClientId()).andReturn("wid1").anyTimes();
       
        assert widgetSpec.getComponentEvents("wid1") != null;
       
        trainGetLinkCheckIgnoreParameter(engine, cycle, false, new Object(), link);
        trainGetURL(link, "/some/url2");
View Full Code Here


        worker.setComponentScript(compScript);
        worker.setWidgetScript(widScript);
        worker.setElementScript(elementScript);
       
        IDirectEvent component = newMock(IDirectEvent.class);
        IWidget widget = newMock(IWidget.class);
       
        MockControl bodyControl = MockClassControl.createControl(Body.class);
        Body body = (Body) bodyControl.getMock();
       
        assertNotNull(worker.getScript(component));
View Full Code Here

        worker.setElementScript(elemScript);
        worker.setEventEngine(engine);
        worker.setScriptSource(scriptSource);
       
        IDirectEvent component = newMock(IDirectEvent.class);
        IWidget widget = newMock(IWidget.class);
       
        assertNotNull(worker.getScript(component));
        assertEquals(compScript, worker.getScript(component).getPath());
       
        assertNotNull(worker.getScript(widget));
        assertEquals(widScript, worker.getScript(widget).getPath());
       
        assertNotNull(worker.getElementScript());
        assertEquals(elemScript, worker.getElementScript().getPath());
       
        // now test render
        invoker.addEventListener("comp1", spec);
        spec.addEventListener("comp1", new String[] {"onclick"}, "testMethod", null, false, true, false);
        spec.addElementEventListener("elementId", new String[] {"onclick"}, "testMethod", null, false, true, false);
       
        /////////////////////////////////
       
        Map elmEvents = spec.getElementEvents();
        Iterator keyIt = elmEvents.keySet().iterator();
       
        while (keyIt.hasNext()) {
            String elem = (String)keyIt.next();
            assertEquals(elem, "elementId");
           
            ComponentEventProperty prop = (ComponentEventProperty)elmEvents.get(elem);
            assertNotNull(prop);
           
            Object[][] events = worker.getEvents(prop, elem);
           
            assertNotNull(events);
            assertEquals(events.length, 1);
            assertEquals(events[0].length, 2);
        }
       
        ////////////////////////////////////////////
       
        expect(cycle.isRewinding()).andReturn(false);
       
        expect(cycle.getAttribute(TapestryUtils.FIELD_PRERENDER)).andReturn(null);
       
        expect(component.getId()).andReturn("comp1").anyTimes();
        expect(component.getClientId()).andReturn("comp1").anyTimes();
       
        expect(cycle.getAttribute(TapestryUtils.PAGE_RENDER_SUPPORT_ATTRIBUTE))
        .andReturn(prs).anyTimes();
       
        expect(component.getSpecification()).andReturn(spec);
       
        trainGetLinkCheckIgnoreParameter(engine, cycle, false, new Object(), link);
        trainGetURL(link, "/some/url");
       
        expect(scriptSource.getScript(compScriptResource)).andReturn(script);
       
        script.execute(eq(component), eq(cycle), eq(prs), isA(Map.class));
       
        expect(component.getSpecification()).andReturn(spec);
       
        trainGetLinkCheckIgnoreParameter(engine, cycle, false, new Object(), link);
       
        trainGetURL(link, "/some/url");
       
        expect(scriptSource.getScript(elemScriptResource)).andReturn(script);
       
        script.execute(eq(component), eq(cycle), eq(prs), isA(Map.class));
       
        replay();
       
        worker.renderComponent(cycle, component);
       
        verify();
       
        assertEquals(0, worker.getDefferedFormConnections().size());
       
        // test widget render
       
        invoker.addEventListener("wid1", widgetSpec);
        widgetSpec.addEventListener("wid1", new String[] {"onclick"}, "testMethod", null, false, true, false);
       
        checkOrder(cycle, false);
        expect(cycle.isRewinding()).andReturn(false);
       
        expect(cycle.getAttribute(TapestryUtils.PAGE_RENDER_SUPPORT_ATTRIBUTE))
        .andReturn(prs).anyTimes();
       
        expect(widget.getSpecification()).andReturn(widgetSpec);
       
        expect(cycle.getAttribute(TapestryUtils.FIELD_PRERENDER)).andReturn(null);
       
        expect(widget.getId()).andReturn("wid1").anyTimes();
        expect(widget.getClientId()).andReturn("wid1").anyTimes();
       
        assertTrue(widgetSpec.hasEvents("wid1"));
       
        trainGetLinkCheckIgnoreParameter(engine, cycle, false, new Object(), link);
        trainGetURL(link, "/some/url2");
View Full Code Here

        worker.setComponentScript(compScript);
        worker.setWidgetScript(widScript);
        worker.setElementScript(elementScript);
       
        IDirectEvent component = newMock(IDirectEvent.class);
        IWidget widget = newMock(IWidget.class);
        MockControl bodyControl = MockClassControl.createControl(Body.class);
        Body body = (Body) bodyControl.getMock();
       
        assertNotNull(worker.getScript(component));
        assertEquals(compScript, worker.getScript(component).getPath());
View Full Code Here

        worker.setElementScript(elemScript);
        worker.setEventEngine(engine);
        worker.setScriptSource(scriptSource);
       
        IDirectEvent component = newMock(IDirectEvent.class);
        IWidget widget = newMock(IWidget.class);
       
        assertNotNull(worker.getScript(component));
        assertEquals(compScript, worker.getScript(component).getPath());
       
        assertNotNull(worker.getScript(widget));
        assertEquals(widScript, worker.getScript(widget).getPath());
       
        assertNotNull(worker.getElementScript());
        assertEquals(elemScript, worker.getElementScript().getPath());
       
        // now test render
        invoker.addEventListener("comp1", spec);
        spec.addEventListener("comp1", new String[] {"onclick"}, "testMethod", null, false, true, false, false);
        spec.addElementEventListener("elementId", new String[] {"onclick"}, "testMethod", null, false, true, false);
       
        /////////////////////////////////
       
        Map elmEvents = spec.getElementEvents();
        Iterator keyIt = elmEvents.keySet().iterator();
       
        while (keyIt.hasNext())
        {
            String elem = (String)keyIt.next();
            assertEquals(elem, "elementId");
           
            ComponentEventProperty prop = (ComponentEventProperty)elmEvents.get(elem);
            assertNotNull(prop);
           
            Object[][] events = worker.getEvents(prop, elem);
           
            assertNotNull(events);
            assertEquals(events.length, 1);
            assertEquals(events[0].length, 2);
        }
       
        ////////////////////////////////////////////
       
        expect(cycle.isRewinding()).andReturn(false);
        expect(cycle.getAttribute(TapestryUtils.FIELD_PRERENDER)).andReturn(null);
       
        expect(component.getExtendedId()).andReturn("comp1").anyTimes();
        expect(component.getClientId()).andReturn("comp1").anyTimes();
       
        expect(cycle.getAttribute(TapestryUtils.PAGE_RENDER_SUPPORT_ATTRIBUTE)).andReturn(prs).anyTimes();
        expect(component.getSpecification()).andReturn(spec);
       
        trainGetLinkCheckIgnoreParameter(engine, cycle, false, new Object(), link);
        trainGetURL(link, "/some/url");
       
        expect(scriptSource.getScript(compScriptResource)).andReturn(script);
        script.execute(eq(component), eq(cycle), eq(prs), isA(Map.class));
       
        expect(component.getSpecification()).andReturn(spec);
       
        trainGetLinkCheckIgnoreParameter(engine, cycle, false, new Object(), link);
        trainGetURL(link, "/some/url");
       
        expect(scriptSource.getScript(elemScriptResource)).andReturn(script);
        script.execute(eq(component), eq(cycle), eq(prs), isA(Map.class));
       
        replay();
       
        worker.renderComponent(cycle, component);
       
        verify();
       
        assertEquals(0, worker.getDefferedFormConnections().size());
       
        // test widget render
       
        invoker.addEventListener("wid1", widgetSpec);
        widgetSpec.addEventListener("wid1", new String[] {"onclick"}, "testMethod", null, false, true, false, false);
       
        checkOrder(cycle, false);
        expect(cycle.isRewinding()).andReturn(false);
        expect(cycle.getAttribute(TapestryUtils.PAGE_RENDER_SUPPORT_ATTRIBUTE)).andReturn(prs).anyTimes();
       
        expect(widget.getSpecification()).andReturn(widgetSpec);
        expect(cycle.getAttribute(TapestryUtils.FIELD_PRERENDER)).andReturn(null);
       
        expect(widget.getExtendedId()).andReturn("wid1").anyTimes();
        expect(widget.getClientId()).andReturn("wid1").anyTimes();
       
        assert widgetSpec.getComponentEvents("wid1") != null;
       
        trainGetLinkCheckIgnoreParameter(engine, cycle, false, new Object(), link);
        trainGetURL(link, "/some/url2");
View Full Code Here

        worker.setComponentScript(compScript);
        worker.setWidgetScript(widScript);
        worker.setElementScript(elementScript);
       
        IDirectEvent component = newMock(IDirectEvent.class);
        IWidget widget = newMock(IWidget.class);
       
        MockControl bodyControl = MockClassControl.createControl(Body.class);
        Body body = (Body) bodyControl.getMock();
       
        assertNotNull(worker.getScript(component));
View Full Code Here

TOP

Related Classes of org.apache.tapestry.dojo.IWidget

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.