private void addBehaviors ( ) { if ( this . uiField . getFieldConfiguration ( ) . getField ( ) . hasEvents ( EventType . UI_FIELD_UPDATE ) ) { final List < EventDefinition > events = this . uiField . getFieldConfiguration ( ) . getField ( ) . getEvents ( EventType . UI_FIELD_UPDATE ) ; String eventName = "change" ; for ( final EventDefinition event : events ) { eventName = event . getProperty ( "Event" ) == null ? "change" : event . getProperty ( "Event" ) ; } add ( new AjaxFieldUpdateBehavior ( eventName , Model . of ( this . uiField ) , false ) { /** The Constant serialVersionUID. */ private static final long serialVersionUID = 1L ; @ Override protected void onSubmit ( final AjaxRequestTarget _target ) { // add the previous value as a parameter final DropDownOption option = ( DropDownOption ) getDefaultModelObject ( ) ; try { if ( option != null ) { Context . getThreadContext ( ) . getParameters ( ) . put ( getFieldConfig ( ) . getName ( ) + "_eFapsPrevious" , new String [ ] { option . getValue ( ) } ) ; } } catch ( final EFapsException e ) { DropDownField . LOG . error ( "EFapsException" , e ) ; } super . onSubmit ( _target ) ; DropDownField . this . converted = false ; updateModel ( ) ; DropDownField . this . converted = false ; } } ) ; } add ( new AttributeAppender ( "style" , "text-align:" + getFieldConfig ( ) . getAlign ( ) , ";" ) ) ; // add the width only if not in a table if ( getFieldConfig ( ) . hasProperty ( UIFormFieldProperty . WIDTH ) && ! getFieldConfig ( ) . isTableField ( ) ) { add ( new AttributeAppender ( "style" , "width:" + getFieldConfig ( ) . getWidth ( ) , ";" ) ) ; } }
Adds the behaviors .