Package javax.faces.component.UIComponent

Examples of javax.faces.component.UIComponent.EventListenerWrapper


    public void testNonSerializableListenerWithPSSFull()
    {
        UIComponent component = new UIOutput();
        ComponentSystemEventListener listener = new MyNonSerializableListener();       
        //This case happens when @ListenerFor is attached on the component class
        EventListenerWrapper wrapper = new EventListenerWrapper(component, listener);
       
        wrapper.markInitialState();
       
        wrapper.clearInitialState();
        Object state = wrapper.saveState(facesContext);

        //In this case state should not be null, because state should be saved fully
        assertNotNull(state);
       
        EventListenerWrapper wrapper2 = new EventListenerWrapper(component, listener);
        wrapper.markInitialState();
        //For restore we need to setup the context first
        component.pushComponentToEL(facesContext, component);
        wrapper2.restoreState(facesContext, state);
        component.popComponentFromEL(facesContext);
       
        assertNotNull(wrapper2.getComponentSystemEventListener());
        assertEquals(wrapper.getComponentSystemEventListener(), wrapper2.getComponentSystemEventListener());
    }
View Full Code Here


    public void testSerializableListenerNormalState()
    {
        UIComponent component = new UIOutput();
        ComponentSystemEventListener listener = new MySerializableListener();
        //This case happens when @ListenerFor is attached on the component class
        EventListenerWrapper wrapper = new EventListenerWrapper(component, listener);
       
        Object state = wrapper.saveState(facesContext);
       
        //In this case state should not be null, because state should be saved fully
        assertNotNull(state);
       
        EventListenerWrapper wrapper2 = new EventListenerWrapper();
        //For restore we need to setup the context first
        component.pushComponentToEL(facesContext, component);
        wrapper2.restoreState(facesContext, state);
        component.popComponentFromEL(facesContext);
       
        assertNotNull(wrapper2.getComponentSystemEventListener());
        assertEquals(wrapper.getComponentSystemEventListener(), wrapper2.getComponentSystemEventListener());
    }
View Full Code Here

    public void testSerializableListenerWithPSS()
    {
        UIComponent component = new UIOutput();
        ComponentSystemEventListener listener = new MySerializableListener();
        //This case happens when @ListenerFor is attached on the component class
        EventListenerWrapper wrapper = new EventListenerWrapper(component, listener);
       
        wrapper.markInitialState();
        Object state = wrapper.saveState(facesContext);
       
        //In this case state should be null
        assertNull(state);
       
        EventListenerWrapper wrapper2 = new EventListenerWrapper(component, listener);
        wrapper.markInitialState();
        //For restore we need to setup the context first
        component.pushComponentToEL(facesContext, component);
        wrapper2.restoreState(facesContext, state);
        component.popComponentFromEL(facesContext);
       
        assertNotNull(wrapper2.getComponentSystemEventListener());
        assertEquals(wrapper.getComponentSystemEventListener(), wrapper2.getComponentSystemEventListener());
    }
View Full Code Here

    public void testSerializableListenerWithPSSFull()
    {
        UIComponent component = new UIOutput();
        ComponentSystemEventListener listener = new MySerializableListener();       
        //This case happens when @ListenerFor is attached on the component class
        EventListenerWrapper wrapper = new EventListenerWrapper(component, listener);
       
        wrapper.markInitialState();
       
        wrapper.clearInitialState();
        Object state = wrapper.saveState(facesContext);

        //In this case state should not be null, because state should be saved fully
        assertNotNull(state);
       
        EventListenerWrapper wrapper2 = new EventListenerWrapper(component, listener);
        wrapper.markInitialState();
        //For restore we need to setup the context first
        component.pushComponentToEL(facesContext, component);
        wrapper2.restoreState(facesContext, state);
        component.popComponentFromEL(facesContext);
       
        assertNotNull(wrapper2.getComponentSystemEventListener());
        assertEquals(wrapper.getComponentSystemEventListener(), wrapper2.getComponentSystemEventListener());
    }
View Full Code Here

    public void testStateHolderListenerNormalState()
    {
        UIComponent component = new UIOutput();
        MyStateHolderListener listener = new MyStateHolderListener();
        //This case happens when @ListenerFor is attached on the component class
        EventListenerWrapper wrapper = new EventListenerWrapper(component, listener);
       
        listener.setI(2);
        Object state = wrapper.saveState(facesContext);
       
        //In this case state should not be null, because state should be saved fully
        assertNotNull(state);
       
        EventListenerWrapper wrapper2 = new EventListenerWrapper();
        //For restore we need to setup the context first
        component.pushComponentToEL(facesContext, component);
        wrapper2.restoreState(facesContext, state);
        component.popComponentFromEL(facesContext);
       
        assertNotNull(wrapper2.getComponentSystemEventListener());
        assertEquals(wrapper.getComponentSystemEventListener(), wrapper2.getComponentSystemEventListener());
    }
View Full Code Here

    public void testStateHolderListenerWithPSS()
    {
        UIComponent component = new UIOutput();
        ComponentSystemEventListener listener = new MyStateHolderListener();
        //This case happens when @ListenerFor is attached on the component class
        EventListenerWrapper wrapper = new EventListenerWrapper(component, listener);
       
        wrapper.markInitialState();
        Object state = wrapper.saveState(facesContext);
       
        //In this case state should be not null, because it implements StateHolder
        assertNotNull(state);
       
        MyStateHolderListener listener2 = new MyStateHolderListener();
        listener2.setI(2);
        EventListenerWrapper wrapper2 = new EventListenerWrapper(component, listener2);
        wrapper.markInitialState();
        //For restore we need to setup the context first
        component.pushComponentToEL(facesContext, component);
        wrapper2.restoreState(facesContext, state);
        component.popComponentFromEL(facesContext);
       
        assertNotNull(wrapper2.getComponentSystemEventListener());
        assertEquals(wrapper.getComponentSystemEventListener(), wrapper2.getComponentSystemEventListener());
    }
View Full Code Here

    public void testStateHolderListenerWithPSSFull()
    {
        UIComponent component = new UIOutput();
        ComponentSystemEventListener listener = new MyStateHolderListener();       
        //This case happens when @ListenerFor is attached on the component class
        EventListenerWrapper wrapper = new EventListenerWrapper(component, listener);
       
        wrapper.markInitialState();
       
        wrapper.clearInitialState();
        Object state = wrapper.saveState(facesContext);

        //In this case state should not be null, because state should be saved fully
        assertNotNull(state);
       
        EventListenerWrapper wrapper2 = new EventListenerWrapper(component, listener);
        wrapper.markInitialState();
        //For restore we need to setup the context first
        component.pushComponentToEL(facesContext, component);
        wrapper2.restoreState(facesContext, state);
        component.popComponentFromEL(facesContext);
       
        assertNotNull(wrapper2.getComponentSystemEventListener());
        assertEquals(wrapper.getComponentSystemEventListener(), wrapper2.getComponentSystemEventListener());
    }
View Full Code Here

    public void testPartialStateHolderListenerNormalState()
    {
        UIComponent component = new UIOutput();
        ComponentSystemEventListener listener = new MyPartialStateHolderListener();
        //This case happens when @ListenerFor is attached on the component class
        EventListenerWrapper wrapper = new EventListenerWrapper(component, listener);
       
        Object state = wrapper.saveState(facesContext);
       
        //In this case state should not be null, because state should be saved fully
        assertNotNull(state);
       
        EventListenerWrapper wrapper2 = new EventListenerWrapper();
        //For restore we need to setup the context first
        component.pushComponentToEL(facesContext, component);
        wrapper2.restoreState(facesContext, state);
        component.popComponentFromEL(facesContext);
       
        assertNotNull(wrapper2.getComponentSystemEventListener());
        assertEquals(wrapper.getComponentSystemEventListener(), wrapper2.getComponentSystemEventListener());
    }
View Full Code Here

    public void testPartialStateHolderListenerWithPSS()
    {
        UIComponent component = new UIOutput();
        ComponentSystemEventListener listener = new MyPartialStateHolderListener();
        //This case happens when @ListenerFor is attached on the component class
        EventListenerWrapper wrapper = new EventListenerWrapper(component, listener);
       
        wrapper.markInitialState();
        Object state = wrapper.saveState(facesContext);
       
        //In this case state should be null
        assertNull(state);
       
        EventListenerWrapper wrapper2 = new EventListenerWrapper(component, listener);
        wrapper.markInitialState();
        //For restore we need to setup the context first
        component.pushComponentToEL(facesContext, component);
        wrapper2.restoreState(facesContext, state);
        component.popComponentFromEL(facesContext);
       
        assertNotNull(wrapper2.getComponentSystemEventListener());
        assertEquals(wrapper.getComponentSystemEventListener(), wrapper2.getComponentSystemEventListener());
    }
View Full Code Here

    public void testPartialStateHolderListenerWithPSS2()
    {
        UIComponent component = new UIOutput();
        MyPartialStateHolderListener listener = new MyPartialStateHolderListener();
        //This case happens when @ListenerFor is attached on the component class
        EventListenerWrapper wrapper = new EventListenerWrapper(component, listener);
       
        wrapper.markInitialState();
       
        listener.setI(2);
        Object state = wrapper.saveState(facesContext);
       
        //In this case state should be not null, because something changed inside the listener
        assertNotNull(state);
       
        EventListenerWrapper wrapper2 = new EventListenerWrapper(component, new MyPartialStateHolderListener());
        wrapper.markInitialState();
        //For restore we need to setup the context first
        component.pushComponentToEL(facesContext, component);
        wrapper2.restoreState(facesContext, state);
        component.popComponentFromEL(facesContext);
       
        assertNotNull(wrapper2.getComponentSystemEventListener());
        assertEquals(wrapper.getComponentSystemEventListener(), wrapper2.getComponentSystemEventListener());
    }
View Full Code Here

TOP

Related Classes of javax.faces.component.UIComponent.EventListenerWrapper

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.