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

XEO Web Components Value Change Listener

XEO Web Components that extend the base component XUIOutput can have a Value Change Listener. A method that will be invoked whenever the value of the component changes. As of version 3.1.010 the current list of components that extend the XUIOutputComponent are:

ValueChangeListeners

Value Change Listeners are usefull, for instance, to create a set of ComboBoxes in which the list of values for the boxes depend on a choice made in the previous box (think choosing Continent -> Country -> City).

The valueChangeListener property acepts an EL Expression to a bean method (and receives an event as parameter), which is invoked every time the value changes. An example:

In the viewer:

(...)
<xvw:viewer beanClass='MyBean'/>
(...)
    <xvw;attributeText valueExpression='#{viewBean.name}' valueChangeListener='#{viewBean.onChangeName}' />
(...)

In the Bean:

public class MyBean() {

    //Variable to keep to the name
    private String name;

    //Getter to retrieve the name
    public String getName() {
        return this.name;
    }

    //Setter to set the name
    public void setName( String Name ) {
        this.name = name;
    }

    //Method invoked whenever the value of the attribute text is changed
    public void onChangeName( XUIValueChangeEvent e ) {
         System.out.println( "The name was changed from " + e.getOldValue() + " to " + e.getNewValue()  );
   }
}

_

Topic revision: r3 - 2011-04-04 - NicolauGrosskopf
 

No permission to view TWiki.WebTopBar

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

No permission to view TWiki.WebBottomBar