List of usage examples for com.vaadin.ui HorizontalLayout HorizontalLayout
public HorizontalLayout()
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 . ja va 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 www . jav a 2s. c o 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 ww .ja va 2s . 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 void constructUI() { this.setWidth("100%"); statusWrapper = new CssLayout(); statusWrapper.setWidth("100%"); statusWrapper.setStyleName("upload-status-wrap"); this.addComponent(statusWrapper); inputWrapper = new HorizontalLayout(); inputWrapper.setWidth("100%"); inputWrapper.setStyleName("comment-box"); inputWrapper.setSpacing(true);//from w ww.j a v a 2 s . co m inputWrapper.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); this.prepareUploadField(); inputWrapper.addComponent(uploadField); commentInput = new TextArea(); commentInput.setInputPrompt(AppContext.getMessage(GenericI18Enum.M_NOTE_INPUT_PROMPT)); commentInput.setSizeFull(); inputWrapper.addComponent(commentInput); inputWrapper.setExpandRatio(commentInput, 1.0f); Button postBtn = new Button(AppContext.getMessage(GenericI18Enum.M_BUTTON_SEND)); postBtn.setStyleName("submit-btn"); postBtn.setWidthUndefined(); postBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 6687918902751556313L; @Override public void buttonClick(Button.ClickEvent arg0) { final Comment comment = new Comment(); comment.setComment(commentInput.getValue()); 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, emailHandlerClass); String attachmentPath = AttachmentUtils.getProjectEntityCommentAttachmentPath(type, AppContext.getAccountId(), CurrentProjectVariables.getProjectId(), typeid, commentId); if (!"".equals(attachmentPath)) { saveContentsToRepo(attachmentPath); } // save success, clear comment area and load list // comments again commentInput.setValue(""); statusWrapper.removeAllComponents(); component.reload(); } }); inputWrapper.addComponent(postBtn); this.addComponent(inputWrapper); }
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 w w. j a v a 2 s . co 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.TimeLogComp.java
License:Open Source License
public void displayTime(final V bean) { this.removeAllComponents(); HorizontalLayout header = new HorizontalLayout(); header.setSpacing(true);/*from w w w . ja v a2 s .com*/ 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.ui.TimeLogEditView.java
License:Open Source License
private void initUI() { headerPanel = new HorizontalLayout(); headerPanel.setWidth("100%"); headerPanel.setStyleName("summary-info-panel"); headerPanel.setMargin(new MarginInfo(true, false, true, false)); headerPanel.setHeightUndefined();/*from w w w . jav a 2 s . c o m*/ content.addComponent(headerPanel); constructSpentTimeEntryPanel(); constructRemainTimeEntryPanel(); this.tableItem = new DefaultPagedBeanList<ItemTimeLoggingService, ItemTimeLoggingSearchCriteria, SimpleItemTimeLogging>( ApplicationContextUtil.getSpringBean(ItemTimeLoggingService.class), new TimeLogRowHandler()) { private static final long serialVersionUID = -4549910960891655297L; @Override protected void renderRows() { int i = 0; Date currentDate = new GregorianCalendar(2100, 1, 1).getTime(); for (final SimpleItemTimeLogging item : currentListData) { if (!DateUtils.isSameDay(item.getLogforday(), currentDate)) { Label dateLbl = new Label(AppContext.formatDate(item.getLogforday())); dateLbl.setStyleName("log-day"); listContainer.addComponent(dateLbl); currentDate = item.getLogforday(); } final Component row = getRowDisplayHandler().generateRow(item, i); listContainer.addComponent(row); i++; } } }; this.tableItem.setWidth("100%"); content.addComponent(tableItem); content.setExpandRatio(tableItem, 1.0f); VerticalLayout controlBtns = new VerticalLayout(); controlBtns.setSpacing(true); controlBtns.setWidth("100%"); controlBtns.setMargin(true); controlBtns.addStyleName("edit-btn-layout"); controlBtns.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); Button addNewEntryBtn = new Button(AppContext.getMessage(TimeTrackingI18nEnum.M_DIALOG_ADD_TIME_LOG_ENTRY), new Button.ClickListener() { private static final long serialVersionUID = -2540265040691537699L; @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent().addWindow(new NewTimeLogEntryWindow()); } }); addNewEntryBtn.setWidth("100%"); controlBtns.addComponent(addNewEntryBtn); Button updateRemainTimeBtn = new Button( AppContext.getMessage(TimeTrackingI18nEnum.M_DIALOG_UPDATE_REMAIN_HOURS), new Button.ClickListener() { private static final long serialVersionUID = 9215577509351959739L; @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent().addWindow(new UpdateRemainTimeWindow()); } }); updateRemainTimeBtn.setWidth("100%"); controlBtns.addComponent(updateRemainTimeBtn); NavigationBarQuickMenu editBtn = new NavigationBarQuickMenu(); editBtn.setButtonCaption(null); editBtn.setStyleName("edit-btn"); editBtn.setContent(controlBtns); this.setRightComponent(editBtn); }
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);/*from w w w . j a v a 2 s . com*/ 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.message.MessageAttachmentField.java
License:Open Source License
@Override protected void constructUI() { content = new VerticalLayout(); content.setStyleName("attachment-field"); rowWrap = new VerticalLayout(); rowWrap.setWidth("100%"); rowWrap.setStyleName("attachment-row-wrap"); HorizontalLayout compHeader = new HorizontalLayout(); compHeader.setWidth("100%"); compHeader.setStyleName("attachment-field-header"); Label headerLbl = new Label(AppContext.getMessage(GenericI18Enum.M_FORM_ATTACHMENT)); headerLbl.setStyleName("field-caption"); compHeader.addComponent(headerLbl);/*from www . ja v a 2 s . com*/ compHeader.setExpandRatio(headerLbl, 1.0f); compHeader.addComponent(attachmentBtn); content.addComponent(compHeader); content.addComponent(rowWrap); }
From source file:com.esofthead.mycollab.mobile.module.project.view.message.MessageReadViewImpl.java
License:Open Source License
@Override public void previewItem(SimpleMessage message) { this.bean = message; mainLayout.removeAllComponents();//from ww w . j av a 2s . co m HorizontalLayout messageBlock = new HorizontalLayout(); messageBlock.setStyleName("message-block"); Image userAvatarImg = UserAvatarControlFactory .createUserAvatarEmbeddedComponent(message.getPostedUserAvatarId(), 32); userAvatarImg.setStyleName("user-avatar"); messageBlock.addComponent(userAvatarImg); CssLayout rightCol = new CssLayout(); rightCol.setWidth("100%"); HorizontalLayout metadataRow = new HorizontalLayout(); metadataRow.setWidth("100%"); metadataRow.setStyleName("metadata-row"); Label userNameLbl = new Label(message.getFullPostedUserName()); userNameLbl.setStyleName("user-name"); metadataRow.addComponent(userNameLbl); metadataRow.setExpandRatio(userNameLbl, 1.0f); Label messageTimePost = new Label( DateTimeUtils.getPrettyDateValue(message.getPosteddate(), AppContext.getUserLocale())); messageTimePost.setStyleName("time-post"); messageTimePost.setWidthUndefined(); metadataRow.addComponent(messageTimePost); rightCol.addComponent(metadataRow); HorizontalLayout titleRow = new HorizontalLayout(); titleRow.setWidth("100%"); titleRow.setStyleName("title-row"); Label messageTitle = new Label(message.getTitle()); messageTitle.setStyleName("message-title"); titleRow.addComponent(messageTitle); titleRow.setExpandRatio(messageTitle, 1.0f); if (message.getCommentsCount() > 0) { Label msgCommentCount = new Label(String.valueOf(message.getCommentsCount())); msgCommentCount.setStyleName("comment-count"); msgCommentCount.setWidthUndefined(); titleRow.addComponent(msgCommentCount); titleRow.addStyleName("has-comment"); titleRow.setComponentAlignment(messageTitle, Alignment.MIDDLE_LEFT); } rightCol.addComponent(titleRow); Label messageContent = new Label( StringUtils.trim(StringUtils.trimHtmlTags(message.getMessage()), 150, true)); messageContent.setStyleName("message-content"); rightCol.addComponent(messageContent); ResourceService attachmentService = ApplicationContextUtil.getSpringBean(ResourceService.class); List<Content> attachments = attachmentService .getContents(AttachmentUtils.getProjectEntityAttachmentPath(AppContext.getAccountId(), message.getProjectid(), AttachmentType.PROJECT_MESSAGE, message.getId())); if (attachments != null && !attachments.isEmpty()) { CssLayout attachmentPanel = new CssLayout(); attachmentPanel.setStyleName("attachment-panel"); attachmentPanel.setWidth("100%"); for (Content attachment : attachments) { attachmentPanel.addComponent(MobileAttachmentUtils.renderAttachmentRow(attachment)); } rightCol.addComponent(attachmentPanel); } messageBlock.addComponent(rightCol); messageBlock.setExpandRatio(rightCol, 1.0f); messageBlock.setWidth("100%"); mainLayout.addComponent(messageBlock); MessageCommentListDisplay commentDisplay = new MessageCommentListDisplay(CommentType.PRJ_MESSAGE, CurrentProjectVariables.getProjectId(), true, true, MessageRelayEmailNotificationAction.class); commentDisplay.loadComments("" + message.getId()); this.setToolbar(commentDisplay.getCommentBox()); mainLayout.addComponent(commentDisplay); }