in src/main/java/org/apache/directory/fortress/web/panel/RoleDetailPanel.java [486:565]
private void addRoleSearchModal()
{
final ModalWindow rolesModalWindow;
add( rolesModalWindow = new ModalWindow( "parentrolesmodal" ) );
final RoleSearchModalPanel roleSearchModalPanel = new RoleSearchModalPanel(
rolesModalWindow.getContentId(), rolesModalWindow, isAdmin );
rolesModalWindow.setContent( roleSearchModalPanel );
rolesModalWindow.setWindowClosedCallback( new ModalWindow.WindowClosedCallback()
{
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
@Override
public void onClose( AjaxRequestTarget target )
{
parentConstraint = roleSearchModalPanel.getRoleSelection();
if ( parentConstraint != null )
{
parentsSelection = parentConstraint.getName();
Role role = ( Role ) getDefaultModelObject();
role.setParent( parentsSelection );
target.add( parentsCB );
component = editForm;
}
}
} );
add( new AjaxButton( GlobalIds.PARENTROLES_SEARCH )
{
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit( AjaxRequestTarget target )
{
String msg = "clicked on parent roles search";
msg += parentsSelection != null ? ": " + parentsSelection : "";
roleSearchModalPanel.setRoleSearchVal( parentsSelection );
display.setMessage( msg );
LOG.debug( msg );
target.prependJavaScript( GlobalIds.WICKET_WINDOW_UNLOAD_CONFIRMATION_FALSE );
rolesModalWindow.show( target );
}
@Override
protected void updateAjaxAttributes( AjaxRequestAttributes attributes )
{
super.updateAjaxAttributes( attributes );
AjaxCallListener ajaxCallListener = new AjaxCallListener()
{
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
@Override
public CharSequence getFailureHandler( Component component )
{
return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
}
};
attributes.getAjaxCallListeners().add( ajaxCallListener );
}
} );
String modalLabel;
if ( isAdmin )
{
modalLabel = "Admin Role Selection Modal";
}
else
{
modalLabel = "RBAC Role Selection Modal";
}
rolesModalWindow.setTitle( modalLabel );
rolesModalWindow.setInitialWidth( 700 );
rolesModalWindow.setInitialHeight( 450 );
rolesModalWindow.setCookieName( "role-assign-modal" );
}