use of io.imunity.furms.ui.components.ViewHeaderLayout in project furms by unity-idm.
the class SitesAdminsView method init.
private void init(String siteId) {
InviteUserComponent inviteUser = new InviteUserComponent(userService::getAllUsers, () -> siteService.findAllAdministrators(siteId));
MembershipChangerComponent membershipLayout = new MembershipChangerComponent(getTranslation("view.fenix-admin.sites.button.join"), getTranslation("view.fenix-admin.sites.button.demit"), () -> siteService.isCurrentUserAdminOf(siteId));
membershipLayout.addJoinButtonListener(event -> {
siteService.addAdmin(siteId, currentUserId);
gridReload();
inviteUser.reload();
});
membershipLayout.addDemitButtonListener(event -> {
if (siteService.findAllAdministrators(siteId).size() > 1) {
handleExceptions(() -> siteService.removeSiteUser(siteId, currentUserId));
gridReload();
} else {
showErrorNotification(getTranslation("component.administrators.error.validation.remove"));
}
inviteUser.reload();
membershipLayout.loadAppropriateButton();
});
inviteUser.addInviteAction(event -> doInviteAction(siteId, inviteUser, membershipLayout));
UserContextMenuFactory userContextMenuFactory = UserContextMenuFactory.builder().withCurrentUserId(currentUserId).withRemoveUserAction(userId -> siteService.removeSiteUser(siteId, userId)).withPostRemoveUserAction(userId -> {
membershipLayout.loadAppropriateButton();
inviteUser.reload();
}).withRemoveInvitationAction(invitationId -> {
siteService.removeInvitation(siteId, invitationId);
gridReload();
}).withResendInvitationAction(invitationId -> {
siteService.resendInvitation(siteId, invitationId);
gridReload();
}).build();
UserGrid.Builder userGrid = UserGrid.defaultInit(userContextMenuFactory);
grid = UsersGridComponent.defaultInit(() -> siteService.findAllAdministrators(siteId), () -> siteService.findSiteAdminInvitations(siteId), userGrid);
Site site = handleExceptions(() -> siteService.findById(siteId)).flatMap(identity()).orElseThrow(IllegalStateException::new);
ViewHeaderLayout viewHeaderLayout = new ViewHeaderLayout(getTranslation("view.sites.administrators.title", site.getName()), membershipLayout);
getContent().add(viewHeaderLayout, inviteUser, grid);
}
use of io.imunity.furms.ui.components.ViewHeaderLayout in project furms by unity-idm.
the class DashboardView method addTitle.
private void addTitle() {
final ViewHeaderLayout headerLayout = new ViewHeaderLayout(getTranslation("view.fenix-admin.dashboard.title"));
getContent().add(headerLayout);
}
use of io.imunity.furms.ui.components.ViewHeaderLayout in project furms by unity-idm.
the class SitesView method addHeader.
private void addHeader() {
Button addButton = new Button(getTranslation("view.sites.main.add.button"), new Icon(PLUS_CIRCLE));
addButton.addClickListener(this::actionOpenSiteFormAdd);
getContent().add(new ViewHeaderLayout(getTranslation("view.sites.main.title"), addButton));
}
use of io.imunity.furms.ui.components.ViewHeaderLayout in project furms by unity-idm.
the class GroupsView method loadPageContent.
private void loadPageContent() {
grid = createPolicyDocumentGrid();
searchLayout.addValueChangeGridReloader(this::loadGridContent);
loadGridContent();
ViewHeaderLayout viewHeaderLayout = new ViewHeaderLayout(getTranslation("view.community-admin.groups.page.header"), createAddButton());
getContent().add(viewHeaderLayout, searchLayout, grid);
}
use of io.imunity.furms.ui.components.ViewHeaderLayout in project furms by unity-idm.
the class SitesView method addTitle.
private void addTitle() {
final ViewHeaderLayout layout = new ViewHeaderLayout(getTranslation("view.user-settings.sites.page.title"));
getContent().add(layout);
}
Aggregations