List of usage examples for com.vaadin.ui Button setHtmlContentAllowed
@Deprecated public void setHtmlContentAllowed(boolean htmlContentAllowed)
From source file:com.esofthead.mycollab.mobile.module.crm.view.contact.ContactReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createBottomPanel() { HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); toolbarLayout.setSpacing(true);//from w w w .j av a2 s .c om Button relatedOpportunities = new Button(); relatedOpportunities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_OPPORTUNITY + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_OPPORTUNITY) + "</div>"); relatedOpportunities.setHtmlContentAllowed(true); relatedOpportunities.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 7589415773039335559L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post(new ContactEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateOpportunityList))); } }); toolbarLayout.addComponent(relatedOpportunities); Button relatedNotes = new Button(); relatedNotes.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_DOCUMENT + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_NOTE) + "</div>"); relatedNotes.setHtmlContentAllowed(true); relatedNotes.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 7589415773039335559L; @Override public void buttonClick(ClickEvent evt) { EventBusFactory.getInstance().post( new ContactEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(noteListItems))); } }); toolbarLayout.addComponent(relatedNotes); Button relatedActivities = new Button(); relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>"); relatedActivities.setHtmlContentAllowed(true); relatedActivities.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 7589415773039335559L; @Override public void buttonClick(ClickEvent evt) { EventBusFactory.getInstance().post(new ContactEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivityList))); } }); toolbarLayout.addComponent(relatedActivities); return toolbarLayout; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.lead.LeadReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createBottomPanel() { HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); toolbarLayout.setSpacing(true);//from ww w. j a va 2 s.c om Button relatedCampaigns = new Button(); relatedCampaigns.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CAMPAIGN + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_CAMPAIGN) + "</div>"); relatedCampaigns.setHtmlContentAllowed(true); relatedCampaigns.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 7027681785871215444L; @Override public void buttonClick(ClickEvent event) { EventBusFactory.getInstance().post(new LeadEvent.GoToRelatedItems(LeadReadViewImpl.this, new CrmRelatedItemsScreenData(associateCampaigns))); } }); toolbarLayout.addComponent(relatedCampaigns); Button relatedNotes = new Button(); relatedNotes.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_DOCUMENT + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_NOTE) + "</div>"); relatedNotes.setHtmlContentAllowed(true); relatedNotes.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 7589415773039335559L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance() .post(new LeadEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateNotes))); } }); toolbarLayout.addComponent(relatedNotes); Button relatedActivities = new Button(); relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>"); relatedActivities.setHtmlContentAllowed(true); relatedActivities.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 7589415773039335559L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post( new LeadEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities))); } }); toolbarLayout.addComponent(relatedActivities); return toolbarLayout; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.opportunity.OpportunityReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createBottomPanel() { HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); toolbarLayout.setSpacing(true);// www . j av a2 s. c o m Button relatedContacts = new Button(); relatedContacts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CONTACT + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_CONTACT) + "</div>"); relatedContacts.setHtmlContentAllowed(true); relatedContacts.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 7589415773039335559L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post(new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateContacts))); } }); toolbarLayout.addComponent(relatedContacts); Button relatedLeads = new Button(); relatedLeads.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_LEAD + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_LEAD) + "</div>"); relatedLeads.setHtmlContentAllowed(true); relatedLeads.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 7589415773039335559L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post( new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateLeads))); } }); toolbarLayout.addComponent(relatedLeads); Button relatedNotes = new Button(); relatedNotes.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_DOCUMENT + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_NOTE) + "</div>"); relatedNotes.setHtmlContentAllowed(true); relatedNotes.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 7589415773039335559L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post( new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateNotes))); } }); toolbarLayout.addComponent(relatedNotes); Button relatedActivities = new Button(); relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>"); relatedActivities.setHtmlContentAllowed(true); relatedActivities.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 7589415773039335559L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post(new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities))); } }); toolbarLayout.addComponent(relatedActivities); return toolbarLayout; }
From source file:com.esofthead.mycollab.mobile.module.project.ui.ProjectCommentInput.java
License:Open Source License
private Component createAttachmentRow(String fileName) { final HorizontalLayout uploadSucceedLayout = new HorizontalLayout(); uploadSucceedLayout.setWidth("100%"); Label uploadResult = new Label(fileName); uploadResult.setWidth("100%"); uploadSucceedLayout.addComponent(uploadResult); uploadSucceedLayout.setExpandRatio(uploadResult, 1.0f); Button removeAttachment = new Button( "<span aria-hidden=\"true\" data-icon=\"" + IconConstants.DELETE + "\"></span>", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*from w ww . j a va 2 s . c o m*/ public void buttonClick(ClickEvent event) { statusWrapper.removeComponent(uploadSucceedLayout); } }); removeAttachment.setHtmlContentAllowed(true); removeAttachment.setStyleName("link"); uploadSucceedLayout.addComponent(removeAttachment); uploadSucceedLayout.setStyleName("upload-succeed-layout"); uploadSucceedLayout.setSpacing(true); return uploadSucceedLayout; }
From source file:com.esofthead.mycollab.mobile.module.project.ui.ProjectCommentInputView.java
License:Open Source License
private Component createAttachmentRow(String fileName) { final MHorizontalLayout uploadSucceedLayout = new MHorizontalLayout().withFullWidth(); Label uploadResult = new Label(fileName); uploadSucceedLayout.with(uploadResult).expand(uploadResult); Button removeAttachment = new Button("", new Button.ClickListener() { @Override// w w w. ja va 2s.c om public void buttonClick(ClickEvent event) { statusWrapper.removeComponent(uploadSucceedLayout); } }); removeAttachment.setIcon(FontAwesome.TRASH); removeAttachment.setHtmlContentAllowed(true); removeAttachment.setStyleName("link"); uploadSucceedLayout.addComponent(removeAttachment); return uploadSucceedLayout; }
From source file:com.esofthead.mycollab.mobile.module.project.ui.TimeLogComp.java
License:Open Source License
public void displayTime(final V bean) { this.removeAllComponents(); HorizontalLayout header = new HorizontalLayout(); header.setSpacing(true);//w w w . ja va 2 s. c o m header.setStyleName("info-hdr"); header.addStyleName("timelog-comp-hdr"); header.setWidth("100%"); Label dateInfoHeader = new Label(AppContext.getMessage(TimeTrackingI18nEnum.SUB_INFO_TIME)); dateInfoHeader.setWidthUndefined(); header.addComponent(dateInfoHeader); header.setExpandRatio(dateInfoHeader, 1.0f); 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) { showEditTimeView(bean); } }); editBtn.setStyleName("link"); editBtn.setHtmlContentAllowed(true); header.addComponent(editBtn); header.setComponentAlignment(editBtn, Alignment.BOTTOM_LEFT); } this.addComponent(header); GridFormLayoutHelper layout = new GridFormLayoutHelper(1, 3, "100%", "150px", Alignment.TOP_RIGHT); layout.getLayout().setWidth("100%"); layout.getLayout().setMargin(false); double billableHours = getTotalBillableHours(bean); double nonBillableHours = getTotalNonBillableHours(bean); double remainHours = getRemainedHours(bean); layout.addComponent(new Label(billableHours + ""), AppContext.getMessage(TimeTrackingI18nEnum.M_FORM_BILLABLE_HOURS), 0, 0); layout.addComponent(new Label(nonBillableHours + ""), AppContext.getMessage(TimeTrackingI18nEnum.M_FORM_NON_BILLABLE_HOURS), 0, 1); layout.addComponent(new Label(remainHours + ""), AppContext.getMessage(TimeTrackingI18nEnum.M_FORM_REMAIN_HOURS), 0, 2); this.addComponent(layout.getLayout()); }
From source file:com.esofthead.mycollab.mobile.module.project.view.milestone.MilestoneReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createBottomPanel() { HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); toolbarLayout.setSpacing(true);/* ww w. j a va 2 s .c om*/ Button relatedBugs = new Button(); relatedBugs.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.PROJECT_BUG + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(ProjectCommonI18nEnum.VIEW_BUG) + "</div>"); relatedBugs.setHtmlContentAllowed(true); relatedBugs.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 2113811477874305745L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post(new ShellEvent.PushView(this, getRelatedBugs())); } }); toolbarLayout.addComponent(relatedBugs); Button relatedTasks = new Button(); relatedTasks.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.PROJECT_TASK + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(ProjectCommonI18nEnum.VIEW_TASK) + "</div>"); relatedTasks.setHtmlContentAllowed(true); relatedTasks.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -9171495386840452500L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post(new ShellEvent.PushView(this, getRelatedTasks())); } }); toolbarLayout.addComponent(relatedTasks); relatedComments = new Button(); relatedComments.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.PROJECT_MESSAGE + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(ProjectCommonI18nEnum.TAB_COMMENT) + "</div>"); relatedComments.setHtmlContentAllowed(true); relatedComments.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 2206489649468573076L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post(new ShellEvent.PushView(this, associateComments)); } }); toolbarLayout.addComponent(relatedComments); return toolbarLayout; }
From source file:com.esofthead.mycollab.mobile.ui.MobileAttachmentUtils.java
License:Open Source License
public static Component renderAttachmentFieldRow(final Content attachment, Button.ClickListener additionalListener) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); }//w w w .j a v a 2s .com final HorizontalLayout attachmentLayout = new HorizontalLayout(); attachmentLayout.setSpacing(true); attachmentLayout.setStyleName("attachment-row"); attachmentLayout.setWidth("100%"); attachmentLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); CssLayout thumbnailWrap = new CssLayout(); thumbnailWrap.setWidth("25px"); thumbnailWrap.setHeight("40px"); thumbnailWrap.setStyleName("thumbnail-wrap"); Image thumbnail = new Image(null); if (org.apache.commons.lang3.StringUtils.isBlank(attachment.getThumbnail())) { thumbnail.setSource(DEFAULT_SOURCE); } else { thumbnail.setSource(VaadinResourceManager.getResourceManager() .getImagePreviewResource(attachment.getThumbnail(), DEFAULT_SOURCE)); } thumbnail.setWidth("100%"); thumbnailWrap.addComponent(thumbnail); attachmentLayout.addComponent(thumbnailWrap); Label attachmentLink = new Label(docName); attachmentLayout.addComponent(attachmentLink); attachmentLayout.setExpandRatio(attachmentLink, 1.0f); Button removeAttachment = new Button( "<span aria-hidden=\"true\" data-icon=\"" + IconConstants.DELETE + "\"></span>", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { ConfirmDialog.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.CONFIRM_DELETE_ATTACHMENT), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.CloseListener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { ResourceService attachmentService = ApplicationContextUtil .getSpringBean(ResourceService.class); attachmentService.removeResource(attachment.getPath(), AppContext.getUsername(), AppContext.getAccountId()); ((ComponentContainer) attachmentLayout.getParent()) .removeComponent(attachmentLayout); } } }); } }); if (additionalListener != null) { removeAttachment.addClickListener(additionalListener); } removeAttachment.setHtmlContentAllowed(true); removeAttachment.setStyleName("link"); attachmentLayout.addComponent(removeAttachment); return attachmentLayout; }
From source file:com.kpg.diary.ui.MenuLayout.java
License:Apache License
/** * Builds the menu./* w w w .j ava2 s . com*/ * * @param navigator * the navigator * @return the css layout */ private CssLayout buildMenu(Navigator navigator) { // Add items menuItemsMap(); HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.addStyleName(ValoTheme.MENU_TITLE); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName(ValoTheme.MENU_TITLE); menu.addComponent(top); // menu.addComponent(createThemeSelect()); menu.addComponent(top); Button showMenu = new Button("Menu", new ClickListener() { @Override public void buttonClick(ClickEvent event) { if (menu.getStyleName().contains("valo-menu-visible")) { menu.removeStyleName("valo-menu-visible"); } else { menu.addStyleName("valo-menu-visible"); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName("valo-menu-toggle"); showMenu.setIcon(FontAwesome.LIST); menu.addComponent(showMenu); Label title = new Label("<h2>Diary</h2>", ContentMode.HTML); title.setSizeUndefined(); top.addComponent(title); top.setExpandRatio(title, 1); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); for (final Entry<String, String> item : menuItems.entrySet()) { Button b = new Button(item.getValue(), new ClickListener() { @Override public void buttonClick(ClickEvent event) { navigator.navigateTo(item.getKey()); } }); b.setHtmlContentAllowed(true); b.setPrimaryStyleName(ValoTheme.MENU_ITEM); if (IConstants.NavigationMenu.ADDRESS.getKey().equals(item.getKey())) { b.setIcon(FontAwesome.BOOK); } else if (IConstants.NavigationMenu.PERSON.getKey().equals(item.getKey())) { b.setIcon(FontAwesome.USER); } else { b.setIcon(FontAwesome.APPLE); } menuItemsLayout.addComponent(b); } return menu; }
From source file:com.mycollab.mobile.module.crm.view.account.AccountReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createBottomPanel() { HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); toolbarLayout.setSpacing(true);// ww w . j a v a2 s . c om Button relatedContacts = new Button(); relatedContacts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CONTACT + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(ContactI18nEnum.LIST) + "</div>"); relatedContacts.setHtmlContentAllowed(true); relatedContacts.addClickListener(clickEvent -> EventBusFactory.getInstance() .post(new AccountEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateContacts)))); toolbarLayout.addComponent(relatedContacts); Button relatedOpportunities = new Button(); relatedOpportunities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_OPPORTUNITY + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(OpportunityI18nEnum.LIST) + "</div>"); relatedOpportunities.setHtmlContentAllowed(true); relatedOpportunities.addClickListener(clickEvent -> EventBusFactory.getInstance().post( new AccountEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateOpportunities)))); toolbarLayout.addComponent(relatedOpportunities); Button relatedLeads = new Button(); relatedLeads.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_LEAD + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(LeadI18nEnum.LIST) + "</div>"); relatedLeads.setHtmlContentAllowed(true); relatedLeads.addClickListener(clickEvent -> EventBusFactory.getInstance() .post(new AccountEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateLeads)))); toolbarLayout.addComponent(relatedLeads); Button relatedActivities = new Button(); relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>"); relatedActivities.setHtmlContentAllowed(true); relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance() .post(new AccountEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities)))); toolbarLayout.addComponent(relatedActivities); return toolbarLayout; }