Package org.apache.tapestry.internal.event

Examples of org.apache.tapestry.internal.event.ComponentEventProperty


        assertTrue(worker.canEnhance(m));
        worker.peformEnhancement(op, spec, m, resource);
       
        verify();
               
        ComponentEventProperty property = spec.getComponentEvents("email");
        assertNotNull(property);
       
        List listeners = property.getFormEventListeners("onClick");
        assertNotNull(listeners);
        assertEquals(1, listeners.size());
       
        EventBoundListener formListener = (EventBoundListener)listeners.get(0);
        assertEquals("testForm", formListener.getFormId());
View Full Code Here


        for (int i = 0; i < listeners.size(); i++) {
           
            IComponentSpecification listener = (IComponentSpecification)listeners.get(i);
           
            IComponent target = null;
            ComponentEventProperty props = null;
           
            if (listener.isPageSpecification()) {
               
                target = component.getPage();
                props = listener.getComponentEvents(idPath);
            } else {
               
                target = findComponent(component.getPage().getComponents().values(), listener);
                props = target.getSpecification().getComponentEvents(idPath);
            }
            if (props == null)
                continue;
           
            List clisteners = props.getEventListeners(event.getName());
            for (int e=0; e < clisteners.size(); e++) {
               
                EventBoundListener eventListener = (EventBoundListener)clisteners.get(e);
               
                _invoker.invokeListener(target.getListeners().getListener(eventListener.getMethodName()), target, cycle);
View Full Code Here

    {
        String targetId = (String)event.getTarget().get("id");
        if (targetId == null)
            return;
       
        ComponentEventProperty prop = component.getSpecification().getElementEvents(targetId);
        if (prop == null)
            return;
       
        List listeners = prop.getEventListeners(event.getName());
       
        for (int i=0; i < listeners.size(); i++) {
           
            EventBoundListener listener = (EventBoundListener)listeners.get(i);
           
View Full Code Here

        spec.addEventListener("comp1", new String[] {"onClick"}, "testFoo", null, false, false, false, false);
       
        assert spec.getComponentEvents("comp1") != null;
        assert spec.getComponentEvents("comp1").getEvents().size() == 1;
       
        ComponentEventProperty prop = spec.getComponentEvents("comp1");
        assertNotNull(prop);
        assertEquals(prop.getEventListeners("onClick").size(), 1);
       
        prop = spec.getComponentEvents("comp2");
        assert prop == null;
    }
View Full Code Here

        spec.addEventListener("comp1", new String[] {"onClick"}, "testFoo", "form", false, true, false, false);
        spec.addEventListener("comp1", new String[] {"onClick"}, "testBar", "form", false, true, false, false);
       
        assert spec.getComponentEvents("comp1") != null;
       
        ComponentEventProperty p = spec.getComponentEvents("comp1");
       
        // should be only form events bound
        assertEquals(p.getEvents().size(), 0);
        assertEquals(p.getEventListeners("onClick").size(), 0);
       
        assertEquals(p.getComponentId(), "comp1");
        assertEquals(p.getFormEventListeners("onClick").size(), 2);
        assertEquals(p.getFormEvents().size(), 1);
    }
View Full Code Here

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

            Map parms = new HashMap();

            String target = (String)keys.next();

            ComponentEventProperty prop = (ComponentEventProperty)elements.get(target);

            parms.put("component", component);
            parms.put("target", target);
            parms.put("url", url);
            parms.put("events", getEvents(prop, target));
View Full Code Here

        assertEquals(cs.getComponentEvents().size(), 2);
        assert cs.getComponentEvents("comp") != null;
        assert cs.getComponentEvents("page/comp") != null;

        ComponentEventProperty prop = cs.getComponentEvents("comp");
        assertEquals(prop.getComponentId(), "comp");
        assertEquals(prop.getEvents().size(), 1);
        EventBoundListener listener = (EventBoundListener)prop.getEventListeners("foo").get(0);
        assertEquals(listener.getComponentId(), "comp");

        prop = cs.getComponentEvents("page/comp");
        assertEquals(prop.getComponentId(), "page/comp");
        assertEquals(prop.getEvents().size(), 1);
        listener = (EventBoundListener)prop.getEventListeners("foo").get(0);
        assertEquals(listener.getComponentId(), "page/comp");
    }
View Full Code Here

            Map parms = new HashMap();

            String target = (String)keys.next();

            ComponentEventProperty prop = (ComponentEventProperty)elements.get(target);

            parms.put("component", component);
            parms.put("target", target);
            parms.put("url", url);
            parms.put("events", getEvents(prop, target));
View Full Code Here

     * {@inheritDoc}
     */
    public void addEventListener(String componentId, String[] events,
            String methodName, String formId, boolean validateForm, boolean async, boolean focus, boolean autoSubmit)
    {
        ComponentEventProperty property = getComponentEvents(componentId);
        if (property == null) {
            property = new ComponentEventProperty(componentId);
            _componentEvents.put(componentId, property);
        }

        property.addListener(events, methodName, formId, validateForm, async, focus, autoSubmit);
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.internal.event.ComponentEventProperty

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.