List of usage examples for com.vaadin.ui Label Label
public Label()
From source file:com.esofthead.mycollab.module.project.ui.components.ProjectCommentInput.java
License:Open Source License
ProjectCommentInput(final ReloadableComponent component, final CommentType typeVal, final Integer extraTypeIdVal, final boolean cancelButtonEnable, final boolean isSendingEmailRelay, final Class<? extends SendingRelayEmailNotificationAction> emailHandler) { super();/* w w w. jav a2 s . c om*/ this.withWidth("100%").withStyleName("message"); final SimpleUser currentUser = AppContext.getSession(); MVerticalLayout userBlock = new MVerticalLayout().withMargin(false).withWidth("80px"); userBlock.setDefaultComponentAlignment(Alignment.TOP_CENTER); ClickListener gotoUser = new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { EventBusFactory.getInstance() .post(new ProjectMemberEvent.GotoRead(this, currentUser.getUsername())); } }; Button userAvatarBtn = UserAvatarControlFactory.createUserAvatarButtonLink(currentUser.getAvatarid(), currentUser.getDisplayName()); userAvatarBtn.addClickListener(gotoUser); userBlock.addComponent(userAvatarBtn); Button userName = new Button(currentUser.getDisplayName()); userName.setStyleName("user-name"); userName.addStyleName("link"); userName.addStyleName(UIConstants.WORD_WRAP); userName.addClickListener(gotoUser); userBlock.addComponent(userName); this.addComponent(userBlock); MVerticalLayout textAreaWrap = new MVerticalLayout().withWidth("100%").withStyleName("message-container"); this.addComponent(textAreaWrap); this.setExpandRatio(textAreaWrap, 1.0f); type = typeVal; extraTypeId = extraTypeIdVal; commentArea = new RichTextArea(); commentArea.setWidth("100%"); commentArea.setHeight("200px"); final AttachmentPanel attachments = new AttachmentPanel(); final MHorizontalLayout controlsLayout = new MHorizontalLayout().withSpacing(true).withMargin(false) .withWidth("100%"); final MultiFileUploadExt uploadExt = new MultiFileUploadExt(attachments); uploadExt.addComponent(attachments); controlsLayout.with(uploadExt).withAlign(uploadExt, Alignment.TOP_LEFT).expand(uploadExt); final Label emptySpace = new Label(); controlsLayout.addComponent(emptySpace); controlsLayout.setExpandRatio(emptySpace, 1.0f); if (cancelButtonEnable) { final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { component.cancel(); } }); cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK); controlsLayout.addComponent(cancelBtn); controlsLayout.setComponentAlignment(cancelBtn, Alignment.TOP_RIGHT); } final Button newCommentBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_POST), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { final Comment comment = new Comment(); comment.setComment(Jsoup.clean(commentArea.getValue(), Whitelist.relaxed())); comment.setCreatedtime(new GregorianCalendar().getTime()); comment.setCreateduser(AppContext.getUsername()); comment.setSaccountid(AppContext.getAccountId()); comment.setType(type.toString()); comment.setTypeid("" + typeId); comment.setExtratypeid(extraTypeId); final CommentService commentService = ApplicationContextUtil .getSpringBean(CommentService.class); int commentId = commentService.saveWithSession(comment, AppContext.getUsername(), isSendingEmailRelay, emailHandler); String attachmentPath = AttachmentUtils.getProjectEntityCommentAttachmentPath(typeVal, AppContext.getAccountId(), CurrentProjectVariables.getProjectId(), typeId, commentId); if (!"".equals(attachmentPath)) { attachments.saveContentsToRepo(attachmentPath); } // save success, clear comment area and load list // comments again commentArea.setValue(""); attachments.removeAllAttachmentsDisplay(); component.reload(); } }); newCommentBtn.setStyleName(UIConstants.THEME_GREEN_LINK); newCommentBtn.setIcon(FontAwesome.SEND); controlsLayout.with(newCommentBtn).withAlign(newCommentBtn, Alignment.TOP_RIGHT); textAreaWrap.addComponent(commentArea); textAreaWrap.addComponent(controlsLayout); }
From source file:com.esofthead.mycollab.module.project.ui.components.TaskSliderField.java
License:Open Source License
public TaskSliderField() { progressLbl = new Label(); progressLbl.setWidthUndefined();// w ww . ja v a 2 s .c o m slider = new Slider(); slider.setOrientation(SliderOrientation.HORIZONTAL); slider.setImmediate(true); slider.setWidth("150px"); slider.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent valueChangeEvent) { Double value = (Double) valueChangeEvent.getProperty().getValue(); if (value != null) { double roundValue = Math.ceil(value / 10) * 10; slider.setValue(roundValue); progressLbl.setValue(roundValue + "%"); setInternalValue(roundValue); } else { slider.setValue(0d); progressLbl.setValue("0%"); setInternalValue(0d); } } }); body = new MHorizontalLayout(slider, progressLbl); }
From source file:com.esofthead.mycollab.module.project.ui.components.TimeLogEditWindow.java
License:Open Source License
private void initUI() { this.setWidth("900px"); headerPanel = new MHorizontalLayout().withWidth("100%"); content.addComponent(headerPanel);//from ww w .j ava2 s.c o m constructSpentTimeEntryPanel(); constructRemainTimeEntryPanel(); this.tableItem = new DefaultPagedBeanTable<>( ApplicationContextUtil.getSpringBean(ItemTimeLoggingService.class), SimpleItemTimeLogging.class, Arrays.asList(TimeTableFieldDef.logUser, TimeTableFieldDef.logForDate, TimeTableFieldDef.logValue, TimeTableFieldDef.billable, new TableViewField(null, "id", UIConstants.TABLE_CONTROL_WIDTH))); this.tableItem.addGeneratedColumn("logUserFullName", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(final Table source, final Object itemId, final Object columnId) { final SimpleItemTimeLogging timeLoggingItem = TimeLogEditWindow.this.tableItem .getBeanByIndex(itemId); return new ProjectUserLink(timeLoggingItem.getLoguser(), timeLoggingItem.getLogUserAvatarId(), timeLoggingItem.getLogUserFullName()); } }); this.tableItem.addGeneratedColumn("logforday", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(final Table source, final Object itemId, final Object columnId) { final SimpleItemTimeLogging monitorItem = TimeLogEditWindow.this.tableItem.getBeanByIndex(itemId); final Label l = new Label(); l.setValue(AppContext.formatDate(monitorItem.getLogforday())); return l; } }); this.tableItem.addGeneratedColumn("logvalue", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(final Table source, final Object itemId, final Object columnId) { final SimpleItemTimeLogging itemTimeLogging = TimeLogEditWindow.this.tableItem .getBeanByIndex(itemId); final Label l = new Label(); l.setValue(itemTimeLogging.getLogvalue() + ""); return l; } }); this.tableItem.addGeneratedColumn("isbillable", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { final SimpleItemTimeLogging monitorItem = tableItem.getBeanByIndex(itemId); FontIconLabel icon; if (monitorItem.getIsbillable()) { icon = new FontIconLabel(FontAwesome.CHECK); } else { icon = new FontIconLabel(FontAwesome.TIMES); } icon.setStyleName(UIConstants.BUTTON_ICON_ONLY); return icon; } }); this.tableItem.addGeneratedColumn("id", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(final Table source, final Object itemId, final Object columnId) { final SimpleItemTimeLogging itemTimeLogging = TimeLogEditWindow.this.tableItem .getBeanByIndex(itemId); final Button deleteBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { TimeLogEditWindow.this.itemTimeLoggingService.removeWithSession(itemTimeLogging.getId(), AppContext.getUsername(), AppContext.getAccountId()); TimeLogEditWindow.this.loadTimeValue(); } }); deleteBtn.setIcon(FontAwesome.TRASH_O); deleteBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY); itemTimeLogging.setExtraData(deleteBtn); deleteBtn.setEnabled(CurrentProjectVariables.isAdmin() || AppContext.getUsername().equals(itemTimeLogging.getLoguser())); return deleteBtn; } }); this.tableItem.setWidth("100%"); content.addComponent(tableItem); }
From source file:com.esofthead.mycollab.module.project.ui.form.ProjectItemViewField.java
License:Open Source License
@Override protected Component initContent() { if (typeId.equals("null")) { return new Label(); }/*w w w . j a v a 2s . c o m*/ SimpleProject project = CurrentProjectVariables.getProject(); DivLessFormatter div = new DivLessFormatter(); String uid = UUID.randomUUID().toString(); Text avatarLink = new Text(ProjectAssetsManager.getAsset(type).getHtml()); A milestoneLink = new A().setId("tag" + uid).setHref( ProjectLinkBuilder.generateProjectItemLink(project.getShortname(), project.getId(), type, typeId)) .appendText(typeDisplayName); milestoneLink.setAttribute("onmouseover", TooltipHelper.projectHoverJsFunction(uid, type, typeId + "")); milestoneLink.setAttribute("onmouseleave", TooltipHelper.itemMouseLeaveJsFunction(uid)); div.appendChild(avatarLink, DivLessFormatter.EMPTY_SPACE(), milestoneLink, DivLessFormatter.EMPTY_SPACE(), TooltipHelper.buildDivTooltipEnable(uid)); return new Label(div.write(), ContentMode.HTML); }
From source file:com.esofthead.mycollab.module.project.view.settings.ProjectMemberListViewImpl.java
License:Open Source License
private Component generateMemberBlock(final SimpleProjectMember member) { CssLayout memberBlock = new CssLayout(); memberBlock.addStyleName("member-block"); VerticalLayout blockContent = new VerticalLayout(); MHorizontalLayout blockTop = new MHorizontalLayout(); Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getMemberAvatarId(), 100);/*from w w w . ja v a2s.com*/ blockTop.addComponent(memberAvatar); VerticalLayout memberInfo = new VerticalLayout(); Button deleteBtn = new Button("", FontAwesome.TRASH_O); deleteBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, SiteConfiguration.getSiteName()), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { ProjectMemberService prjMemberService = ApplicationContextUtil .getSpringBean(ProjectMemberService.class); member.setStatus(ProjectMemberStatusConstants.INACTIVE); prjMemberService.updateWithSession(member, AppContext.getUsername()); EventBusFactory.getInstance().post( new ProjectMemberEvent.GotoList(ProjectMemberListViewImpl.this, null)); } } }); } }); deleteBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY); blockContent.addComponent(deleteBtn); deleteBtn.setVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)); blockContent.setComponentAlignment(deleteBtn, Alignment.TOP_RIGHT); LabelLink memberLink = new LabelLink(member.getMemberFullName(), ProjectLinkBuilder.generateProjectMemberFullLink(member.getProjectid(), member.getUsername())); memberLink.setWidth("100%"); memberLink.addStyleName("member-name"); memberInfo.addComponent(memberLink); String roleLink = "<a href=\"" + AppContext.getSiteUrl() + GenericLinkUtils.URL_PREFIX_PARAM + ProjectLinkGenerator.generateRolePreviewLink(member.getProjectid(), member.getProjectRoleId()) + "\""; Label memberRole = new Label(); memberRole.setContentMode(ContentMode.HTML); memberRole.setStyleName("member-role"); if (member.isAdmin()) { memberRole.setValue(roleLink + "style=\"color: #B00000;\">" + "Project Admin" + "</a>"); } else { memberRole.setValue(roleLink + "style=\"color:gray;font-size:12px;\">" + member.getRoleName() + "</a>"); } memberRole.setSizeUndefined(); memberInfo.addComponent(memberRole); Label memberEmailLabel = new Label( "<a href='mailto:" + member.getUsername() + "'>" + member.getUsername() + "</a>", ContentMode.HTML); memberEmailLabel.addStyleName("member-email"); memberEmailLabel.setWidth("100%"); memberInfo.addComponent(memberEmailLabel); Label memberSinceLabel = new Label("Member since: " + AppContext.formatDate(member.getJoindate())); memberSinceLabel.addStyleName("member-email"); memberSinceLabel.setWidth("100%"); memberInfo.addComponent(memberSinceLabel); if (RegisterStatusConstants.SENT_VERIFICATION_EMAIL.equals(member.getStatus())) { final VerticalLayout waitingNotLayout = new VerticalLayout(); Label infoStatus = new Label(AppContext.getMessage(ProjectMemberI18nEnum.WAITING_ACCEPT_INVITATION)); infoStatus.addStyleName("member-email"); waitingNotLayout.addComponent(infoStatus); ButtonLink resendInvitationLink = new ButtonLink( AppContext.getMessage(ProjectMemberI18nEnum.BUTTON_RESEND_INVITATION), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { ProjectMemberMapper projectMemberMapper = ApplicationContextUtil .getSpringBean(ProjectMemberMapper.class); member.setStatus(RegisterStatusConstants.VERIFICATING); projectMemberMapper.updateByPrimaryKeySelective(member); waitingNotLayout.removeAllComponents(); Label statusEmail = new Label( AppContext.getMessage(ProjectMemberI18nEnum.SENDING_EMAIL_INVITATION)); statusEmail.addStyleName("member-email"); waitingNotLayout.addComponent(statusEmail); } }); resendInvitationLink.setStyleName("link"); resendInvitationLink.addStyleName("member-email"); waitingNotLayout.addComponent(resendInvitationLink); memberInfo.addComponent(waitingNotLayout); } else if (RegisterStatusConstants.ACTIVE.equals(member.getStatus())) { Label lastAccessTimeLbl = new Label("Logged in " + DateTimeUtils.getPrettyDateValue(member.getLastAccessTime(), AppContext.getUserLocale())); lastAccessTimeLbl.addStyleName("member-email"); memberInfo.addComponent(lastAccessTimeLbl); } else if (RegisterStatusConstants.VERIFICATING.equals(member.getStatus())) { Label infoStatus = new Label(AppContext.getMessage(ProjectMemberI18nEnum.SENDING_EMAIL_INVITATION)); infoStatus.addStyleName("member-email"); memberInfo.addComponent(infoStatus); } String bugStatus = member.getNumOpenBugs() + " open bug"; if (member.getNumOpenBugs() > 1) { bugStatus += "s"; } String taskStatus = member.getNumOpenTasks() + " open task"; if (member.getNumOpenTasks() > 1) { taskStatus += "s"; } Label memberWorkStatus = new Label(bugStatus + " - " + taskStatus); memberInfo.addComponent(memberWorkStatus); memberInfo.setWidth("100%"); blockTop.addComponent(memberInfo); blockTop.setExpandRatio(memberInfo, 1.0f); blockTop.setWidth("100%"); blockContent.addComponent(blockTop); blockContent.setWidth("100%"); memberBlock.addComponent(blockContent); return memberBlock; }
From source file:com.esofthead.mycollab.module.project.view.settings.ProjectRoleReadViewImpl.java
License:Open Source License
public ProjectRoleReadViewImpl() { this.headerText = new Label(); headerText.setCaption(AppContext.getMessage(ProjectRoleI18nEnum.FORM_READ_TITLE)); headerText.setIcon(FontAwesome.USERS); headerText.addStyleName("header-text"); this.headerText.setSizeUndefined(); this.addComponent(constructHeader()); previewForm = initPreviewForm();//ww w . j a va 2 s . com ComponentContainer actionControls = createButtonControls(); if (actionControls != null) { actionControls.addStyleName("control-buttons"); } addHeaderRightContent(actionControls); CssLayout contentWrapper = new CssLayout(); contentWrapper.setStyleName("content-wrapper"); previewLayout = new DefaultReadViewLayout(""); contentWrapper.addComponent(previewLayout); previewLayout.addBody(previewForm); this.addComponent(contentWrapper); }
From source file:com.esofthead.mycollab.module.project.view.task.FilterTaskViewImpl.java
License:Open Source License
public FilterTaskViewImpl() { this.setMargin(new MarginInfo(false, true, true, true)); final HorizontalLayout header = new HorizontalLayout(); header.setSpacing(true);/*ww w . ja v a 2 s .c om*/ header.setMargin(new MarginInfo(true, false, true, false)); header.setStyleName(UIConstants.HEADER_VIEW); header.setWidth("100%"); Image titleIcon = new Image(null, MyCollabResource.newResource("icons/24/project/task.png")); headerText = new Label(); headerText.setSizeUndefined(); headerText.setStyleName(UIConstants.HEADER_TEXT); Button backtoTaskListBtn = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_BACK_TO_DASHBOARD), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { EventBusFactory.getInstance().post(new TaskListEvent.GotoTaskListScreen(this, null)); } }); backtoTaskListBtn.setStyleName(UIConstants.THEME_GREEN_LINK); UiUtils.addComponent(header, titleIcon, Alignment.TOP_LEFT); UiUtils.addComponent(header, headerText, Alignment.MIDDLE_LEFT); UiUtils.addComponent(header, backtoTaskListBtn, Alignment.MIDDLE_RIGHT); header.setExpandRatio(headerText, 1.0f); this.addComponent(header); HorizontalLayout contentLayout = new HorizontalLayout(); contentLayout.setWidth("100%"); contentLayout.setSpacing(true); this.addComponent(contentLayout); this.taskTableDisplay = new TaskTableDisplay(Arrays.asList(TaskTableFieldDef.taskname, TaskTableFieldDef.startdate, TaskTableFieldDef.duedate, TaskTableFieldDef.percentagecomplete)); this.taskTableDisplay.addTableListener(new TableClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(final TableClickEvent event) { final SimpleTask task = (SimpleTask) event.getData(); if ("taskname".equals(event.getFieldName())) { EventBusFactory.getInstance() .post(new TaskEvent.GotoRead(FilterTaskViewImpl.this, task.getId())); } } }); taskTableDisplay.setWidth("100%"); taskTableDisplay.setStyleName("filter-task-table"); leftColumn = new VerticalLayout(); leftColumn.addComponent(taskTableDisplay); leftColumn.setStyleName("depotComp"); leftColumn.setMargin(new MarginInfo(true, true, false, false)); rightColumn = new VerticalLayout(); rightColumn.setWidth("300px"); contentLayout.addComponent(leftColumn); contentLayout.addComponent(rightColumn); contentLayout.setExpandRatio(leftColumn, 1.0f); unresolvedTaskByAssigneeWidget = new UnresolvedTaskByAssigneeWidget(); rightColumn.addComponent(unresolvedTaskByAssigneeWidget); unresolvedTaskByPriorityWidget = new UnresolvedTaskByPriorityWidget(); rightColumn.addComponent(unresolvedTaskByPriorityWidget); }
From source file:com.esofthead.mycollab.module.project.view.user.ProjectListComponent.java
License:Open Source License
public ProjectListComponent() { super();/*from w w w.j a va2 s. co m*/ withSpacing(true).withMargin(false).withWidth("100%").withStyleName("project-list-comp"); MHorizontalLayout headerBar = new MHorizontalLayout(); headerPopupButton = new PopupButton(); headerPopupButton.setStyleName("project-list-comp-hdr"); headerPopupButton.setWidth("100%"); Label componentHeader = new Label(); componentHeader.setStyleName("h2"); headerPopupButton.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.PROJECT)); headerBar.with(headerPopupButton); if (AppContext.canBeYes(RolePermissionCollections.CREATE_NEW_PROJECT)) { final Button createProjectBtn = new Button("+", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { final ProjectAddWindow projectNewWindow = new ProjectAddWindow(); UI.getCurrent().addWindow(projectNewWindow); } }); createProjectBtn.setStyleName("add-project-btn"); createProjectBtn.setDescription("New Project"); createProjectBtn.setWidth("20px"); createProjectBtn.setHeight("20px"); headerBar.with(createProjectBtn).withAlign(createProjectBtn, Alignment.MIDDLE_RIGHT); } headerBar.withWidth("100%").withSpacing(true).expand(headerPopupButton); this.addComponent(headerBar); contentLayout = new MVerticalLayout().withStyleName("project-list-comp-content").withWidth("205px"); projectList = new ProjectPagedList(); headerPopupButton.setContent(projectList); projectDesc = new Label("", ContentMode.HTML); projectDesc.setStyleName("project-description"); addComponent(projectDesc); }
From source file:com.esofthead.mycollab.module.project.view.user.ProjectMembersWidget.java
License:Open Source License
public ProjectMembersWidget() { withSpacing(false).withMargin(false); titleLbl = new Label(); MHorizontalLayout header = new MHorizontalLayout().withSpacing(true) .withMargin(new MarginInfo(false, true, false, true)).withHeight("34px").withWidth("100%") .with(titleLbl).withAlign(titleLbl, Alignment.MIDDLE_CENTER); header.addStyleName("panel-header"); memberList = new DefaultBeanPagedList<>(ApplicationContextUtil.getSpringBean(ProjectMemberService.class), new MemberRowDisplayHandler()); this.with(header, memberList); }
From source file:com.esofthead.mycollab.vaadin.ui.BlockWidget.java
License:Open Source License
public BlockWidget() { super();// w w w . ja v a 2s .c o m this.setStyleName("block-widget"); title = new Label(); title.setStyleName("block-header"); super.addComponent(title); body = new CssLayout(); body.setWidth("100%"); body.setStyleName("block-body"); super.addComponent(body); }