Tags:
create new tag
, view all tags
-- PedroRio - 30 Mar 2011

XEO Web Components - Viewer Events

Viewer Events is a mechanism that allows to interact at the bean level during the life-cycle of a server request. The request life-cyle is depicted in figure 1. There are several points in the request life-cycle in which you can interact, the list is in the following table:

Property Description
onCreateViewPhase Occurs the first time a viewer is displayed
onRestoreViewPhase Occurs whenever a request is made to the viewer and it has already been initialized
beforeApplyRequestValuesPhase Occurs before applying request parameters to the components
afterApplyRequestValuesPhase Occurs after applying request parameters to the component
beforeUpdateModelPhase Occurs before applying component values to beans/XEO Model instances
afterUpdateModelPhase Occurs after applying component values to beans/XEO Model instances
beforeRenderPhase Occurs before rendering the current view
afterRenderPhase Occurs after rendering the current view

All these properties (events) accept an EL Expression to a method with the following signature:

public void myEventMethod( PhaseEvent e);

Let's see an example:

Viewer Declaration:

<xvw:viewer beanClass='MyBean'
    beanId='viewBean'
        afterUpdateModelPhase= '#{viewBean.afterUpdateModel}'
        afterRenderPhase= '#{viewBean.phaseEvent}'
>

Bean:

public class MyBean {
    public void afterUpdateModel( PhaseEvent e ) {
         System.out.println( "After update Model!!" );
    }
    public void afterRender( PhaseEvent e ) {
         System.out.println( "Before update Model!!" );
    }

}

The life-cycle of a server request is depicted in figure 1, bellow:

EsquemaUI2.0.png

Figure 1 - The life-cycle of a server request

_

Topic revision: r4 - 2012-09-25 - PedroRio
 

No permission to view TWiki.WebTopBar

This site is powered by the TWiki collaboration platform Powered by Perl

No permission to view TWiki.WebBottomBar