List of usage examples for com.vaadin.ui Label setDescription
public void setDescription(String description)
From source file:com.cavisson.gui.dashboard.components.controls.CommonParts.java
License:Apache License
Panel tooltips() { Panel p = new Panel("Tooltips"); HorizontalLayout content = new HorizontalLayout() { {//w w w. j av a2 s.c o m setSpacing(true); setMargin(true); addStyleName("wrapping"); addComponent(new Label("Try out different tooltips/descriptions by hovering over the labels.")); Label label = new Label("Simple"); label.addStyleName("bold"); label.setDescription("Simple tooltip message"); addComponent(label); label = new Label("Long"); label.addStyleName("bold"); label.setDescription( "Long tooltip message. Inmensae subtilitatis, obscuris et malesuada fames. Salutantibus vitae elit libero, a pharetra augue."); addComponent(label); label = new Label("HTML tooltip"); label.addStyleName("bold"); label.setDescription( "<div><h1>Ut enim ad minim veniam, quis nostrud exercitation</h1><p><span>Morbi fringilla convallis sapien, id pulvinar odio volutpat.</span> <span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus.</span> <span>Donec sed odio operae, eu vulputate felis rhoncus.</span> <span>At nos hinc posthac, sitientis piros Afros.</span> <span>Tu quoque, Brute, fili mi, nihil timor populi, nihil!</span></p><p><span>Gallia est omnis divisa in partes tres, quarum.</span> <span>Praeterea iter est quasdam res quas ex communi.</span> <span>Cum ceteris in veneratione tui montes, nascetur mus.</span> <span>Quam temere in vitiis, legem sancimus haerentia.</span> <span>Idque Caesaris facere voluntate liceret: sese habere.</span></p></div>"); addComponent(label); label = new Label("With an error message"); label.addStyleName("bold"); label.setDescription("Simple tooltip message"); label.setComponentError(new UserError("Something terrible has happened")); addComponent(label); label = new Label("With a long error message"); label.addStyleName("bold"); label.setDescription("Simple tooltip message"); label.setComponentError(new UserError( "<h2>Contra legem facit qui id facit quod lex prohibet <span>Tityre, tu patulae recubans sub tegmine fagi dolor.</span> <span>Tityre, tu patulae recubans sub tegmine fagi dolor.</span> <span>Prima luce, cum quibus mons aliud consensu ab eo.</span> <span>Quid securi etiam tamquam eu fugiat nulla pariatur.</span> <span>Fabio vel iudice vincam, sunt in culpa qui officia.</span> <span>Nihil hic munitissimus habendi senatus locus, nihil horum?</span></p><p><span>Plura mihi bona sunt, inclinet, amari petere vellent.</span> <span>Integer legentibus erat a ante historiarum dapibus.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Nec dubitamus multa iter quae et nos invenerat.</span> <span>Quisque ut dolor gravida, placerat libero vel, euismod.</span> <span>Quae vero auctorem tractata ab fiducia dicuntur.</span></h2>", AbstractErrorMessage.ContentMode.HTML, ErrorLevel.CRITICAL)); addComponent(label); label = new Label("Error message only"); label.addStyleName("bold"); label.setComponentError(new UserError("Something terrible has happened")); addComponent(label); } }; p.setContent(content); return p; }
From source file:com.cms.utils.InitDateTime.java
public InitDateTime() { date.setWidth("100.0%"); date.setHeight("-1px"); final PopupDateField popupDateField = new PopupDateField(); float dateWidth = date.getWidth() - 14; popupDateField.setWidth(String.valueOf(dateWidth)); popupDateField.setId("date"); // popupDateField.addStyleName("v-textfield v-widget v-textfield-required v-required v-has-width"); popupDateField.setLocale(new Locale("vi")); popupDateField.setImmediate(false);// w ww .j ava2 s. c o m popupDateField.setValidationVisible(false); popupDateField.addBlurListener(new FieldEvents.BlurListener() { @Override public void blur(FieldEvents.BlurEvent event) { com.vaadin.ui.JavaScript.getCurrent().execute("setValueDate();"); } }); popupDateField.addFocusListener(new FieldEvents.FocusListener() { @Override public void focus(FieldEvents.FocusEvent event) { com.vaadin.ui.JavaScript.getCurrent().execute("focusDate();"); } }); Label label = new Label( "<div id=\"error-date\" class=\"v-errorindicator\" onmouseover=\"showError()\" onmouseout=\"hideError()\" aria-hidden=\"true\" style=\"display: none;\"> </div>", ContentMode.HTML); label.setId("label"); // label.addStyleName("v-required-field-indicator"); label.setWidth("14px"); // label.setWidth("10px"); // label.setHeight("10px"); label.setDescription( "<span id=\"notification-date\" style=\" background:#fff;color:red;padding:0\">Ngy thng cha ng nh dng</span>"); date.addComponent(popupDateField); // Page.getCurrent().getJavaScript().execute("addCsstotip()"); date.addComponent(label); date.setExpandRatio(popupDateField, 3); date.setExpandRatio(label, 1); // layoutMain.addComponent(date); }
From source file:com.esofthead.mycollab.common.ui.components.CommentRowDisplayHandler.java
License:Open Source License
@Override public Component generateRow(final SimpleComment comment, int rowIndex) { final MHorizontalLayout layout = new MHorizontalLayout().withSpacing(true).withMargin(false) .withWidth("100%").withStyleName("message"); MVerticalLayout userBlock = new MVerticalLayout().withSpacing(true).withMargin(false).withWidth("80px"); userBlock.setDefaultComponentAlignment(Alignment.TOP_CENTER); ClickListener gotoUser = new ClickListener() { private static final long serialVersionUID = 1L; @Override/*from w ww . ja v a 2 s .com*/ public void buttonClick(ClickEvent event) { EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoRead(this, comment.getCreateduser())); } }; Button userAvatarBtn = UserAvatarControlFactory.createUserAvatarButtonLink(comment.getOwnerAvatarId(), comment.getOwnerFullName()); userAvatarBtn.addClickListener(gotoUser); userBlock.addComponent(userAvatarBtn); Button userName = new Button(comment.getOwnerFullName()); userName.setStyleName("user-name"); userName.addStyleName("link"); userName.addStyleName(UIConstants.WORD_WRAP); userName.addClickListener(gotoUser); userBlock.addComponent(userName); layout.addComponent(userBlock); CssLayout rowLayout = new CssLayout(); rowLayout.setStyleName("message-container"); rowLayout.setWidth("100%"); MHorizontalLayout messageHeader = new MHorizontalLayout().withSpacing(true) .withMargin(new MarginInfo(true, true, false, true)).withWidth("100%") .withStyleName("message-header"); messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label timePostLbl = new Label( AppContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(), DateTimeUtils.getPrettyDateValue(comment.getCreatedtime(), AppContext.getUserLocale())), ContentMode.HTML); timePostLbl.setDescription(AppContext.formatDateTime(comment.getCreatedtime())); timePostLbl.setSizeUndefined(); timePostLbl.setStyleName("time-post"); messageHeader.addComponent(timePostLbl); messageHeader.setExpandRatio(timePostLbl, 1.0f); // Message delete button Button msgDeleteBtn = new Button(); msgDeleteBtn.setIcon(FontAwesome.TRASH_O); msgDeleteBtn.setStyleName(UIConstants.BUTTON_ICON_ONLY); messageHeader.addComponent(msgDeleteBtn); if (hasDeletePermission(comment)) { msgDeleteBtn.setVisible(true); msgDeleteBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { 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()) { CommentService commentService = ApplicationContextUtil .getSpringBean(CommentService.class); commentService.removeWithSession(comment.getId(), AppContext.getUsername(), AppContext.getAccountId()); CommentRowDisplayHandler.this.owner.removeRow(layout); } } }); } }); } else { msgDeleteBtn.setVisible(false); } rowLayout.addComponent(messageHeader); Label messageContent = new UrlDetectableLabel(comment.getComment()); messageContent.setStyleName("message-body"); rowLayout.addComponent(messageContent); List<Content> attachments = comment.getAttachments(); if (!CollectionUtils.isEmpty(attachments)) { MVerticalLayout messageFooter = new MVerticalLayout().withSpacing(false).withMargin(true) .withWidth("100%").withStyleName("message-footer"); AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments); attachmentDisplay.setWidth("100%"); messageFooter.addComponent(attachmentDisplay); messageFooter.setComponentAlignment(attachmentDisplay, Alignment.MIDDLE_RIGHT); rowLayout.addComponent(messageFooter); } layout.addComponent(rowLayout); layout.setExpandRatio(rowLayout, 1.0f); return layout; }
From source file:com.esofthead.mycollab.module.crm.ui.components.DateInfoComp.java
License:Open Source License
public void displayEntryDateTime(ValuedBean bean) { this.removeAllComponents(); this.withMargin(new MarginInfo(true, false, true, true)); Label dateInfoHeader = new Label( FontAwesome.CALENDAR.getHtml() + " " + AppContext.getMessage(CrmCommonI18nEnum.SUB_INFO_DATES), ContentMode.HTML);//from w w w . j a va 2s .com dateInfoHeader.setStyleName("info-hdr"); this.addComponent(dateInfoHeader); MVerticalLayout layout = new MVerticalLayout().withMargin(new MarginInfo(false, false, false, true)) .withWidth("100%"); try { Date createdDate = (Date) PropertyUtils.getProperty(bean, "createdtime"); Label createdDateLbl = new Label(AppContext.getMessage(CrmCommonI18nEnum.ITEM_CREATED_DATE, DateTimeUtils.getPrettyDateValue(createdDate, AppContext.getUserLocale()))); createdDateLbl.setDescription(AppContext.formatDateTime(createdDate)); Date updatedDate = (Date) PropertyUtils.getProperty(bean, "lastupdatedtime"); Label updatedDateLbl = new Label(AppContext.getMessage(CrmCommonI18nEnum.ITEM_UPDATED_DATE, DateTimeUtils.getPrettyDateValue(updatedDate, AppContext.getUserLocale()))); updatedDateLbl.setDescription(AppContext.formatDateTime(updatedDate)); layout.with(createdDateLbl, updatedDateLbl); this.addComponent(layout); } catch (Exception e) { LOG.error("Get date is failed {}", BeanUtility.printBeanObj(bean)); } }
From source file:com.esofthead.mycollab.module.project.ui.components.DateInfoComp.java
License:Open Source License
public void displayEntryDateTime(ValuedBean bean) { this.removeAllComponents(); this.withMargin(new MarginInfo(false, false, false, true)); Label dateInfoHeader = new Label( FontAwesome.CALENDAR.getHtml() + " " + AppContext.getMessage(ProjectCommonI18nEnum.SUB_INFO_DATES), ContentMode.HTML);/*from w ww . jav a 2s.co m*/ dateInfoHeader.setStyleName("info-hdr"); this.addComponent(dateInfoHeader); MVerticalLayout layout = new MVerticalLayout().withMargin(new MarginInfo(false, false, false, true)) .withWidth("100%"); try { Date createdDate = (Date) PropertyUtils.getProperty(bean, "createdtime"); Label createdDateLbl = new Label(AppContext.getMessage(ProjectCommonI18nEnum.ITEM_CREATED_DATE, DateTimeUtils.getPrettyDateValue(createdDate, AppContext.getUserLocale()))); createdDateLbl.setDescription(AppContext.formatDateTime(createdDate)); layout.addComponent(createdDateLbl); Date updatedDate = (Date) PropertyUtils.getProperty(bean, "lastupdatedtime"); Label updatedDateLbl = new Label(AppContext.getMessage(ProjectCommonI18nEnum.ITEM_UPDATED_DATE, DateTimeUtils.getPrettyDateValue(updatedDate, AppContext.getUserLocale()))); updatedDateLbl.setDescription(AppContext.formatDateTime(updatedDate)); layout.addComponent(updatedDateLbl); this.addComponent(layout); } catch (Exception e) { LOG.error("Get date is failed {}", BeanUtility.printBeanObj(bean)); } }
From source file:com.esofthead.mycollab.vaadin.ui.form.field.PrettyDateTimeViewField.java
License:Open Source License
@Override protected Component initContent() { final Label l = new Label(); l.setWidth("100%"); if (date == null) { l.setValue(" "); l.setContentMode(ContentMode.HTML); } else {/* ww w. j a v a 2 s.c o m*/ l.setValue(AppContext.formatPrettyTime(date)); l.setDescription(AppContext.formatDateTime(date)); } return l; }
From source file:com.esofthead.mycollab.vaadin.ui.form.field.PrettyDateViewField.java
License:Open Source License
@Override protected Component initContent() { final Label l = new Label(); l.setWidth("100%"); if (date == null) { l.setValue(" "); l.setContentMode(ContentMode.HTML); } else {/* ww w . j ava 2 s. c o m*/ l.setValue(AppContext.formatPrettyTime(date)); l.setDescription(AppContext.formatDate(date)); } return l; }
From source file:com.hybridbpm.ui.UsersMenu.java
License:Apache License
public void search(String text) { table.removeAllItems();//www.j ava 2s.com List<User> list = HybridbpmUI.getAccessAPI().findUsersByName(text); for (User u : list) { Item item = table.addItem(u); Label notificationsBadge = new Label("45"); notificationsBadge.addStyleName(ValoTheme.MENU_BADGE); notificationsBadge.addStyleName(ValoTheme.LABEL_TINY); notificationsBadge.setWidthUndefined(); notificationsBadge.setDescription("45 task todo"); item.getItemProperty("tasks").setValue(notificationsBadge); } // table.select(list.get(0)); }
From source file:com.jiangyifen.ec2.ui.csr.toolbar.CsrPhone2PhoneSettingWindow.java
/** * ?/*from w w w.j ava 2 s.c om*/ * @param mainLayout */ private void createlStartSetting(VerticalLayout mainLayout) { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); mainLayout.addComponent(layout); Label caption = new Label("??"); caption.setWidth("-1px"); caption.setDescription( "<B>????</B>"); layout.addComponent(caption); startSettingOption = new OptionGroup(); startSettingOption.addItem(true); startSettingOption.addItem(false); startSettingOption.setItemCaption(true, "?"); startSettingOption.setItemCaption(false, ""); startSettingOption.setImmediate(true); startSettingOption.setValue(false); startSettingOption.setReadOnly(true); startSettingOption.setDescription( "<B>????</B>"); startSettingOption.setNullSelectionAllowed(false); startSettingOption.addStyleName("twocol200"); startSettingOption.addStyleName("myopacity"); layout.addComponent(startSettingOption); }
From source file:com.jiangyifen.ec2.ui.csr.toolbar.CsrPhone2PhoneSettingWindow.java
/** * (????)/*from w w w .ja va 2 s .co m*/ * @param mainLayout */ private void createlDaysOfWeekType(VerticalLayout mainLayout) { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); mainLayout.addComponent(layout); Label caption = new Label(""); caption.setWidth("-1px"); caption.setDescription("<B>?</B>"); layout.addComponent(caption); dayOfWeekTypeSelector = new ComboBox(); dayOfWeekTypeSelector.addItem("weekday"); dayOfWeekTypeSelector.setItemCaption("weekday", ""); dayOfWeekTypeSelector.addItem("weekend"); dayOfWeekTypeSelector.setItemCaption("weekend", ""); dayOfWeekTypeSelector.addItem("custom"); dayOfWeekTypeSelector.setItemCaption("custom", ""); dayOfWeekTypeSelector.setWidth("200px"); dayOfWeekTypeSelector.setImmediate(true); dayOfWeekTypeSelector.setReadOnly(true); dayOfWeekTypeSelector.setDescription("<B>?</B>"); dayOfWeekTypeSelector.setNullSelectionAllowed(false); dayOfWeekTypeSelector.addListener(this); layout.addComponent(dayOfWeekTypeSelector); }