private void createTopHeaderActionsForUserContext ( ) { if ( UserContextUtil . allowRoleInSecurityContext ( ROLE_ADMIN ) || UserContextUtil . allowRoleInSecurityContext ( ROLE_USER ) ) { final Link userHomePageLink = pageLinkFactory . createUserHomeViewPageLink ( ) ; topHeaderRightPanel . addComponent ( userHomePageLink ) ; topHeaderRightPanel . setComponentAlignment ( userHomePageLink , Alignment . MIDDLE_RIGHT ) ; final Button logoutButton = new Button ( LOGOUT , VaadinIcons . SIGN_OUT ) ; final LogoutRequest logoutRequest = new LogoutRequest ( ) ; logoutRequest . setSessionId ( RequestContextHolder . currentRequestAttributes ( ) . getSessionId ( ) ) ; logoutButton . addClickListener ( new LogoutClickListener ( logoutRequest ) ) ; topHeaderRightPanel . addComponent ( logoutButton ) ; topHeaderRightPanel . setComponentAlignment ( logoutButton , Alignment . MIDDLE_RIGHT ) ; } else { final Link createRegisterPageLink = pageLinkFactory . createRegisterPageLink ( ) ; topHeaderRightPanel . addComponent ( createRegisterPageLink ) ; topHeaderRightPanel . setComponentAlignment ( createRegisterPageLink , Alignment . MIDDLE_RIGHT ) ; final Link createLoginPageLink = pageLinkFactory . createLoginPageLink ( ) ; topHeaderRightPanel . addComponent ( createLoginPageLink ) ; topHeaderRightPanel . setComponentAlignment ( createLoginPageLink , Alignment . MIDDLE_RIGHT ) ; } }
Creates the top header actions for user context .