List of usage examples for com.vaadin.ui Alignment TOP_RIGHT
Alignment TOP_RIGHT
To view the source code for com.vaadin.ui Alignment TOP_RIGHT.
Click Source Link
From source file:com.klwork.explorer.ui.mainlayout.MainMenuBar.java
License:Apache License
protected void initProfileButton() { final LoggedInUser user = LoginHandler.getLoggedInUser(); // LoggedInUser user = new LoggedInUser(); // User name + link to profile MenuBar profileMenu = new MenuBar(); profileMenu.addStyleName(ExplorerLayout.STYLE_HEADER_PROFILE_BOX); MenuItem rootItem = profileMenu.addItem(user.getFirstName() + " " + user.getLastName(), null); rootItem.setStyleName(ExplorerLayout.STYLE_HEADER_PROFILE_MENU); if (useProfile()) { // Show profile//? rootItem.addItem(i18nManager.getMessage(Messages.PROFILE_SHOW), new Command() { public void menuSelected(MenuItem selectedItem) { ViewToolManager.showPopupWindow(new ProfilePopupWindow(user.getId())); }//from ww w . j a v a 2 s .c o m }); // Edit profile rootItem.addItem("?", new Command() { public void menuSelected(MenuItem selectedItem) { ViewToolManager.showPopupWindow(new ProfilePopupWindow(user.getId())); } }); // Change password rootItem.addItem(i18nManager.getMessage(Messages.PASSWORD_CHANGE), new Command() { public void menuSelected(MenuItem selectedItem) { ViewToolManager.showPopupWindow(new ChangePasswordPopupWindow()); } }); } // Logout rootItem.addItem(i18nManager.getMessage(Messages.HEADER_LOGOUT), new Command() { public void menuSelected(MenuItem selectedItem) { // xx.close(); ViewToolManager.logout(); } }); rootItem.addSeparator(); // ? rootItem.addItem("?", new Command() { public void menuSelected(MenuItem selectedItem) { // xx.close(); // ViewToolManager.logout(); } }); // rootItem.addItem("", new Command() { public void menuSelected(MenuItem selectedItem) { // xx.close(); // ViewToolManager.logout(); } }); addComponent(profileMenu); setComponentAlignment(profileMenu, Alignment.TOP_RIGHT); // setExpandRatio(profileMenu, 1.0f); }
From source file:com.lst.deploymentautomation.vaadin.page.TodoView.java
License:Open Source License
/** * Default constructor.//w w w . j ava 2 s .co m */ public TodoView() { setSizeFull(); notes = new Label(); notes.addStyleName("todo-notes"); priority = new Label(); priority.setSizeUndefined(); priority.addStyleName("todo-priority"); annotations = new HorizontalLayout(); annotations.addStyleName("todo-annotations"); annotations.setMargin(true); annotations.setWidth("100%"); annotations.addComponent(notes); annotations.setExpandRatio(notes, 5); annotations.addComponent(priority); annotations.setExpandRatio(priority, 1); annotations.setComponentAlignment(priority, Alignment.TOP_RIGHT); annotations.setVisible(false); }
From source file:com.mycollab.mobile.module.project.view.message.MessageListViewImpl.java
License:Open Source License
@Override protected Component buildRightComponent() { SearchNavigationButton searchBtn = new SearchNavigationButton() { @Override//from w w w. j av a 2 s .c om protected SearchInputView getSearchInputView() { return new MessageSearchInputView(); } }; MButton newMessageBtn = new MButton("", clickEvent -> EventBusFactory.getInstance().post(new MessageEvent.GotoAdd(this, null))) .withIcon(FontAwesome.PLUS).withStyleName(UIConstants.CIRCLE_BOX) .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MESSAGES)); return new MHorizontalLayout(searchBtn, newMessageBtn).alignAll(Alignment.TOP_RIGHT); }
From source file:com.mycollab.mobile.module.project.view.message.MessageReadViewImpl.java
License:Open Source License
private void displayItem() { mainLayout.removeAllComponents();/*from w ww.j a v a 2 s.co m*/ MHorizontalLayout messageBlock = new MHorizontalLayout().withSpacing(false).withFullWidth() .withStyleName("message-block"); Image userAvatarImg = UserAvatarControlFactory .createUserAvatarEmbeddedComponent(bean.getPostedUserAvatarId(), 32); userAvatarImg.addStyleName(UIConstants.CIRCLE_BOX); messageBlock.addComponent(userAvatarImg); CssLayout rightCol = new CssLayout(); rightCol.setWidth("100%"); MHorizontalLayout metadataRow = new MHorizontalLayout().withFullWidth(); ELabel userNameLbl = new ELabel(bean.getFullPostedUserName()).withStyleName(UIConstants.META_INFO); userNameLbl.addStyleName(UIConstants.TEXT_ELLIPSIS); CssLayout userNameWrap = new CssLayout(userNameLbl); ELabel messageTimePost = new ELabel().prettyDateTime(bean.getPosteddate()) .withStyleName(UIConstants.META_INFO).withWidthUndefined(); metadataRow.with(userNameWrap, messageTimePost).withAlign(messageTimePost, Alignment.TOP_RIGHT) .expand(userNameWrap); rightCol.addComponent(metadataRow); CssLayout titleRow = new CssLayout(); titleRow.setWidth("100%"); titleRow.setStyleName("title-row"); Label messageTitle = new Label(bean.getTitle()); messageTitle.setStyleName("message-title"); titleRow.addComponent(messageTitle); rightCol.addComponent(titleRow); Label messageContent = new Label(StringUtils.trimHtmlTags(bean.getMessage())); rightCol.addComponent(messageContent); ResourceService attachmentService = AppContextUtil.getSpringBean(ResourceService.class); List<Content> attachments = attachmentService.getContents(AttachmentUtils.getProjectEntityAttachmentPath( MyCollabUI.getAccountId(), bean.getProjectid(), ProjectTypeConstants.MESSAGE, "" + bean.getId())); if (CollectionUtils.isNotEmpty(attachments)) { CssLayout attachmentPanel = new CssLayout(); attachmentPanel.setStyleName("attachment-panel"); attachmentPanel.setWidth("100%"); for (Content attachment : attachments) { attachmentPanel.addComponent(MobileAttachmentUtils.renderAttachmentRow(attachment)); } rightCol.addComponent(attachmentPanel); } messageBlock.with(rightCol).expand(rightCol); mainLayout.addComponent(messageBlock); Label commentTitleLbl = new Label(); Component section = FormSectionBuilder.build(FontAwesome.COMMENT, commentTitleLbl); MessageCommentListDisplay commentDisplay = new MessageCommentListDisplay(ProjectTypeConstants.MESSAGE, bean.getId() + "", bean.getProjectid(), true); int numComments = commentDisplay.getNumComments(); commentTitleLbl.setValue(UserUIContext.getMessage(GenericI18Enum.OPT_COMMENTS_VALUE, numComments)); mainLayout.addComponent(section); mainLayout.addComponent(commentDisplay); this.setToolbar(commentDisplay.getCommentBox()); }
From source file:com.mycollab.mobile.module.project.view.milestone.MilestoneListViewImpl.java
License:Open Source License
@Override protected Component buildRightComponent() { SearchNavigationButton searchBtn = new SearchNavigationButton() { @Override//from w w w . ja v a2 s. co m protected SearchInputView getSearchInputView() { return new MilestoneSearchInputView(); } }; MButton newMilestoneBtn = new MButton("", clickEvent -> EventBusFactory.getInstance() .post(new MilestoneEvent.GotoAdd(MilestoneListViewImpl.this, null))) .withIcon(FontAwesome.PLUS).withStyleName(UIConstants.CIRCLE_BOX) .withVisible(CurrentProjectVariables .canWrite(ProjectRolePermissionCollections.MILESTONES)); return new MHorizontalLayout(searchBtn, newMilestoneBtn).alignAll(Alignment.TOP_RIGHT); }
From source file:com.mycollab.mobile.module.project.view.ticket.TicketListViewImpl.java
License:Open Source License
@Override protected Component buildRightComponent() { MHorizontalLayout controls = new MHorizontalLayout(); controls.setDefaultComponentAlignment(Alignment.TOP_RIGHT); SearchNavigationButton searchBtn = new SearchNavigationButton() { @Override/*from w w w . ja v a2 s . c o m*/ protected SearchInputView getSearchInputView() { return new TicketSearchInputView(); } }; controls.with(searchBtn); NavigationBarQuickMenu actionMenu = new NavigationBarQuickMenu(); MVerticalLayout content = new MVerticalLayout(); if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) { content.with(new Button(UserUIContext.getMessage(TaskI18nEnum.NEW), clickEvent -> EventBusFactory .getInstance().post(new TaskEvent.GotoAdd(TicketListViewImpl.this, null)))); } if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)) { content.with(new Button(UserUIContext.getMessage(BugI18nEnum.NEW), clickEvent -> EventBusFactory .getInstance().post(new BugEvent.GotoAdd(TicketListViewImpl.this, null)))); } if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.RISKS) && !SiteConfiguration.isCommunityEdition()) { content.with(new Button(UserUIContext.getMessage(RiskI18nEnum.NEW), clickEvent -> EventBusFactory .getInstance().post(new RiskEvent.GotoAdd(TicketListViewImpl.this, null)))); } if (content.getComponentCount() > 0) { actionMenu.setContent(content); controls.with(actionMenu); } return controls; }
From source file:com.mycollab.module.crm.ui.components.AbstractPreviewItemComp.java
License:Open Source License
public AbstractPreviewItemComp(FontAwesome iconResource) { setSizeFull();//from w ww. j a va2s.c om this.iconResource = iconResource; tabSheet = new VerticalTabsheet(); tabSheet.setSizeFull(); tabSheet.setNavigatorWidth("100%"); tabSheet.setNavigatorStyleName("sidebar-menu"); tabSheet.addToggleNavigatorControl(); headerTitle = ELabel.h2(""); header = new MHorizontalLayout(headerTitle).withStyleName("hdr-view").withFullWidth() .withMargin(new MarginInfo(true, false, true, false)).expand(headerTitle); header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); addComponent(tabSheet); CssLayout navigatorWrapper = tabSheet.getNavigatorWrapper(); navigatorWrapper.setWidth("200px"); tabSheet.addSelectedTabChangeListener(new SelectedTabChangeListener() { private static final long serialVersionUID = 1L; @Override public void selectedTabChange(SelectedTabChangeEvent event) { Tab tab = ((VerticalTabsheet) event.getSource()).getSelectedTab(); tabSheet.selectTab(((TabImpl) tab).getTabId()); } }); tabContent = tabSheet.getContentWrapper(); tabContent.addComponent(header, 0); previewForm = initPreviewForm(); ComponentContainer actionControls = createButtonControls(); if (actionControls != null) { header.with(actionControls).withAlign(actionControls, Alignment.TOP_RIGHT); } previewLayout = new DefaultReadViewLayout(""); RightSidebarLayout bodyContainer = new RightSidebarLayout(); bodyContainer.addStyleName(WebThemes.CONTENT_WRAPPER); MVerticalLayout bodyContent = new MVerticalLayout(previewForm).withSpacing(false).withMargin(false) .withFullWidth(); bodyContainer.setContent(bodyContent); sidebarContent = new MVerticalLayout().withWidth("250px").withStyleName("readview-sidebar"); bodyContainer.setSidebar(sidebarContent); previewLayout.addBody(bodyContainer); tabContent.addComponent(previewLayout); initRelatedComponents(); ComponentContainer bottomPanel = createBottomPanel(); if (bottomPanel != null) { if (bodyContent.getComponentCount() >= 2) { bodyContent.replaceComponent(bodyContent.getComponent(bodyContent.getComponentCount() - 1), bottomPanel); } else { bodyContent.addComponent(bottomPanel); } } }
From source file:com.mycollab.module.crm.view.account.AccountCaseListComp.java
License:Open Source License
@Override protected Component generateTopControls() { MHorizontalLayout controlsBtnWrap = new MHorizontalLayout().withFullWidth(); MHorizontalLayout notesWrap = new MHorizontalLayout().withFullWidth(); Label noteLbl = new Label(UserUIContext.getMessage(GenericI18Enum.OPT_NOTE)); noteLbl.setSizeUndefined();/* w w w .ja v a2 s . c o m*/ noteLbl.setStyleName("list-note-lbl"); notesWrap.addComponent(noteLbl); CssLayout noteBlock = new CssLayout(); noteBlock.setWidth("100%"); noteBlock.setStyleName("list-note-block"); for (CaseStatus status : CrmDataTypeFactory.getCasesStatusList()) { ELabel note = new ELabel(UserUIContext.getMessage(status)) .withStyleName("note-label", colorsMap.get(status.name())).withWidthUndefined(); noteBlock.addComponent(note); } notesWrap.with(noteBlock).expand(noteBlock); controlsBtnWrap.addComponent(notesWrap); if (UserUIContext.canWrite(RolePermissionCollections.CRM_CASE)) { MButton createBtn = new MButton(UserUIContext.getMessage(CaseI18nEnum.NEW), clickEvent -> fireNewRelatedItem("")).withIcon(FontAwesome.PLUS) .withStyleName(WebThemes.BUTTON_ACTION); controlsBtnWrap.with(createBtn).withAlign(createBtn, Alignment.TOP_RIGHT); } return controlsBtnWrap; }
From source file:com.mycollab.module.crm.view.account.AccountOpportunityListComp.java
License:Open Source License
@Override protected Component generateTopControls() { MHorizontalLayout controlsBtnWrap = new MHorizontalLayout().withFullWidth(); MHorizontalLayout notesWrap = new MHorizontalLayout().withFullWidth(); ELabel noteLbl = new ELabel(UserUIContext.getMessage(GenericI18Enum.OPT_NOTE)).withWidthUndefined(); notesWrap.addComponent(noteLbl);/*ww w . j a va 2 s. c om*/ CssLayout noteBlock = new CssLayout(); noteBlock.setWidth("100%"); noteBlock.setStyleName("list-note-block"); for (OpportunitySalesStage stage : CrmDataTypeFactory.getOpportunitySalesStageList()) { ELabel note = new ELabel(UserUIContext.getMessage(stage)) .withStyleName("note-label", colormap.get(stage.name())).withWidthUndefined(); noteBlock.addComponent(note); } notesWrap.with(noteBlock).expand(noteBlock); controlsBtnWrap.with(notesWrap).expand(notesWrap); if (UserUIContext.canWrite(RolePermissionCollections.CRM_OPPORTUNITY)) { MButton createBtn = new MButton(UserUIContext.getMessage(OpportunityI18nEnum.NEW), clickEvent -> fireNewRelatedItem("")).withIcon(FontAwesome.PLUS) .withStyleName(WebThemes.BUTTON_ACTION); controlsBtnWrap.with(createBtn).withAlign(createBtn, Alignment.TOP_RIGHT); } return controlsBtnWrap; }
From source file:com.mycollab.module.crm.view.contact.ContactReadFormFieldFactory.java
License:Open Source License
@Override protected Field<?> onCreateField(Object propertyId) { SimpleContact contact = attachForm.getBean(); if (propertyId.equals("accountid")) { return new LinkViewField(contact.getAccountName(), CrmLinkBuilder.generateAccountPreviewLinkFull(contact.getAccountid()), CrmAssetsManager.getAsset(CrmTypeConstants.ACCOUNT)); } else if (propertyId.equals("email")) { return new EmailViewField(attachForm.getBean().getEmail()); } else if (propertyId.equals("assignuser")) { return new UserLinkViewField(contact.getAssignuser(), contact.getAssignUserAvatarId(), contact.getAssignUserFullName()); } else if (propertyId.equals("iscallable")) { if (Boolean.FALSE.equals(contact.getIscallable())) { return new DefaultViewField(UserUIContext.getMessage(GenericI18Enum.BUTTON_NO)); } else {/*from w w w .ja v a2 s . c o m*/ return new DefaultViewField(UserUIContext.getMessage(GenericI18Enum.BUTTON_YES)); } } else if (propertyId.equals("birthday")) { return new DateViewField(contact.getBirthday()); } else if (propertyId.equals("firstname")) { final ContainerHorizontalViewField containerField = new ContainerHorizontalViewField(); String displayName = ""; if (contact.getPrefix() != null) { displayName = contact.getPrefix(); } if (contact.getFirstname() != null) { displayName += contact.getFirstname(); } Label nameLbl = new Label(displayName); containerField.addComponentField(nameLbl); containerField.getLayout().setExpandRatio(nameLbl, 1.0f); Button vcardDownloadBtn = new Button(""); VCardStreamSource streamSource = new VCardStreamSource(); OnDemandFileDownloader downloaderExt = new OnDemandFileDownloader(streamSource); downloaderExt.extend(vcardDownloadBtn); vcardDownloadBtn.setIcon(FontAwesome.CREDIT_CARD); vcardDownloadBtn.setStyleName(WebThemes.BUTTON_ICON_ONLY); containerField.addComponentField(vcardDownloadBtn); containerField.getLayout().setComponentAlignment(vcardDownloadBtn, Alignment.TOP_RIGHT); return containerField; } else if (propertyId.equals("description")) { return new RichTextViewField(contact.getDescription()); } else if (Contact.Field.leadsource.equalTo(propertyId)) { return new I18nFormViewField(contact.getLeadsource(), OpportunityLeadSource.class) .withStyleName(UIConstants.FIELD_NOTE); } else if (Contact.Field.primcountry.equalTo(propertyId)) { return new CountryViewField(contact.getPrimcountry()); } else if (Contact.Field.othercountry.equalTo(propertyId)) { return new CountryViewField(contact.getOthercountry()); } return null; }