List of usage examples for com.vaadin.ui Label Label
public Label(String text, ContentMode contentMode)
From source file:com.esofthead.mycollab.module.project.ui.components.TimeLogComp.java
License:Open Source License
public void displayTime(final V bean) { this.removeAllComponents(); this.withSpacing(true).withMargin(new MarginInfo(false, false, false, true)); HorizontalLayout header = new MHorizontalLayout().withSpacing(true).withMargin(false); Label dateInfoHeader = new Label( FontAwesome.CLOCK_O.getHtml() + " " + AppContext.getMessage(TimeTrackingI18nEnum.SUB_INFO_TIME), ContentMode.HTML);/* w ww. j a va2 s . c om*/ dateInfoHeader.setStyleName("info-hdr"); header.addComponent(dateInfoHeader); if (hasEditPermission()) { Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { showEditTimeWindow(bean); } }); editBtn.setStyleName("link"); editBtn.addStyleName("info-hdr"); header.addComponent(editBtn); } this.addComponent(header); MVerticalLayout layout = new MVerticalLayout().withWidth("100%").withSpacing(true) .withMargin(new MarginInfo(false, false, false, true)); double billableHours = getTotalBillableHours(bean); double nonBillableHours = getTotalNonBillableHours(bean); double remainHours = getRemainedHours(bean); layout.addComponent(new Label( String.format(AppContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS), billableHours))); layout.addComponent(new Label(String .format(AppContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS), nonBillableHours))); layout.addComponent(new Label( String.format(AppContext.getMessage(TimeTrackingI18nEnum.OPT_REMAIN_HOURS), remainHours))); this.addComponent(layout); }
From source file:com.esofthead.mycollab.module.project.ui.form.ProjectFormAttachmentDisplayField.java
License:Open Source License
@Override protected Component initContent() { final Component comp = ProjectAttachmentDisplayComponentFactory.getAttachmentDisplayComponent(projectid, type, typeid);/*from w w w . j a v a 2 s .c o m*/ if (comp == null || !(comp instanceof AttachmentDisplayComponent)) { return new Label(" ", ContentMode.HTML); } else { return comp; } }
From source file:com.esofthead.mycollab.module.project.ui.format.MilestoneHistoryFieldFormat.java
License:Open Source License
@Override public Component toVaadinComponent(String value) { try {/* ww w . j a va 2s . c o m*/ int milestoneId = Integer.parseInt(value); String html = ProjectLinkBuilder.generateMilestoneHtmlLink(milestoneId); return new Label(html, ContentMode.HTML); } catch (NumberFormatException e) { return new Label(""); } }
From source file:com.esofthead.mycollab.module.project.ui.format.ProjectMemberHistoryFieldFormat.java
License:Open Source License
@Override public Component toVaadinComponent(String value) { String html = ProjectLinkBuilder.generateProjectMemberHtmlLink(value, CurrentProjectVariables.getProjectId()); return (value != null) ? new Label(html, ContentMode.HTML) : new Label(""); }
From source file:com.esofthead.mycollab.module.project.ui.format.TaskGroupHistoryFieldFormat.java
License:Open Source License
@Override public Component toVaadinComponent(String value) { try {/* w w w.j a va 2s .co m*/ int taskgroupId = Integer.parseInt(value); String html = ProjectLinkBuilder.generateTaskGroupHtmlLink(taskgroupId); return new Label(html, ContentMode.HTML); } catch (NumberFormatException e) { return new Label(""); } }
From source file:com.esofthead.mycollab.module.project.view.AbstractProjectPageView.java
License:Open Source License
public AbstractProjectPageView(String headerText, FontAwesome icon) { super();//w w w. j ava 2 s . c o m this.headerText = new Label(icon.getHtml() + " " + headerText, ContentMode.HTML); super.addComponent(constructHeader()); contentWrapper = new CssLayout(); contentWrapper.setStyleName("content-wrapper"); super.addComponent(contentWrapper); }
From source file:com.esofthead.mycollab.module.project.view.assignments.gantt.AssignmentNameCellField.java
License:Open Source License
@Override protected Component initContent() { MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%"); layout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); field.setBuffered(true);//from w w w . j a va 2s .co m field.setWidth("100%"); Label icon = new Label(ProjectAssetsManager.getAsset(type).getHtml(), ContentMode.HTML); layout.with(new CssLayout(icon), field).expand(field); return layout; }
From source file:com.esofthead.mycollab.module.project.view.assignments.GanttChartViewImpl.java
License:Open Source License
private void constructUI() { MHorizontalLayout header = new MHorizontalLayout().withMargin(new MarginInfo(false, false, true, false)) .withStyleName("hdr-view").withWidth("100%"); header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label headerText = new Label(FontAwesome.BAR_CHART_O.getHtml() + " Gantt chart", ContentMode.HTML); headerText.setStyleName(ValoTheme.LABEL_H2); headerText.addStyleName(ValoTheme.LABEL_NO_MARGIN); CssLayout headerWrapper = new CssLayout(); headerWrapper.addComponent(headerText); MHorizontalLayout resWrapper = new MHorizontalLayout(); Label resLbl = new Label("Resolution: "); final ComboBox resValue = new ValueComboBox(false, "Day", "Week"); resValue.addValueChangeListener(new Property.ValueChangeListener() { @Override// w ww . j a v a2 s . c o m public void valueChange(Property.ValueChangeEvent event) { String val = (String) resValue.getValue(); if ("Day".equals(val)) { gantt.setResolution(Resolution.Day); } else if ("Week".equals(val)) { gantt.setResolution(Resolution.Week); } } }); resWrapper.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); resWrapper.with(resLbl, resValue); header.with(headerWrapper, resWrapper).withAlign(headerWrapper, Alignment.MIDDLE_LEFT) .expand(headerWrapper); mainLayout = new MHorizontalLayout().withSpacing(false); mainLayout.addStyleName("gantt_container"); mainLayout.setSizeFull(); this.with(header, mainLayout); }
From source file:com.esofthead.mycollab.module.project.view.bug.components.ToggleBugSummaryField.java
License:Open Source License
public ToggleBugSummaryField(final BugWithBLOBs bug, int trimCharacters) { this.bug = bug; this.maxLength = trimCharacters; titleLinkLbl = new Label(buildBugLink(), ContentMode.HTML); titleLinkLbl.addStyleName(UIConstants.LABEL_WORD_WRAP); titleLinkLbl.setWidthUndefined();//from ww w . j ava 2 s .c o m this.addComponent(titleLinkLbl); buttonControls = new MHorizontalLayout().withStyleName("toggle").withSpacing(false); if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)) { this.addStyleName("editable-field"); Button instantEditBtn = new Button(null, new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { if (isRead) { ToggleBugSummaryField.this.removeComponent(titleLinkLbl); ToggleBugSummaryField.this.removeComponent(buttonControls); final TextField editField = new TextField(); editField.setValue(bug.getSummary()); editField.setWidth("100%"); editField.focus(); ToggleBugSummaryField.this.addComponent(editField); ToggleBugSummaryField.this.removeStyleName("editable-field"); editField.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { updateFieldValue(editField); } }); editField.addBlurListener(new FieldEvents.BlurListener() { @Override public void blur(FieldEvents.BlurEvent event) { updateFieldValue(editField); } }); isRead = !isRead; } } }); instantEditBtn.setDescription("Edit task name"); instantEditBtn.addStyleName(ValoTheme.BUTTON_ICON_ONLY); instantEditBtn.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); instantEditBtn.setIcon(FontAwesome.EDIT); buttonControls.with(instantEditBtn); this.addComponent(buttonControls); } }
From source file:com.esofthead.mycollab.module.project.view.FollowingTicketViewImpl.java
License:Open Source License
public FollowingTicketViewImpl() { this.setWidth("100%"); final MVerticalLayout headerWrapper = new MVerticalLayout().withSpacing(false).withMargin(false) .withWidth("100%").withStyleName("projectfeed-hdr-wrapper"); final MHorizontalLayout header = new MHorizontalLayout().withMargin(false).withWidth("100%"); final Label layoutHeader = new Label(FontAwesome.EYE.getHtml() + " My Following Tickets", ContentMode.HTML); layoutHeader.addStyleName("h2"); header.with(layoutHeader).withAlign(layoutHeader, Alignment.MIDDLE_LEFT).expand(layoutHeader); headerWrapper.addComponent(header);/*from www. j av a 2s.c o m*/ this.addComponent(headerWrapper); MHorizontalLayout controlBtns = new MHorizontalLayout().withSpacing(false) .withMargin(new MarginInfo(true, false, true, false)).withWidth("100%"); final MVerticalLayout contentWrapper = new MVerticalLayout().withSpacing(false).withMargin(false) .withWidth("100%"); contentWrapper.addStyleName("content-wrapper"); contentWrapper.addComponent(controlBtns); this.addComponent(contentWrapper); final Button backBtn = new Button(AppContext.getMessage(FollowerI18nEnum.BUTTON_BACK_TO_WORKBOARD)); backBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { EventBusFactory.getInstance() .post(new ShellEvent.GotoProjectModule(FollowingTicketViewImpl.this, null)); } }); backBtn.addStyleName(UIConstants.THEME_GREEN_LINK); backBtn.setIcon(FontAwesome.ARROW_LEFT); controlBtns.addComponent(backBtn); controlBtns.setExpandRatio(backBtn, 1.0f); Button exportBtn = new Button("Export", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { exportButtonControl.setPopupVisible(true); } }); exportButtonControl = new SplitButton(exportBtn); exportButtonControl.setWidthUndefined(); exportButtonControl.addStyleName(UIConstants.THEME_GRAY_LINK); exportButtonControl.setIcon(FontAwesome.EXTERNAL_LINK); VerticalLayout popupButtonsControl = new VerticalLayout(); exportButtonControl.setContent(popupButtonsControl); Button exportPdfBtn = new Button("Pdf"); FileDownloader pdfDownloader = new FileDownloader(constructStreamResource(ReportExportType.PDF)); pdfDownloader.extend(exportPdfBtn); exportPdfBtn.setIcon(FontAwesome.FILE_PDF_O); exportPdfBtn.setStyleName("link"); popupButtonsControl.addComponent(exportPdfBtn); Button exportExcelBtn = new Button("Excel"); FileDownloader excelDownloader = new FileDownloader(constructStreamResource(ReportExportType.EXCEL)); excelDownloader.extend(exportExcelBtn); exportExcelBtn.setIcon(FontAwesome.FILE_EXCEL_O); exportExcelBtn.setStyleName("link"); popupButtonsControl.addComponent(exportExcelBtn); controlBtns.addComponent(exportButtonControl); searchPanel = new FollowingTicketSearchPanel(); contentWrapper.addComponent(searchPanel); this.ticketTable = new FollowingTicketTableDisplay(); this.ticketTable.addStyleName("full-border-table"); this.ticketTable.setMargin(new MarginInfo(true, false, false, false)); contentWrapper.addComponent(this.ticketTable); }