List of usage examples for com.vaadin.ui HorizontalLayout setDefaultComponentAlignment
@Override public void setDefaultComponentAlignment(Alignment defaultAlignment)
From source file:com.esofthead.mycollab.mobile.module.crm.view.cases.CaseReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createBottomPanel() { HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); toolbarLayout.setSpacing(true);/* w ww . ja v a 2 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 CaseEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateContacts))); } }); toolbarLayout.addComponent(relatedContacts); 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 CaseEvent.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 CaseEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities))); } }); toolbarLayout.addComponent(relatedActivities); return toolbarLayout; }
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);// w w w . j av a 2 s . c o m 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 w w w .j a v a2 s . co m 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);//from w w w . j a v a 2 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.view.bug.BugReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createBottomPanel() { HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); toolbarLayout.setSpacing(true);/* ww w . jav a 2 s . c om*/ 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 = -7469027678729887223L; @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.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);// w w w. j a v a 2 s .com 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.module.project.view.task.TaskGroupReadViewImpl.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 ava 2 s .c o m*/ 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 = 2276465280812964681L; @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.module.project.view.task.TaskReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createBottomPanel() { HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); toolbarLayout.setSpacing(true);/* ww w .j ava2 s .c o m*/ 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 = 4889821151518627676L; @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 renderAttachmentRow(final Content attachment) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); HorizontalLayout attachmentRow = new HorizontalLayout(); attachmentRow.setStyleName("attachment-row"); attachmentRow.setWidth("100%"); attachmentRow.setSpacing(true);//from ww w . j av a2 s. c o m attachmentRow.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); attachmentRow.addComponent(thumbnailWrap); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); } if (MimeTypesUtil.isImageType(docName)) { Button b = new Button(attachment.getTitle(), new Button.ClickListener() { private static final long serialVersionUID = -1713187920922886934L; @Override public void buttonClick(Button.ClickEvent event) { AttachmentPreviewView previewView = new AttachmentPreviewView(VaadinResourceManager .getResourceManager().getImagePreviewResource(attachment.getPath(), DEFAULT_SOURCE)); EventBusFactory.getInstance().post(new ShellEvent.PushView(this, previewView)); } }); b.setWidth("100%"); attachmentRow.addComponent(b); attachmentRow.setExpandRatio(b, 1.0f); } else { Label l = new Label(attachment.getTitle()); l.setWidth("100%"); attachmentRow.addComponent(l); attachmentRow.setExpandRatio(l, 1.0f); } return attachmentRow; }
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()); }/*from ww w.j av a 2 s. c o m*/ 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; }