public void onEvent()

in src/main/java/org/apache/directory/fortress/web/panel/UserDetailPanel.java [1689:1786]


        public void onEvent( final IEvent event )
        {

            if ( event.getPayload() instanceof SelectModelEvent )
            {
                clearDetailPanel();
                SelectModelEvent modelEvent = ( SelectModelEvent ) event.getPayload();
                final User user = ( User ) modelEvent.getEntity();
                // strip the attribute name from value.  e.g. cn=value:
                user.setPwPolicy( getPolicyName( user.getPwPolicy() ) );
                this.setModelObject( user );
                initAccordionLabels( user );
                String msg = "User: " + user.getUserId() + " has been selected";
                LOG.debug( msg );
                display.setMessage( msg );
                userIdTF.setEnabled( false );
                addPB.setEnabled( false );

                rolesDD = new AjaxDropDownList<UserRole>(ROLES, new CompoundPropertyModel<>( new UserRole() ), Model.ofList(user.getRoles()))
                {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void onSelectionChanged(AjaxRequestTarget target)
                    {
                        userRoleSelection =  this.getModelObject();
                        if ( userRoleSelection != null )
                        {
                            info( "roleNm=" + userRoleSelection.getName() );
                            roleConstraint = userRoleSelection;
                            roleConstraintPanel.setOutputMarkupId( true );
                            target.add( roleConstraintPanel );
                            // TODO: should we clear out any unfinished work here:
                            //userAdminRoleSelection = new UserAdminRole();
                            //target.add( adminRolesDD );
                        }
                    }
                };
                this.rolesDD.setOutputMarkupId( true );
                editForm.addOrReplace( rolesDD );

                adminRolesDD = new AjaxDropDownList<UserAdminRole>(ADMIN_ROLES, new CompoundPropertyModel<>( new UserAdminRole() ), Model.ofList(user.getAdminRoles()))
                {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void onSelectionChanged(AjaxRequestTarget target)
                    {
                        userAdminRoleSelection =  this.getModelObject();
                        if ( userAdminRoleSelection != null )
                        {
                            info( "roleNm=" + userRoleSelection.getName() );
                            adminRoleConstraint = userAdminRoleSelection;
                            adminRoleConstraintPanel.setOutputMarkupId( true );
                            target.add( adminRoleConstraintPanel );
                            // TODO: should we clear out any unfinished work here:
                            // userRoleSelection = new UserRole();
                            // target.add( rolesDD );
                        }
                    }
                };
                this.adminRolesDD.setOutputMarkupId( true );
                editForm.addOrReplace( adminRolesDD );

                emailsCB = new ComboBox<>( GlobalIds.EMAILS, new PropertyModel<String>( this, EMAILS_SELECTION ),
                    user.getEmails() );
                editForm.addOrReplace( emailsCB );
                phonesCB = new ComboBox<>( GlobalIds.PHONES, new PropertyModel<String>( this, PHONES_SELECTION ),
                    user.getPhones() );
                editForm.addOrReplace( phonesCB );
                mobilesCB = new ComboBox<>( GlobalIds.MOBILES,
                    new PropertyModel<String>( this, MOBILES_SELECTION ),
                    user.getMobiles() );
                editForm.addOrReplace( mobilesCB );
                addressCB = new ComboBox<>( GlobalIds.ADDRESSES, new PropertyModel<String>( this,
                    ADDRESS_SELECTION ),
                    user.getAddress().getAddresses() );
                editForm.addOrReplace( addressCB );
                roleConstraint = new UserRole();
                editForm.addOrReplace( roleConstraintPanel );
                adminRoleConstraint = new UserAdminRole();
                editForm.addOrReplace( adminRoleConstraintPanel );
                component = editForm;
            }
            // TODO: fix me... don't want to add detail form to every ajax request target that passes though:
            else if ( event.getPayload() instanceof AjaxRequestTarget )
            {
                // only add the form to ajax target if something has changed...
                if ( component != null )
                {
                    AjaxRequestTarget target = ( ( AjaxRequestTarget ) event.getPayload() );
                    LOG.debug( ".onEvent AjaxRequestTarget: " + target.toString() );
                    target.add( component );
                    component = null;
                }
                display.display( ( AjaxRequestTarget ) event.getPayload() );
            }
        }