List of usage examples for com.vaadin.ui Alignment MIDDLE_CENTER
Alignment MIDDLE_CENTER
To view the source code for com.vaadin.ui Alignment MIDDLE_CENTER.
Click Source Link
From source file:com.esofthead.mycollab.module.project.ui.components.GenericTaskTableDisplay.java
License:Open Source License
public GenericTaskTableDisplay(List<TableViewField> displayColumns) { super(ApplicationContextUtil.getSpringBean(ProjectGenericTaskService.class), ProjectGenericTask.class, displayColumns);//from w w w. j a v a 2 s . c om addGeneratedColumn("name", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(final Table source, final Object itemId, final Object columnId) { HorizontalLayout layout = new HorizontalLayout(); final ProjectGenericTask task = GenericTaskTableDisplay.this.getBeanByIndex(itemId); if (task.getType() != null) { FontIconLabel icon = new FontIconLabel(ProjectAssetsManager.getAsset(task.getType())); layout.addComponent(icon); layout.setComponentAlignment(icon, Alignment.MIDDLE_CENTER); } final ButtonLink b = new ButtonLink(task.getName(), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { fireTableEvent(new TableClickEvent(GenericTaskTableDisplay.this, task, "name")); } }); b.setWidth("100%"); layout.addComponent(b); layout.setExpandRatio(b, 1.0f); layout.setWidth("100%"); return layout; } }); addGeneratedColumn("assignUser", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { final ProjectGenericTask task = GenericTaskTableDisplay.this.getBeanByIndex(itemId); return new UserLink(task.getAssignUser(), task.getAssignUserAvatarId(), task.getAssignUserFullName()); } }); addGeneratedColumn("dueDate", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(final Table source, final Object itemId, final Object columnId) { final ProjectGenericTask task = GenericTaskTableDisplay.this.getBeanByIndex(itemId); return new Label(AppContext.formatDate(task.getDueDate())); } }); }
From source file:com.esofthead.mycollab.module.project.view.assignments.GanttChartViewImpl.java
License:Open Source License
private void constructUI() { MHorizontalLayout header = new MHorizontalLayout().withMargin(new MarginInfo(false, false, true, false)) .withStyleName("hdr-view").withWidth("100%"); header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label headerText = new Label(FontAwesome.BAR_CHART_O.getHtml() + " Gantt chart", ContentMode.HTML); headerText.setStyleName(ValoTheme.LABEL_H2); headerText.addStyleName(ValoTheme.LABEL_NO_MARGIN); CssLayout headerWrapper = new CssLayout(); headerWrapper.addComponent(headerText); MHorizontalLayout resWrapper = new MHorizontalLayout(); Label resLbl = new Label("Resolution: "); final ComboBox resValue = new ValueComboBox(false, "Day", "Week"); resValue.addValueChangeListener(new Property.ValueChangeListener() { @Override/*from ww w . ja v a 2s . c o m*/ public void valueChange(Property.ValueChangeEvent event) { String val = (String) resValue.getValue(); if ("Day".equals(val)) { gantt.setResolution(Resolution.Day); } else if ("Week".equals(val)) { gantt.setResolution(Resolution.Week); } } }); resWrapper.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); resWrapper.with(resLbl, resValue); header.with(headerWrapper, resWrapper).withAlign(headerWrapper, Alignment.MIDDLE_LEFT) .expand(headerWrapper); mainLayout = new MHorizontalLayout().withSpacing(false); mainLayout.addStyleName("gantt_container"); mainLayout.setSizeFull(); this.with(header, mainLayout); }
From source file:com.esofthead.mycollab.module.project.view.bug.BugSimpleSearchPanel.java
License:Open Source License
private void createBasicSearchLayout() { layoutSearchPane = new GridLayout(5, 3); layoutSearchPane.setSpacing(true);/* w ww . j ava 2 s .c o m*/ addTextFieldSearch(); final CheckBox chkIsOpenBug = new CheckBox("Only Open Bugs"); layoutSearchPane.addComponent(chkIsOpenBug, 2, 0); layoutSearchPane.setComponentAlignment(chkIsOpenBug, Alignment.MIDDLE_CENTER); Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH)); searchBtn.setStyleName(UIConstants.THEME_GREEN_LINK); searchBtn.setIcon(FontAwesome.SEARCH); searchBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { searchCriteria = new BugSearchCriteria(); searchCriteria.setProjectId( new NumberSearchField(SearchField.AND, CurrentProjectVariables.getProject().getId())); searchCriteria.setSummary(new StringSearchField(textValueField.getValue().trim())); if (chkIsOpenBug.getValue()) { searchCriteria.setStatuses(new SetSearchField<>(SearchField.AND, new String[] { BugStatus.InProgress.name(), BugStatus.Open.name(), BugStatus.ReOpened.name() })); } BugSimpleSearchPanel.this.notifySearchHandler(searchCriteria); } }); layoutSearchPane.addComponent(searchBtn, 3, 0); layoutSearchPane.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER); Button clearBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLEAR)); clearBtn.setStyleName(UIConstants.THEME_GRAY_LINK); clearBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { textValueField.setValue(""); } }); layoutSearchPane.addComponent(clearBtn, 4, 0); layoutSearchPane.setComponentAlignment(clearBtn, Alignment.MIDDLE_CENTER); this.setCompositionRoot(layoutSearchPane); }
From source file:com.esofthead.mycollab.module.project.view.bug.BugSimpleSearchPanel.java
License:Open Source License
private void addTextFieldSearch() { textValueField = new TextField(); textValueField.setWidth("300px"); layoutSearchPane.addComponent(textValueField, 0, 0); layoutSearchPane.setComponentAlignment(textValueField, Alignment.MIDDLE_CENTER); }
From source file:com.esofthead.mycollab.module.project.view.bug.ComponentListViewImpl.java
License:Open Source License
private ComponentContainer constructTableActionControls() { final CssLayout layoutWrapper = new CssLayout(); layoutWrapper.setWidth("100%"); final HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true);//from w w w.java 2 s .c om layoutWrapper.addStyleName(UIConstants.TABLE_ACTION_CONTROLS); layoutWrapper.addComponent(layout); this.selectOptionButton = new SelectionOptionButton(this.tableItem); layout.addComponent(this.selectOptionButton); this.tableActionControls = new DefaultMassItemActionHandlersContainer(); if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.COMPONENTS)) { tableActionControls.addActionItem(MassItemActionHandler.DELETE_ACTION, FontAwesome.TRASH_O, "delete", AppContext.getMessage(GenericI18Enum.BUTTON_DELETE)); } tableActionControls.addActionItem(MassItemActionHandler.MAIL_ACTION, FontAwesome.ENVELOPE_O, "mail", AppContext.getMessage(GenericI18Enum.BUTTON_MAIL)); tableActionControls.addDownloadActionItem(MassItemActionHandler.EXPORT_PDF_ACTION, FontAwesome.FILE_PDF_O, "export", "export.pdf", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_PDF)); tableActionControls.addDownloadActionItem(MassItemActionHandler.EXPORT_EXCEL_ACTION, FontAwesome.FILE_EXCEL_O, "export", "export.xlsx", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_EXCEL)); tableActionControls.addDownloadActionItem(MassItemActionHandler.EXPORT_CSV_ACTION, FontAwesome.FILE_TEXT_O, "export", "export.csv", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_CSV)); layout.addComponent(this.tableActionControls); layout.addComponent(this.selectedItemsNumberLabel); layout.setComponentAlignment(this.selectedItemsNumberLabel, Alignment.MIDDLE_CENTER); return layoutWrapper; }
From source file:com.esofthead.mycollab.module.project.view.bug.components.BugRowDisplayHandler.java
License:Open Source License
@Override public Component generateRow(SimpleBug bug, int rowIndex) { MVerticalLayout rowContent = new MVerticalLayout().withSpacing(false).withWidth("100%"); final LabelLink defectLink = new LabelLink( "[" + CurrentProjectVariables.getProject().getShortname() + "-" + bug.getBugkey() + "]: " + bug.getSummary(),/*from w ww. j a v a2s.co m*/ ProjectLinkBuilder.generateBugPreviewFullLink(bug.getBugkey(), bug.getProjectShortName())); defectLink.setWidth("100%"); defectLink.setIconLink(ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG)); defectLink.setDescription(ProjectTooltipGenerator.generateToolTipBug(AppContext.getUserLocale(), bug, AppContext.getSiteUrl(), AppContext.getTimezone())); if (bug.isCompleted()) { defectLink.addStyleName(UIConstants.LINK_COMPLETED); } else if (bug.isOverdue()) { defectLink.addStyleName(UIConstants.LINK_OVERDUE); } rowContent.addComponent(defectLink); final LabelHTMLDisplayWidget descInfo = new LabelHTMLDisplayWidget(bug.getDescription()); descInfo.setWidth("100%"); rowContent.addComponent(descInfo); final Label dateInfo = new Label(AppContext.getMessage(DayI18nEnum.LAST_UPDATED_ON, AppContext.formatPrettyTime(bug.getLastupdatedtime()))); dateInfo.setStyleName(UIConstants.WIDGET_ROW_METADATA); rowContent.addComponent(dateInfo); final HorizontalLayout hLayoutAssigneeInfo = new HorizontalLayout(); hLayoutAssigneeInfo.setSpacing(true); final Label assignee = new Label(AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE) + ": "); assignee.setStyleName(UIConstants.WIDGET_ROW_METADATA); hLayoutAssigneeInfo.addComponent(assignee); hLayoutAssigneeInfo.setComponentAlignment(assignee, Alignment.MIDDLE_CENTER); final ProjectUserLink userLink = new ProjectUserLink(bug.getAssignuser(), bug.getAssignUserAvatarId(), bug.getAssignuserFullName(), false, true); hLayoutAssigneeInfo.addComponent(userLink); hLayoutAssigneeInfo.setComponentAlignment(userLink, Alignment.MIDDLE_CENTER); rowContent.addComponent(hLayoutAssigneeInfo); rowContent.setStyleName(UIConstants.WIDGET_ROW); if ((rowIndex + 1) % 2 != 0) { rowContent.addStyleName("odd"); } return rowContent; }
From source file:com.esofthead.mycollab.module.project.view.bug.VersionListViewImpl.java
License:Open Source License
private ComponentContainer constructTableActionControls() { final CssLayout layoutWrapper = new CssLayout(); layoutWrapper.setWidth("100%"); final HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true);//w w w. j a va 2 s .c om layoutWrapper.addStyleName(UIConstants.TABLE_ACTION_CONTROLS); layoutWrapper.addComponent(layout); this.selectOptionButton = new SelectionOptionButton(this.tableItem); layout.addComponent(this.selectOptionButton); tableActionControls = new DefaultMassItemActionHandlersContainer(); if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.VERSIONS)) { tableActionControls.addActionItem(MassItemActionHandler.DELETE_ACTION, FontAwesome.TRASH_O, "delete", AppContext.getMessage(GenericI18Enum.BUTTON_DELETE)); } tableActionControls.addActionItem(MassItemActionHandler.MAIL_ACTION, FontAwesome.ENVELOPE_O, "mail", AppContext.getMessage(GenericI18Enum.BUTTON_MAIL)); tableActionControls.addDownloadActionItem(MassItemActionHandler.EXPORT_PDF_ACTION, FontAwesome.FILE_PDF_O, "export", "export.pdf", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_PDF)); tableActionControls.addDownloadActionItem(MassItemActionHandler.EXPORT_EXCEL_ACTION, FontAwesome.FILE_EXCEL_O, "export", "export.xlsx", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_EXCEL)); tableActionControls.addDownloadActionItem(MassItemActionHandler.EXPORT_CSV_ACTION, FontAwesome.FILE_TEXT_O, "export", "export.csv", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_CSV)); layout.addComponent(this.tableActionControls); layout.addComponent(this.selectedItemsNumberLabel); layout.setComponentAlignment(this.selectedItemsNumberLabel, Alignment.MIDDLE_CENTER); return layoutWrapper; }
From source file:com.esofthead.mycollab.module.project.view.milestone.MilestoneListViewImpl.java
License:Open Source License
private void constructBody() { this.bodyContent = CustomLayoutExt.createLayout("milestoneView"); bodyContent.setWidth("100%"); bodyContent.setStyleName("milestone-view"); final MHorizontalLayout closedHeaderLayout = new MHorizontalLayout(); final Label closedHeader = new Label(FontAwesome.MINUS.getHtml() + " " + AppContext.getMessage(MilestoneI18nEnum.WIDGET_CLOSED_PHASE_TITLE), ContentMode.HTML); closedHeader.setSizeUndefined();/*from ww w.ja va2 s. c o m*/ closedHeaderLayout.addComponent(closedHeader); closedHeaderLayout.setComponentAlignment(closedHeader, Alignment.MIDDLE_CENTER); bodyContent.addComponent(closedHeaderLayout, "closed-header"); closeContainer = new CssLayout(); closeContainer.setStyleName("milestone-col"); closeContainer.setWidth("100%"); bodyContent.addComponent(this.closeContainer, "closed-milestones"); final MHorizontalLayout inProgressHeaderLayout = new MHorizontalLayout(); final Label inProgressHeader = new Label(FontAwesome.SPINNER.getHtml() + " " + AppContext.getMessage(MilestoneI18nEnum.WIDGET_INPROGRESS_PHASE_TITLE), ContentMode.HTML); inProgressHeader.setSizeUndefined(); inProgressHeaderLayout.addComponent(inProgressHeader); inProgressHeaderLayout.setComponentAlignment(inProgressHeader, Alignment.MIDDLE_CENTER); bodyContent.addComponent(inProgressHeaderLayout, "in-progress-header"); inProgressContainer = new CssLayout(); inProgressContainer.setStyleName("milestone-col"); inProgressContainer.setWidth("100%"); bodyContent.addComponent(this.inProgressContainer, "in-progress-milestones"); final MHorizontalLayout futureHeaderLayout = new MHorizontalLayout(); final Label futureHeader = new Label(FontAwesome.CLOCK_O.getHtml() + " " + AppContext.getMessage(MilestoneI18nEnum.WIDGET_FUTURE_PHASE_TITLE), ContentMode.HTML); futureHeader.setSizeUndefined(); futureHeaderLayout.addComponent(futureHeader); futureHeaderLayout.setComponentAlignment(futureHeader, Alignment.MIDDLE_CENTER); bodyContent.addComponent(futureHeaderLayout, "future-header"); futureContainer = new CssLayout(); futureContainer.setStyleName("milestone-col"); futureContainer.setWidth("100%"); bodyContent.addComponent(this.futureContainer, "future-milestones"); this.addComponent(bodyContent); }
From source file:com.esofthead.mycollab.module.project.view.page.PageListNoItemView.java
License:Open Source License
protected MHorizontalLayout createControlButtons() { Button createPageBtn = new Button(actionMessage(), actionListener()); createPageBtn.setEnabled(hasPermission()); createPageBtn.addStyleName(UIConstants.THEME_GREEN_LINK); Button createPageGroupBtn = new Button(AppContext.getMessage(Page18InEnum.BUTTON_NEW_GROUP), new Button.ClickListener() { @Override/*w w w .j a v a2 s . c o m*/ public void buttonClick(Button.ClickEvent event) { UI.getCurrent().addWindow(new GroupPageAddWindow()); } }); createPageGroupBtn.setEnabled(hasPermission()); createPageGroupBtn.addStyleName(UIConstants.THEME_GREEN_LINK); MHorizontalLayout links = new MHorizontalLayout(); links.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); links.with(createPageBtn, new Label(" or "), createPageGroupBtn); return links; }
From source file:com.esofthead.mycollab.module.project.view.ProjectListViewImpl.java
License:Open Source License
private ComponentContainer constructTableActionControls() { MHorizontalLayout layout = new MHorizontalLayout().withFullWidth(); layout.addStyleName(UIConstants.TABLE_ACTION_CONTROLS); selectOptionButton = new SelectionOptionButton(tableItem); selectOptionButton.setWidthUndefined(); layout.addComponent(selectOptionButton); tableActionControls = new DefaultMassItemActionHandlerContainer(); tableActionControls.addDownloadPdfActionItem(); tableActionControls.addDownloadExcelActionItem(); tableActionControls.addDownloadCsvActionItem(); tableActionControls.setVisible(false); tableActionControls.setWidthUndefined(); layout.addComponent(tableActionControls); selectedItemsNumberLabel.setWidth("100%"); layout.with(selectedItemsNumberLabel).withAlign(selectedItemsNumberLabel, Alignment.MIDDLE_CENTER) .expand(selectedItemsNumberLabel); Button customizeViewBtn = new Button("", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//from w w w . j a v a 2s.c o m public void buttonClick(Button.ClickEvent event) { UI.getCurrent().addWindow(new ProjectListCustomizeWindow(tableItem)); } }); customizeViewBtn.setIcon(FontAwesome.ADJUST); customizeViewBtn.setDescription("Layout Options"); customizeViewBtn.addStyleName(UIConstants.BUTTON_ACTION); layout.with(customizeViewBtn).withAlign(customizeViewBtn, Alignment.MIDDLE_RIGHT); return layout; }