private DataView<LdapUser> newGroupMembersListView(LdapGroup group) { List<LdapUser> users; try { users = group.getMembers(); } catch (NamingException e) { logger.warn(e.getMessage(), e); users = new ArrayList<>(0); } DataView<LdapUser> members = new DataView<LdapUser>("membersList", new LdapGroupUsersProvider(users)) { @Override protected void populateItem(Item<LdapUser> item) { LdapUser user = item.getModelObject(); WebMarkupContainer container = new WebMarkupContainer("member"); ExternalLink mail = new ExternalLink( "mail", Model.of("mailto:" + user.getMail()), new PropertyModel(user, "mail")); Label userName = new Label("username", new PropertyModel(user, "userName")); final String fullName = user.getFullName(); Label fullNameLabel = new Label("fullname", Model.of(fullName)); fullNameLabel.setVisible(fullName != null); container.add(mail); container.add(userName); container.add(fullNameLabel); item.add(container); } }; members.setOutputMarkupId(true); return members; }
public void conversationEndedExceptionHandler( @Handles(precedence = 100) CaughtException<ViewExpiredException> event, Logger log, HttpConversationContext conversationContext, FacesContext facesContext) { log.warn("View expired, redirecting to error page"); conversationContext.activate(null); event.handled(); facesContext .getApplication() .getNavigationHandler() .handleNavigation(facesContext, "*", "viewExpired"); }
public Message build() { String text; String detail = null; try { text = bundles.get(clientLocale, textKey.getBundle()).getString(textKey.getKey()); if (detailKey != null) { detail = bundles.get(clientLocale, detailKey.getBundle()).getString(detailKey.getKey()); } } catch (Exception e) { log.warn("Could not load bundle: " + textKey); text = textDefault; } if ((text == null) || "".equals(text)) { text = textKey.toString(); } template.text(text); if (detail != null) { template.detail(detail); } return template.build(); }