List of usage examples for com.vaadin.ui Alignment MIDDLE_RIGHT
Alignment MIDDLE_RIGHT
To view the source code for com.vaadin.ui Alignment MIDDLE_RIGHT.
Click Source Link
From source file:com.lst.deploymentautomation.vaadin.page.TodoListView.java
License:Open Source License
@SuppressWarnings("serial") @Override//w w w. ja v a2s . c o m protected Component createHeader(Component titleComponent) { LspsUI ui = (LspsUI) getUI(); actionBtn = new MenuBar(); actionBtn.addStyleName("menu-button-action"); actionBtn.setVisible(false); //initially hidden MenuItem actions = actionBtn.addItem("", new ThemeResource("../icons/popup-menu.png"), null); final ViewAction refreshTodos = new ViewAction() { @Override public void invoke() { toggleSelectionMode(false); container.refresh(); } }; actions.addItem(ui.getMessage("action.lock"), new Command() { @Override public void menuSelected(MenuItem selectedItem) { lock(); } }); actions.addItem(ui.getMessage("action.annotate") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoAnnotation(getSelectedTodoIds(), refreshTodos)); } }); actions.addSeparator(); actions.addItem(ui.getMessage("action.unlock"), new Command() { @Override public void menuSelected(MenuItem selectedItem) { unlock(); } }); actions.addItem(ui.getMessage("action.reject") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoRejection(getSelectedTodoIds(), refreshTodos)); } }); actions.addItem(ui.getMessage("action.delegate") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoDelegation(getSelectedTodoIds(), refreshTodos)); } }); actions.addItem(ui.getMessage("action.escalate") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoEscalation(getSelectedTodoIds(), refreshTodos)); } }); selectBtn = new Button(ui.getMessage("action.select"), new ClickListener() { @Override public void buttonClick(ClickEvent event) { toggleSelectionMode(true); } }); selectBtn.addStyleName("menu-button"); cancelBtn = new Button(ui.getMessage("action.cancel"), new ClickListener() { @Override public void buttonClick(ClickEvent event) { toggleSelectionMode(false); } }); cancelBtn.setVisible(false); //initially hidden cancelBtn.addStyleName("menu-button"); titleComponent.addStyleName("l-content-title"); HorizontalLayout layout = new HorizontalLayout(); HorizontalLayout btnLayout = new HorizontalLayout(); layout.setWidth("100%"); layout.addComponent(titleComponent); layout.addComponent(btnLayout); layout.setSpacing(true); btnLayout.addComponent(actionBtn); btnLayout.addComponent(cancelBtn); btnLayout.addComponent(selectBtn); layout.setComponentAlignment(btnLayout, Alignment.MIDDLE_RIGHT); return layout; }
From source file:com.lst.deploymentautomation.vaadin.page.TodoView.java
License:Open Source License
@SuppressWarnings("serial") @Override//from w w w . ja va2s.c o m protected Component createHeader(Component titleComponent) { LspsUI ui = (LspsUI) getUI(); MenuBar menu = new MenuBar(); menu.addStyleName("menu-button-action"); MenuItem actions = menu.addItem("", new ThemeResource("../icons/popup-menu.png"), null); final ViewAction closeView = new ViewAction() { @Override public void invoke() { close(); //maybe close only if the to-do is not allocated to the user anymore } }; final ViewAction refreshAnnotations = new ViewAction() { @Override public void invoke() { Todo todo = todoService.getTodo(todoHolder.getTodo().getId()); refreshAnnotations(todo); } }; actions.addItem(ui.getMessage("action.info"), new Command() { @Override public void menuSelected(MenuItem selectedItem) { //get fresh info Todo todo = todoService.getTodo(todoHolder.getTodo().getId()); getUI().addWindow(new TodoDetails(todo)); } }); actions.addSeparator(); actions.addItem(ui.getMessage("action.annotate") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { //get fresh info Todo todo = todoService.getTodo(todoHolder.getTodo().getId()); getUI().addWindow(new TodoAnnotation(todo, refreshAnnotations)); } }); actions.addSeparator(); actions.addItem(ui.getMessage("action.unlock"), new Command() { @Override public void menuSelected(MenuItem selectedItem) { unlock(); } }); actions.addItem(ui.getMessage("action.reject") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoRejection(todoHolder.getTodo().getId(), closeView)); } }); actions.addItem(ui.getMessage("action.delegate") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoDelegation(todoHolder.getTodo().getId(), closeView)); } }); actions.addItem(ui.getMessage("action.escalate") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoEscalation(todoHolder.getTodo().getId(), closeView)); } }); HorizontalLayout layout = new HorizontalLayout(); layout.setWidth("100%"); layout.addComponent(titleComponent); layout.setExpandRatio(titleComponent, 1); layout.addComponent(menu); layout.setComponentAlignment(menu, Alignment.MIDDLE_RIGHT); return layout; }
From source file:com.m1kah.ui.TodoComponent.java
License:Open Source License
private void initFooter() { itemsLeftLabel = new Label("0 items left"); filterOptionGroup = new OptionGroup(); filterOptionGroup.setId("filter-radio"); for (TodoFilter todoFilter : TodoFilter.values()) { filterOptionGroup.addItem(todoFilter); }// w w w.j av a 2 s .c o m filterOptionGroup.setValue(filter); clearCompletedButton = new Button("Clear completed"); HorizontalLayout footerLayout = new HorizontalLayout(itemsLeftLabel, filterOptionGroup, clearCompletedButton); footerLayout.setWidth(100.0f, Unit.PERCENTAGE); footerLayout.setComponentAlignment(itemsLeftLabel, Alignment.MIDDLE_LEFT); footerLayout.setComponentAlignment(filterOptionGroup, Alignment.MIDDLE_CENTER); footerLayout.setComponentAlignment(clearCompletedButton, Alignment.MIDDLE_RIGHT); footerLayout.setExpandRatio(itemsLeftLabel, 0.25f); footerLayout.setExpandRatio(filterOptionGroup, 0.5f); footerLayout.setExpandRatio(clearCompletedButton, 0.25f); addComponent(footerLayout); }
From source file:com.m1kah.ui.TodoRow.java
License:Open Source License
private void initLayout() { addComponent(checkBox);/*from www. j a v a 2s. c o m*/ addComponent(todoField); addComponent(removeButton); setComponentAlignment(checkBox, Alignment.MIDDLE_LEFT); setComponentAlignment(todoField, Alignment.MIDDLE_LEFT); setComponentAlignment(removeButton, Alignment.MIDDLE_RIGHT); setExpandRatio(todoField, 1); addStyleName("todo-row"); setWidth(100.0f, Unit.PERCENTAGE); }
From source file:com.mechanicshop.components.TableLayout.java
public void createCustomMessage() { final TextArea textArea = new TextArea(); textArea.setImmediate(true);//w ww . j a v a 2 s. com textArea.setColumns(30); textArea.setRows(10); textArea.addStyleName(ValoTheme.TEXTAREA_SMALL); textArea.setRequired(true); final Window subWindow = new Window(); subWindow.setModal(true); subWindow.setHeight("350px"); subWindow.setWidth("500px"); subWindow.setCaption("Insert Message"); subWindow.setStyleName(ValoTheme.WINDOW_TOP_TOOLBAR); subWindow.setClosable(false); subWindow.setResizable(false); HorizontalLayout layoutButtons = new HorizontalLayout(); layoutButtons.setMargin(false); Button sendBtn = new Button("Send"); sendBtn.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { try { textArea.validate(); String message = textArea.getValue(); smsSenderService.sendMessageMassive(message); subWindow.close(); Notification.show("Message Sent"); } catch (Exception e) { } } }); sendBtn.setImmediate(true); sendBtn.setStyleName(ValoTheme.BUTTON_TINY); sendBtn.addStyleName(ValoTheme.BUTTON_FRIENDLY); Button cancelBtn = new Button("Cancel"); cancelBtn.setStyleName(ValoTheme.BUTTON_TINY); cancelBtn.addStyleName(ValoTheme.BUTTON_DANGER); cancelBtn.setImmediate(true); cancelBtn.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { subWindow.close(); } }); layoutButtons.setSizeUndefined(); layoutButtons.setSpacing(true); layoutButtons.addComponents(cancelBtn, sendBtn); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.addComponent(textArea); layout.addComponent(layoutButtons); layout.setComponentAlignment(textArea, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(layoutButtons, Alignment.MIDDLE_RIGHT); layout.setExpandRatio(textArea, 3); layout.setSizeFull(); subWindow.setContent(layout); subWindow.center(); getUI().addWindow(subWindow); }
From source file:com.mycollab.community.module.project.view.ProjectAddWindow.java
License:Open Source License
public ProjectAddWindow() { super(new Project()); MVerticalLayout contentLayout = new MVerticalLayout().withSpacing(false) .withMargin(new MarginInfo(false, false, true, false)); setContent(contentLayout);//from ww w . j av a 2 s .c om projectInfo = new ProjectGeneralInfoStep(project); contentLayout.addComponent(projectInfo.getContent()); MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> { boolean isValid = projectInfo.commit(); if (isValid) { ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.class); project.setSaccountid(MyCollabUI.getAccountId()); projectService.saveWithSession(project, UserUIContext.getUsername()); EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this, new PageActionChain(new ProjectScreenData.Goto(project.getId())))); close(); } }).withIcon(FontAwesome.SAVE).withStyleName(WebThemes.BUTTON_ACTION); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION); MHorizontalLayout buttonControls = new MHorizontalLayout(cancelBtn, saveBtn) .withMargin(new MarginInfo(true, true, false, false)); contentLayout.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT); }
From source file:com.mycollab.community.shell.view.components.AdRequestWindow.java
License:Open Source License
public AdRequestWindow(final SimpleUser user) { super("No one has ever become poor by giving - Anne Frank, diary of Anne Frank"); this.withModal(true).withResizable(false).withWidth("800px").withCenter(); MVerticalLayout content = new MVerticalLayout(); Label message = new Label("Hey <b>" + UserUIContext.getUser().getDisplayName() + "</b>, you've been " + "using MyCollab for a while now, and we hope you are happy with it. We invested a lot of time and " + "money developing MyCollab. If you like it, please write a few words on twitter, blog or " + "our testimonial form. Your kindness helps this software be continued.", ContentMode.HTML); Label tweetUs = new Label(new Div().appendChild(new Text(" " + FontAwesome.TWITTER.getHtml()), DivLessFormatter.EMPTY_SPACE(), new A("https://twitter.com/intent/tweet?text=I am using MyCollab to manage all project activities, " + "accounts and it works great @mycollabdotcom&source=webclient", "_blank") .appendText("Share on Twitter")) .setStyle("color:#006dac").write(), ContentMode.HTML); Label linkedIn = new Label(new Div().appendChild( new Text(" " + FontAwesome.LINKEDIN_SQUARE.getHtml()), DivLessFormatter.EMPTY_SPACE(), new A("https://www.linkedin.com/cws/share?url=https%3A%2F%2Fwww.mycollab.com&original_referer=https%3A%2F%2Fwww.mycollab.com&token=&isFramed=false&lang=en_US", "_blank").appendText("Share on LinkedIn")) .setStyle("color:#006dac").write(), ContentMode.HTML); Label testimonialAd = new Label( "A chance to get a free license of the premium MyCollab software for 10 users" + ". If you execute one of the following:"); Label rateSourceforge = new Label( new Div() .appendChild(new Text(" " + FontAwesome.FLAG_CHECKERED.getHtml()), DivLessFormatter.EMPTY_SPACE(), new A("https://community.mycollab.com/docs/developing-mycollab/translating/", "_blank").appendText( "Localize MyCollab to your language at least 20% of the phrases")) .setStyle("color:#006dac").write(), ContentMode.HTML);/*w w w. jav a 2s .c o m*/ MButton testimonialBtn = new MButton("Write a testimonial which is selected to post on our website", clickEvent -> { close(); turnOffAdd(user); UI.getCurrent().addWindow(new TestimonialWindow()); }).withIcon(FontAwesome.KEYBOARD_O).withStyleName(WebThemes.BUTTON_LINK); MButton ignoreBtn = new MButton("No, thanks", clickEvent -> { close(); turnOffAdd(user); }).withStyleName(WebThemes.BUTTON_OPTION); MButton loveBtn = new MButton("I did", clickEvent -> { close(); NotificationUtil.showNotification("We appreciate your kindness action", "Thank you for your time"); turnOffAdd(user); }).withIcon(FontAwesome.HEART).withStyleName(WebThemes.BUTTON_ACTION); MHorizontalLayout btnControls = new MHorizontalLayout(ignoreBtn, loveBtn); content.with(message, rateSourceforge, tweetUs, linkedIn, testimonialAd, rateSourceforge, new MHorizontalLayout(ELabel.html(" "), testimonialBtn).withSpacing(false), new Label("Sincerely,"), ELabel.html(new A("https://hainguyen.mycollab.com/about-me/", "_blank") .appendText("Hai Nguyen").write()), btnControls).withAlign(btnControls, Alignment.MIDDLE_RIGHT); this.setContent(content); }
From source file:com.mycollab.mobile.module.project.ui.TimeLogComp.java
License:Open Source License
public void displayTime(final V bean) { this.removeAllComponents(); MHorizontalLayout header = FormSectionBuilder.build(FontAwesome.CLOCK_O, TimeTrackingI18nEnum.SUB_INFO_TIME); if (hasEditPermission()) { MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> showEditTimeView(bean)).withStyleName(MobileUIConstants.BUTTON_LINK); header.addComponent(editBtn);/*from w w w . j a v a2 s. com*/ header.setComponentAlignment(editBtn, Alignment.MIDDLE_RIGHT); } this.addComponent(header); GridFormLayoutHelper layout = GridFormLayoutHelper.defaultFormLayoutHelper(1, 3); double billableHours = getTotalBillableHours(bean); double nonBillableHours = getTotalNonBillableHours(bean); double remainHours = getRemainedHours(bean); layout.addComponent(new Label(billableHours + ""), UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS), 0, 0); layout.addComponent(new Label(nonBillableHours + ""), UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS), 0, 1); layout.addComponent(new Label(remainHours + ""), UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_REMAIN_HOURS), 0, 2); this.addComponent(layout.getLayout()); }
From source file:com.mycollab.module.crm.ui.components.AbstractListItemComp.java
License:Open Source License
private ComponentContainer buildControlsLayout() { MHorizontalLayout viewControlsLayout = new MHorizontalLayout() .withStyleName(WebThemes.TABLE_ACTION_CONTROLS).withFullWidth(); selectOptionButton = new SelectionOptionButton(tableItem); selectOptionButton.setSizeUndefined(); tableActionControls = createActionControls(); MHorizontalLayout leftContainer = new MHorizontalLayout(selectOptionButton, tableActionControls, selectedItemsNumberLabel);/*from w w w.j av a 2s . c o m*/ leftContainer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); extraControlsLayout = new ButtonGroup(); buildExtraControls(); viewControlsLayout.with(leftContainer, extraControlsLayout).withAlign(leftContainer, Alignment.MIDDLE_LEFT) .withAlign(extraControlsLayout, Alignment.MIDDLE_RIGHT); return viewControlsLayout; }
From source file:com.mycollab.module.crm.ui.components.CommentRowDisplayHandler.java
License:Open Source License
@Override public Component generateRow(IBeanList<SimpleComment> host, final SimpleComment comment, int rowIndex) { final MHorizontalLayout layout = new MHorizontalLayout().withMargin(new MarginInfo(true, true, true, false)) .withFullWidth();/*from w w w. j av a2s.co m*/ UserBlock memberBlock = new UserBlock(comment.getCreateduser(), comment.getOwnerAvatarId(), comment.getOwnerFullName()); layout.addComponent(memberBlock); CssLayout rowLayout = new CssLayout(); rowLayout.setStyleName(WebThemes.MESSAGE_CONTAINER); rowLayout.setWidth("100%"); MHorizontalLayout messageHeader = new MHorizontalLayout() .withMargin(new MarginInfo(true, true, false, true)).withFullWidth(); messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); ELabel timePostLbl = new ELabel(UserUIContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(), UserUIContext.formatPrettyTime(comment.getCreatedtime())), ContentMode.HTML).withDescription(UserUIContext.formatDateTime(comment.getCreatedtime())); timePostLbl.setSizeUndefined(); timePostLbl.setStyleName(UIConstants.META_INFO); messageHeader.with(timePostLbl).expand(timePostLbl); // Message delete button if (hasDeletePermission(comment)) { MButton msgDeleteBtn = new MButton("", clickEvent -> { ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { CommentService commentService = AppContextUtil.getSpringBean(CommentService.class); commentService.removeWithSession(comment, UserUIContext.getUsername(), MyCollabUI.getAccountId()); ((BeanList) host).removeRow(layout); } }); }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_ICON_ONLY); messageHeader.addComponent(msgDeleteBtn); } rowLayout.addComponent(messageHeader); Label messageContent = new SafeHtmlLabel(comment.getComment()); rowLayout.addComponent(messageContent); List<Content> attachments = comment.getAttachments(); if (!CollectionUtils.isEmpty(attachments)) { MVerticalLayout messageFooter = new MVerticalLayout().withSpacing(false).withFullWidth(); AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments); messageFooter.with(attachmentDisplay).withAlign(attachmentDisplay, Alignment.MIDDLE_RIGHT); rowLayout.addComponent(messageFooter); } layout.with(rowLayout).expand(rowLayout); return layout; }