List of usage examples for com.vaadin.ui Image addStyleName
@Override public void addStyleName(String style)
From source file:com.esofthead.mycollab.vaadin.ui.AddViewLayout.java
License:Open Source License
public AddViewLayout(String viewTitle, Resource viewIcon) { super("addView"); this.viewIcon = viewIcon; this.header = new MHorizontalLayout().withWidth("100%"); this.header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); this.titleLbl = new Label("", ContentMode.HTML); this.titleLbl.setStyleName("headerName"); if (!(viewIcon instanceof FontAwesome)) { Image icon = new Image(null); icon.setIcon(viewIcon);//from ww w .j a va2 s . c o m icon.addStyleName(UIConstants.BUTTON_ICON_ONLY); this.header.with(icon); } this.header.with(titleLbl).expand(titleLbl); setHeader(viewTitle); this.addComponent(this.header, "addViewHeader"); }
From source file:com.esofthead.mycollab.vaadin.web.ui.AddViewLayout.java
License:Open Source License
public AddViewLayout(String viewTitle, Resource viewIcon) { super("addView"); this.viewIcon = viewIcon; header = new MHorizontalLayout().withFullWidth().withMargin(new MarginInfo(true, false, true, false)); header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); titleLbl = ELabel.h2(""); if (!(viewIcon instanceof FontAwesome)) { Image icon = new Image(null); icon.setIcon(viewIcon);/*from www . ja v a2 s . com*/ icon.addStyleName(UIConstants.BUTTON_ICON_ONLY); header.with(icon); } header.with(titleLbl).expand(titleLbl); setHeader(viewTitle); addComponent(header, "addViewHeader"); }
From source file:com.mycollab.mobile.module.project.view.message.MessageReadViewImpl.java
License:Open Source License
private void displayItem() { mainLayout.removeAllComponents();//from ww w. j a v a2 s .c o m MHorizontalLayout messageBlock = new MHorizontalLayout().withSpacing(false).withFullWidth() .withStyleName("message-block"); Image userAvatarImg = UserAvatarControlFactory .createUserAvatarEmbeddedComponent(bean.getPostedUserAvatarId(), 32); userAvatarImg.addStyleName(UIConstants.CIRCLE_BOX); messageBlock.addComponent(userAvatarImg); CssLayout rightCol = new CssLayout(); rightCol.setWidth("100%"); MHorizontalLayout metadataRow = new MHorizontalLayout().withFullWidth(); ELabel userNameLbl = new ELabel(bean.getFullPostedUserName()).withStyleName(UIConstants.META_INFO); userNameLbl.addStyleName(UIConstants.TEXT_ELLIPSIS); CssLayout userNameWrap = new CssLayout(userNameLbl); ELabel messageTimePost = new ELabel().prettyDateTime(bean.getPosteddate()) .withStyleName(UIConstants.META_INFO).withWidthUndefined(); metadataRow.with(userNameWrap, messageTimePost).withAlign(messageTimePost, Alignment.TOP_RIGHT) .expand(userNameWrap); rightCol.addComponent(metadataRow); CssLayout titleRow = new CssLayout(); titleRow.setWidth("100%"); titleRow.setStyleName("title-row"); Label messageTitle = new Label(bean.getTitle()); messageTitle.setStyleName("message-title"); titleRow.addComponent(messageTitle); rightCol.addComponent(titleRow); Label messageContent = new Label(StringUtils.trimHtmlTags(bean.getMessage())); rightCol.addComponent(messageContent); ResourceService attachmentService = AppContextUtil.getSpringBean(ResourceService.class); List<Content> attachments = attachmentService.getContents(AttachmentUtils.getProjectEntityAttachmentPath( MyCollabUI.getAccountId(), bean.getProjectid(), ProjectTypeConstants.MESSAGE, "" + bean.getId())); if (CollectionUtils.isNotEmpty(attachments)) { CssLayout attachmentPanel = new CssLayout(); attachmentPanel.setStyleName("attachment-panel"); attachmentPanel.setWidth("100%"); for (Content attachment : attachments) { attachmentPanel.addComponent(MobileAttachmentUtils.renderAttachmentRow(attachment)); } rightCol.addComponent(attachmentPanel); } messageBlock.with(rightCol).expand(rightCol); mainLayout.addComponent(messageBlock); Label commentTitleLbl = new Label(); Component section = FormSectionBuilder.build(FontAwesome.COMMENT, commentTitleLbl); MessageCommentListDisplay commentDisplay = new MessageCommentListDisplay(ProjectTypeConstants.MESSAGE, bean.getId() + "", bean.getProjectid(), true); int numComments = commentDisplay.getNumComments(); commentTitleLbl.setValue(UserUIContext.getMessage(GenericI18Enum.OPT_COMMENTS_VALUE, numComments)); mainLayout.addComponent(section); mainLayout.addComponent(commentDisplay); this.setToolbar(commentDisplay.getCommentBox()); }
From source file:com.mycollab.module.project.ui.components.ProjectMemberBlock.java
License:Open Source License
public ProjectMemberBlock(String username, String userAvatarId, String displayName) { withMargin(false).withWidth("80px"); Image userAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(userAvatarId, 48, displayName);/*www . j a v a2s.com*/ userAvatar.addStyleName(UIConstants.CIRCLE_BOX); A userLink = new A() .setId("tag" + TOOLTIP_ID).setHref(ProjectLinkBuilder .generateProjectMemberFullLink(CurrentProjectVariables.getProjectId(), username)) .appendText(StringUtils.trim(displayName, 30, true)); userLink.setAttribute("onmouseover", TooltipHelper.userHoverJsFunction(username)); userLink.setAttribute("onmouseleave", TooltipHelper.itemMouseLeaveJsFunction()); Label userLbl = new Label(userLink.write(), ContentMode.HTML); userLbl.addStyleName(ValoTheme.LABEL_SMALL); with(userAvatar, userLbl); }
From source file:com.mycollab.module.project.view.settings.ProjectMemberListViewImpl.java
License:Open Source License
private Component generateMemberBlock(final SimpleProjectMember member) { HorizontalLayout blockContent = new HorizontalLayout(); blockContent.setStyleName("member-block"); if (ProjectMemberStatusConstants.NOT_ACCESS_YET.equals(member.getStatus())) { blockContent.addStyleName("inactive"); }//from www . j a va 2 s . c om blockContent.setWidth("350px"); Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getMemberAvatarId(), 100); memberAvatar.addStyleName(UIConstants.CIRCLE_BOX); memberAvatar.setWidthUndefined(); blockContent.addComponent(memberAvatar); MVerticalLayout blockTop = new MVerticalLayout().withMargin(new MarginInfo(false, false, false, true)) .withFullWidth(); MButton editBtn = new MButton("", clickEvent -> EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoEdit(this, member))) .withIcon(FontAwesome.EDIT).withStyleName(WebThemes.BUTTON_LINK) .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)); editBtn.setDescription("Edit user '" + member.getDisplayName() + "' information"); MButton deleteBtn = new MButton("", clickEvent -> { ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { ProjectMemberService prjMemberService = AppContextUtil .getSpringBean(ProjectMemberService.class); prjMemberService.removeWithSession(member, UserUIContext.getUsername(), MyCollabUI.getAccountId()); EventBusFactory.getInstance() .post(new ProjectMemberEvent.GotoList(ProjectMemberListViewImpl.this, null)); } }); }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_LINK) .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)); deleteBtn.setDescription("Remove user '" + member.getDisplayName() + "' out of this project"); MHorizontalLayout buttonControls = new MHorizontalLayout(editBtn, deleteBtn); blockTop.addComponent(buttonControls); blockTop.setComponentAlignment(buttonControls, Alignment.TOP_RIGHT); A memberLink = new A( ProjectLinkBuilder.generateProjectMemberFullLink(member.getProjectid(), member.getUsername())) .appendText(member.getMemberFullName()).setTitle(member.getMemberFullName()); ELabel memberNameLbl = ELabel.h3(memberLink.write()).withStyleName(UIConstants.TEXT_ELLIPSIS) .withFullWidth(); blockTop.with(memberNameLbl, ELabel.hr()); String roleLink = String.format("<a href=\"%s%s%s\"", MyCollabUI.getSiteUrl(), GenericLinkUtils.URL_PREFIX_PARAM, ProjectLinkGenerator.generateRolePreviewLink(member.getProjectid(), member.getProjectroleid())); ELabel memberRole = new ELabel("", ContentMode.HTML).withFullWidth() .withStyleName(UIConstants.TEXT_ELLIPSIS); if (member.isProjectOwner()) { memberRole.setValue(String.format("%sstyle=\"color: #B00000;\">%s</a>", roleLink, UserUIContext.getMessage(ProjectRoleI18nEnum.OPT_ADMIN_ROLE_DISPLAY))); } else { memberRole.setValue( String.format("%sstyle=\"color:gray;font-size:12px;\">%s</a>", roleLink, member.getRoleName())); } blockTop.addComponent(memberRole); if (Boolean.TRUE.equals(MyCollabUI.showEmailPublicly())) { Label memberEmailLabel = ELabel .html(String.format("<a href='mailto:%s'>%s</a>", member.getUsername(), member.getUsername())) .withStyleName(UIConstants.META_INFO).withFullWidth(); blockTop.addComponent(memberEmailLabel); } ELabel memberSinceLabel = ELabel .html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_SINCE, UserUIContext.formatPrettyTime(member.getJoindate()))) .withDescription(UserUIContext.formatDateTime(member.getJoindate())).withFullWidth(); blockTop.addComponent(memberSinceLabel); if (ProjectMemberStatusConstants.ACTIVE.equals(member.getStatus())) { ELabel lastAccessTimeLbl = ELabel .html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_LOGGED_IN, UserUIContext.formatPrettyTime(member.getLastAccessTime()))) .withDescription(UserUIContext.formatDateTime(member.getLastAccessTime())); blockTop.addComponent(lastAccessTimeLbl); } String memberWorksInfo = ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK).getHtml() + " " + new Span().appendText("" + member.getNumOpenTasks()) .setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_OPEN_TASKS)) + " " + ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG).getHtml() + " " + new Span().appendText("" + member.getNumOpenBugs()) .setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_OPEN_BUGS)) + " " + FontAwesome.MONEY.getHtml() + " " + new Span().appendText("" + NumberUtils.roundDouble(2, member.getTotalBillableLogTime())) .setTitle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS)) + " " + FontAwesome.GIFT.getHtml() + " " + new Span().appendText("" + NumberUtils.roundDouble(2, member.getTotalNonBillableLogTime())) .setTitle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS)); blockTop.addComponent(ELabel.html(memberWorksInfo).withStyleName(UIConstants.META_INFO)); blockContent.addComponent(blockTop); blockContent.setExpandRatio(blockTop, 1.0f); return blockContent; }
From source file:com.mycollab.module.user.accountsettings.profile.view.ProfileReadViewImpl.java
License:Open Source License
private void displayUserAvatar() { avatarAndPass.removeAllComponents(); Image cropField = UserAvatarControlFactory .createUserAvatarEmbeddedComponent(UserUIContext.getUserAvatarId(), 100); cropField.addStyleName(UIConstants.CIRCLE_BOX); CssLayout avatarWrapper = new CssLayout(); avatarWrapper.addComponent(cropField); MVerticalLayout userAvatar = new MVerticalLayout().withMargin(false).with(avatarWrapper); userAvatar.setSizeUndefined();/*from w w w. ja v a 2s . com*/ final UploadImageField avatarUploadField = new UploadImageField(this); avatarUploadField.setButtonCaption(UserUIContext.getMessage(UserI18nEnum.BUTTON_CHANGE_AVATAR)); userAvatar.addComponent(avatarUploadField); avatarAndPass.with(userAvatar); User user = formItem.getBean(); MVerticalLayout basicLayout = new MVerticalLayout().withMargin(false); ELabel usernameLbl = ELabel.h2(UserUIContext.getUser().getDisplayName()).withWidthUndefined(); MButton btnChangeBasicInfo = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> UI.getCurrent().addWindow(new BasicInfoChangeWindow(formItem.getBean()))) .withStyleName(WebThemes.BUTTON_LINK); MHorizontalLayout userWrapper = new MHorizontalLayout(usernameLbl, btnChangeBasicInfo); basicLayout.addComponent(userWrapper); basicLayout.setComponentAlignment(userWrapper, Alignment.MIDDLE_LEFT); GridFormLayoutHelper userFormLayout = GridFormLayoutHelper.defaultFormLayoutHelper(1, 5) .withCaptionWidth("140px"); userFormLayout.getLayout().addStyleName(WebThemes.GRIDFORM_BORDERLESS); userFormLayout.addComponent(new Label(UserUIContext.formatDate(user.getDateofbirth())), UserUIContext.getMessage(UserI18nEnum.FORM_BIRTHDAY), 0, 0); userFormLayout .addComponent( new Label(new A("mailto:" + user.getEmail()).appendText(user.getEmail()).setTarget("_blank") .write(), ContentMode.HTML), UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL), 0, 1); userFormLayout.addComponent( new Label(TimezoneVal.getDisplayName(UserUIContext.getUserLocale(), user.getTimezone())), UserUIContext.getMessage(UserI18nEnum.FORM_TIMEZONE), 0, 2); userFormLayout.addComponent( new Label(LocalizationHelper.getLocaleInstance(user.getLanguage()) .getDisplayLanguage(UserUIContext.getUserLocale())), UserUIContext.getMessage(UserI18nEnum.FORM_LANGUAGE), UserUIContext.getMessage(ShellI18nEnum.OPT_SUPPORTED_LANGUAGES_INTRO), 0, 3); MButton btnChangePassword = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_CHANGE), clickEvent -> UI.getCurrent().addWindow(new PasswordChangeWindow(formItem.getBean()))) .withStyleName(WebThemes.BUTTON_LINK); userFormLayout.addComponent(new MHorizontalLayout(new Label("***********"), btnChangePassword), UserUIContext.getMessage(ShellI18nEnum.FORM_PASSWORD), 0, 4); basicLayout.addComponent(userFormLayout.getLayout()); avatarAndPass.with(basicLayout).expand(basicLayout); }
From source file:com.mycollab.module.user.accountsettings.team.view.UserListViewImpl.java
License:Open Source License
private Component generateMemberBlock(final SimpleUser member) { VerticalLayout blockContent = new VerticalLayout(); blockContent.setWidth("350px"); blockContent.setStyleName("member-block"); if (RegisterStatusConstants.NOT_LOG_IN_YET.equals(member.getRegisterstatus())) { blockContent.addStyleName("inactive"); }/*from ww w.ja va2s .c om*/ MHorizontalLayout blockTop = new MHorizontalLayout().withFullWidth(); Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getAvatarid(), 100); memberAvatar.addStyleName(UIConstants.CIRCLE_BOX); blockTop.addComponent(memberAvatar); MVerticalLayout memberInfo = new MVerticalLayout().withMargin(false); MHorizontalLayout buttonControls = new MHorizontalLayout(); buttonControls.setDefaultComponentAlignment(Alignment.TOP_RIGHT); buttonControls.setVisible(UserUIContext.canWrite(RolePermissionCollections.ACCOUNT_USER)); if (RegisterStatusConstants.NOT_LOG_IN_YET.equals(member.getRegisterstatus())) { MButton resendBtn = new MButton(UserUIContext.getMessage(UserI18nEnum.ACTION_RESEND_INVITATION), clickEvent -> { SendUserInvitationEvent invitationEvent = new SendUserInvitationEvent(member.getUsername(), null, member.getInviteUser(), MyCollabUI.getSubDomain(), MyCollabUI.getAccountId()); AsyncEventBus asyncEventBus = AppContextUtil.getSpringBean(AsyncEventBus.class); asyncEventBus.post(invitationEvent); NotificationUtil.showNotification(UserUIContext.getMessage(GenericI18Enum.OPT_SUCCESS), UserUIContext.getMessage(UserI18nEnum.OPT_SEND_INVITATION_SUCCESSFULLY, member.getDisplayName())); }).withStyleName(WebThemes.BUTTON_LINK); buttonControls.with(resendBtn); } MButton editBtn = new MButton("", clickEvent -> EventBusFactory.getInstance() .post(new UserEvent.GotoEdit(UserListViewImpl.this, member))).withIcon(FontAwesome.EDIT) .withStyleName(WebThemes.BUTTON_LINK); buttonControls.with(editBtn); MButton deleteBtn = new MButton("", clickEvent -> ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { UserService userService = AppContextUtil.getSpringBean(UserService.class); userService.pendingUserAccounts(Collections.singletonList(member.getUsername()), MyCollabUI.getAccountId()); EventBusFactory.getInstance() .post(new UserEvent.GotoList(UserListViewImpl.this, null)); } })).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_LINK); buttonControls.with(deleteBtn); memberInfo.addComponent(buttonControls); memberInfo.setComponentAlignment(buttonControls, Alignment.MIDDLE_RIGHT); A memberLink = new A( AccountLinkGenerator.generatePreviewFullUserLink(MyCollabUI.getSiteUrl(), member.getUsername())) .appendText(member.getDisplayName()); ELabel memberLinkLbl = ELabel.h3(memberLink.write()).withStyleName(UIConstants.TEXT_ELLIPSIS); memberInfo.addComponent(memberLinkLbl); memberInfo.addComponent(ELabel.hr()); if (member.getRoleid() != null) { String memberRoleLinkPrefix = String.format("<a href=\"%s\"", AccountLinkBuilder.generatePreviewFullRoleLink(member.getRoleid())); ELabel memberRole = new ELabel(ContentMode.HTML).withStyleName(UIConstants.TEXT_ELLIPSIS); if (Boolean.TRUE.equals(member.getIsAccountOwner())) { memberRole.setValue(String.format("%sstyle=\"color: #B00000;\">%s</a>", memberRoleLinkPrefix, UserUIContext.getMessage(RoleI18nEnum.OPT_ACCOUNT_OWNER))); } else { memberRole.setValue(String.format("%sstyle=\"color:gray;font-size:12px;\">%s</a>", memberRoleLinkPrefix, member.getRoleName())); } memberInfo.addComponent(memberRole); } else if (Boolean.TRUE.equals(member.getIsAccountOwner())) { Label memberRole = new Label(String.format("<a style=\"color: #B00000;\">%s</a>", UserUIContext.getMessage(RoleI18nEnum.OPT_ACCOUNT_OWNER)), ContentMode.HTML); memberInfo.addComponent(memberRole); } else { Label lbl = new Label(); lbl.setHeight("10px"); memberInfo.addComponent(lbl); } if (Boolean.TRUE.equals(MyCollabUI.showEmailPublicly())) { Label memberEmailLabel = ELabel .html(String.format("<a href='mailto:%s'>%s</a>", member.getUsername(), member.getUsername())) .withStyleName(UIConstants.TEXT_ELLIPSIS, UIConstants.META_INFO).withFullWidth(); memberInfo.addComponent(memberEmailLabel); } ELabel memberSinceLabel = ELabel .html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_SINCE, UserUIContext.formatPrettyTime(member.getRegisteredtime()))) .withDescription(UserUIContext.formatDateTime(member.getRegisteredtime())).withFullWidth(); memberInfo.addComponent(memberSinceLabel); ELabel lastAccessTimeLbl = ELabel .html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_LOGGED_IN, UserUIContext.formatPrettyTime(member.getLastaccessedtime()))) .withDescription(UserUIContext.formatDateTime(member.getLastaccessedtime())); memberInfo.addComponent(lastAccessTimeLbl); blockTop.with(memberInfo).expand(memberInfo); blockContent.addComponent(blockTop); return blockContent; }
From source file:com.mycollab.module.user.accountsettings.team.view.UserReadViewImpl.java
License:Open Source License
private void displayUserAvatar() { header.removeAllComponents();/*from w w w . ja v a 2 s . co m*/ MHorizontalLayout avatarAndPass = new MHorizontalLayout().withFullWidth(); Image cropField = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(user.getAvatarid(), 100); cropField.addStyleName(UIConstants.CIRCLE_BOX); CssLayout userAvatar = new CssLayout(); userAvatar.addComponent(cropField); avatarAndPass.addComponent(userAvatar); MVerticalLayout basicLayout = new MVerticalLayout().withMargin(new MarginInfo(false, true, false, true)); CssLayout userWrapper = new CssLayout(); String nickName = user.getNickname(); ELabel userName = ELabel.h2(user.getDisplayName() + (StringUtils.isEmpty(nickName) ? "" : (String.format(" ( %s )", nickName)))); userWrapper.addComponent(userName); basicLayout.addComponent(userWrapper); basicLayout.setComponentAlignment(userWrapper, Alignment.MIDDLE_LEFT); GridFormLayoutHelper userFormLayout; if (UserUIContext.isAdmin()) { userFormLayout = GridFormLayoutHelper.defaultFormLayoutHelper(1, 6).withCaptionWidth("140px"); } else { userFormLayout = GridFormLayoutHelper.defaultFormLayoutHelper(1, 5).withCaptionWidth("140px"); } userFormLayout.getLayout().addStyleName(WebThemes.GRIDFORM_BORDERLESS); basicLayout.addComponent(userFormLayout.getLayout()); Node roleDiv; if (Boolean.TRUE.equals(user.getIsAccountOwner())) { roleDiv = new Div().appendText(UserUIContext.getMessage(RoleI18nEnum.OPT_ACCOUNT_OWNER)); } else { roleDiv = new A(AccountLinkBuilder.generatePreviewFullRoleLink(user.getRoleid())) .appendText(user.getRoleName()); } userFormLayout.addComponent(ELabel.html(roleDiv.write()), UserUIContext.getMessage(UserI18nEnum.FORM_ROLE), 0, 0); userFormLayout.addComponent(new Label(UserUIContext.formatDate(user.getDateofbirth())), UserUIContext.getMessage(UserI18nEnum.FORM_BIRTHDAY), 0, 1); if (Boolean.TRUE.equals(MyCollabUI.showEmailPublicly())) { userFormLayout.addComponent( ELabel.html(new A("mailto:" + user.getEmail()).appendText(user.getEmail()).write()), UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL), 0, 2); } else { userFormLayout.addComponent(ELabel.html("******"), UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL), 0, 2); } userFormLayout.addComponent( new Label(TimezoneVal.getDisplayName(UserUIContext.getUserLocale(), user.getTimezone())), UserUIContext.getMessage(UserI18nEnum.FORM_TIMEZONE), 0, 3); userFormLayout.addComponent( new Label(LocalizationHelper.getLocaleInstance(user.getLanguage()) .getDisplayLanguage(UserUIContext.getUserLocale())), UserUIContext.getMessage(UserI18nEnum.FORM_LANGUAGE), 0, 4); if (UserUIContext.isAdmin()) { MButton btnChangePassword = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_CHANGE), clickEvent -> UI.getCurrent().addWindow(new PasswordChangeWindow(user))) .withStyleName(WebThemes.BUTTON_LINK); userFormLayout.addComponent(new MHorizontalLayout(new Label("***********"), btnChangePassword), UserUIContext.getMessage(ShellI18nEnum.FORM_PASSWORD), 0, 5); } avatarAndPass.with(basicLayout).withAlign(basicLayout, Alignment.TOP_LEFT).expand(basicLayout); Layout controlButtons = createTopPanel(); CssLayout avatarAndPassWrapper = new CssLayout(); avatarAndPass.setWidthUndefined(); avatarAndPassWrapper.addComponent(avatarAndPass); header.with(avatarAndPass, controlButtons).withAlign(avatarAndPass, Alignment.TOP_LEFT) .withAlign(controlButtons, Alignment.TOP_RIGHT); }
From source file:com.mycollab.module.user.ui.components.UserBlock.java
License:Open Source License
public UserBlock(String username, String userAvatarId, String displayName) { withMargin(false).withWidth("80px"); Image avatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(userAvatarId, 48); avatar.addStyleName(UIConstants.CIRCLE_BOX); A userLink = new A().setId("tag" + TOOLTIP_ID) .setHref(AccountLinkBuilder.generatePreviewFullUserLink(username)) .appendText(StringUtils.trim(displayName, 30, true)); userLink.setAttribute("onmouseover", TooltipHelper.userHoverJsFunction(username)); userLink.setAttribute("onmouseleave", TooltipHelper.itemMouseLeaveJsFunction()); with(avatar, ELabel.html(userLink.write())); }
From source file:de.metas.procurement.webui.ui.view.LoginView.java
License:Open Source License
public LoginView() { super();//from w w w .j a va 2 s. co m Application.autowire(this); addStyleName(STYLE); // // Content { final VerticalComponentGroup content = new VerticalComponentGroup(); final Resource logoResource = getLogoResource(); final Image logo = new Image(null, logoResource); logo.addStyleName(STYLE_Logo); content.addComponent(logo); this.email = new EmailField(i18n.get("LoginView.fields.email")); email.addStyleName(STYLE_LoginEmail); email.setIcon(FontAwesome.USER); content.addComponent(email); this.password = new PasswordField(i18n.get("LoginView.fields.password")); password.addStyleName(STYLE_LoginPassword); password.setIcon(FontAwesome.LOCK); content.addComponent(password); final Button loginButton = new Button(i18n.get("LoginView.fields.loginButton")); loginButton.addStyleName(STYLE_LoginButton); loginButton.setClickShortcut(KeyCode.ENTER); loginButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { onUserLogin(email.getValue(), password.getValue()); } }); final Button forgotPasswordButton = new Button(i18n.get("LoginView.fields.forgotPasswordButton")); forgotPasswordButton.setStyleName(STYLE_ForgotPasswordButton); forgotPasswordButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { onForgotPassword(email.getValue()); } }); final CssLayout contentWrapper = new CssLayout(content, loginButton, forgotPasswordButton); contentWrapper.addStyleName(STYLE_LoginFormWrapper); setContent(contentWrapper); } // // Bottom: { // // Powered-by logo resource // Use the configured one if any; fallback to default embedded powered-by logo final Resource poweredByLogoResource; if (poweredByLogoUrl != null && !poweredByLogoUrl.trim().isEmpty()) { poweredByLogoResource = new ExternalResource(poweredByLogoUrl.trim()); } else { poweredByLogoResource = Constants.RESOURCE_PoweredBy; } // // Powered-by component: final Component poweredByComponent; if (poweredByLinkUrl != null && !poweredByLinkUrl.trim().isEmpty()) { final Link link = new Link(); link.setIcon(poweredByLogoResource); link.setResource(new ExternalResource(poweredByLinkUrl.trim())); link.setTargetName("_blank"); poweredByComponent = link; } else { final Image image = new Image(null, poweredByLogoResource); poweredByComponent = image; } // poweredByComponent.addStyleName(STYLE_PoweredBy); setToolbar(poweredByComponent); } }