Example usage for com.vaadin.ui Alignment MIDDLE_LEFT

List of usage examples for com.vaadin.ui Alignment MIDDLE_LEFT

Introduction

In this page you can find the example usage for com.vaadin.ui Alignment MIDDLE_LEFT.

Prototype

Alignment MIDDLE_LEFT

To view the source code for com.vaadin.ui Alignment MIDDLE_LEFT.

Click Source Link

Usage

From source file:com.mycollab.module.project.view.bug.BugListViewImpl.java

License:Open Source License

public BugListViewImpl() {
    this.withMargin(new MarginInfo(false, true, true, true));
    searchPanel = new BugSearchPanel();
    MHorizontalLayout groupWrapLayout = new MHorizontalLayout();
    groupWrapLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    groupWrapLayout.addComponent(new Label("Sort"));
    final ComboBox sortCombo = new ValueComboBox(false,
            AppContext.getMessage(GenericI18Enum.OPT_SORT_DESCENDING),
            AppContext.getMessage(GenericI18Enum.OPT_SORT_ASCENDING));
    sortCombo.addValueChangeListener(valueChangeEvent -> {
        String sortValue = (String) sortCombo.getValue();
        if (AppContext.getMessage(GenericI18Enum.OPT_SORT_ASCENDING).equals(sortValue)) {
            sortDirection = SearchCriteria.ASC;
        } else {/*from  w  w w. jav  a2s  .  c om*/
            sortDirection = SearchCriteria.DESC;
        }
        queryAndDisplayBugs();
    });
    sortDirection = SearchCriteria.DESC;
    groupWrapLayout.addComponent(sortCombo);

    groupWrapLayout.addComponent(new Label("Group by"));
    final ComboBox groupCombo = new ValueComboBox(false, GROUP_DUE_DATE, GROUP_START_DATE, GROUP_CREATED_DATE,
            PLAIN_LIST, GROUP_USER);
    groupCombo.addValueChangeListener(valueChangeEvent -> {
        groupByState = (String) groupCombo.getValue();
        queryAndDisplayBugs();
    });
    groupByState = GROUP_DUE_DATE;
    groupWrapLayout.addComponent(groupCombo);

    searchPanel.addHeaderRight(groupWrapLayout);

    MButton printBtn = new MButton("", clickEvent -> {
        UI.getCurrent().addWindow(new BugCustomizeReportOutputWindow(new LazyValueInjector() {
            @Override
            protected Object doEval() {
                return baseCriteria;
            }
        }));
    }).withIcon(FontAwesome.PRINT).withStyleName(UIConstants.BUTTON_OPTION);
    printBtn.setDescription(AppContext.getMessage(GenericI18Enum.ACTION_EXPORT));
    groupWrapLayout.addComponent(printBtn);

    MButton newBugBtn = new MButton(AppContext.getMessage(BugI18nEnum.NEW), clickEvent -> {
        SimpleBug bug = new SimpleBug();
        bug.setProjectid(CurrentProjectVariables.getProjectId());
        bug.setSaccountid(AppContext.getAccountId());
        bug.setLogby(AppContext.getUsername());
        UI.getCurrent().addWindow(new BugAddWindow(bug));
    }).withIcon(FontAwesome.PLUS).withStyleName(UIConstants.BUTTON_ACTION)
            .withDescription(AppContext.getMessage(BugI18nEnum.NEW))
            .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS));
    groupWrapLayout.addComponent(newBugBtn);

    Button advanceDisplayBtn = new Button("List");
    advanceDisplayBtn.setWidth("100px");
    advanceDisplayBtn.setIcon(FontAwesome.SITEMAP);
    advanceDisplayBtn.setDescription("Detail");

    MButton kanbanBtn = new MButton("Kanban", clickEvent -> displayKanbanView()).withIcon(FontAwesome.TH)
            .withWidth("100px");
    kanbanBtn.setDescription("Kanban View");

    ToggleButtonGroup viewButtons = new ToggleButtonGroup();
    viewButtons.addButton(advanceDisplayBtn);
    viewButtons.addButton(kanbanBtn);
    viewButtons.withDefaultButton(advanceDisplayBtn);
    groupWrapLayout.addComponent(viewButtons);

    MHorizontalLayout mainLayout = new MHorizontalLayout().withFullHeight().withFullWidth();
    wrapBody = new MVerticalLayout().withMargin(new MarginInfo(false, true, true, false));

    rightColumn = new MVerticalLayout().withWidth("370px").withMargin(new MarginInfo(true, false, true, false));

    mainLayout.with(wrapBody, rightColumn).expand(wrapBody);
    this.with(searchPanel, mainLayout);
}

From source file:com.mycollab.module.project.view.bug.BugSearchPanel.java

License:Open Source License

@Override
protected ComponentContainer buildSearchTitle() {
    if (canSwitchToAdvanceLayout) {
        savedFilterComboBox = new BugSavedFilterComboBox();
        savedFilterComboBox.addQuerySelectListener(new SavedFilterComboBox.QuerySelectListener() {
            @Override/*from   w ww. j av  a 2s  .co m*/
            public void querySelect(SavedFilterComboBox.QuerySelectEvent querySelectEvent) {
                List<SearchFieldInfo> fieldInfos = querySelectEvent.getSearchFieldInfos();
                BugSearchCriteria criteria = SearchFieldInfo.buildSearchCriteria(BugSearchCriteria.class,
                        fieldInfos);
                criteria.setProjectId(new NumberSearchField(CurrentProjectVariables.getProjectId()));
                EventBusFactory.getInstance().post(new BugEvent.SearchRequest(BugSearchPanel.this, criteria));
                EventBusFactory.getInstance().post(new ShellEvent.AddQueryParam(this, fieldInfos));
            }
        });
        ELabel taskIcon = ELabel.h2(ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG).getHtml())
                .withWidthUndefined();
        return new MHorizontalLayout(taskIcon, savedFilterComboBox).expand(savedFilterComboBox)
                .alignAll(Alignment.MIDDLE_LEFT);
    } else {
        return null;
    }
}

From source file:com.mycollab.module.project.view.bug.components.UnresolvedBugsByAssigneeWidget.java

License:Open Source License

@Override
protected void displayPlainMode() {
    bodyContent.removeAllComponents();/*from   w ww .j a v  a2 s  .co  m*/
    if (!groupItems.isEmpty()) {
        for (GroupItem item : groupItems) {
            MHorizontalLayout assigneeLayout = new MHorizontalLayout().withFullWidth();
            assigneeLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
            String assignUser = item.getGroupid();
            String assignUserFullName = item.getGroupid() == null
                    ? AppContext.getMessage(GenericI18Enum.OPT_UNDEFINED)
                    : item.getGroupname();
            if (assignUserFullName == null || "".equals(assignUserFullName.trim())) {
                assignUserFullName = StringUtils.extractNameFromEmail(assignUser);
            }
            BugAssigneeLink userLbl = new BugAssigneeLink(assignUser, item.getExtraValue(), assignUserFullName);
            assigneeLayout.addComponent(userLbl);
            ProgressBarIndicator indicator = new ProgressBarIndicator(totalCount,
                    totalCount - item.getValue().intValue(), false);
            indicator.setWidth("100%");
            assigneeLayout.with(indicator).expand(indicator);
            bodyContent.addComponent(assigneeLayout);
        }
    }
}

From source file:com.mycollab.module.project.view.bug.components.UnresolvedBugsByPriorityWidget.java

License:Open Source License

@Override
protected void displayPlainMode() {
    this.bodyContent.removeAllComponents();
    BugPriorityClickListener listener = new BugPriorityClickListener();
    if (!groupItems.isEmpty()) {
        for (BugPriority priority : OptionI18nEnum.bug_priorities) {
            boolean isFound = false;
            for (GroupItem item : groupItems) {
                if (priority.name().equals(item.getGroupid())) {
                    isFound = true;/*from w  w  w  .jav a  2 s . c  o  m*/
                    MHorizontalLayout priorityLayout = new MHorizontalLayout().withFullWidth();
                    priorityLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
                    ButtonI18nComp priorityLink = new ButtonI18nComp(priority.name(), priority, listener);
                    priorityLink.setIcon(ProjectAssetsManager.getBugPriority(priority.name()));
                    priorityLink.setWidth("110px");
                    priorityLink.setStyleName(UIConstants.BUTTON_LINK);
                    priorityLink.addStyleName("bug-" + priority.name().toLowerCase());

                    ProgressBarIndicator indicator = new ProgressBarIndicator(totalCount,
                            totalCount - item.getValue().intValue(), false);
                    indicator.setWidth("100%");

                    priorityLayout.with(priorityLink, indicator).expand(indicator);

                    this.bodyContent.addComponent(priorityLayout);
                }
            }

            if (!isFound) {
                MHorizontalLayout priorityLayout = new MHorizontalLayout().withFullWidth();
                priorityLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
                Button priorityLink = new ButtonI18nComp(priority.name(), priority, listener);
                priorityLink.setIcon(ProjectAssetsManager.getBugPriority(priority.name()));
                priorityLink.setWidth("110px");
                priorityLink.setStyleName(UIConstants.BUTTON_LINK);
                priorityLink.addStyleName("bug-" + priority.name().toLowerCase());
                ProgressBarIndicator indicator = new ProgressBarIndicator(totalCount, totalCount, false);
                indicator.setWidth("100%");
                priorityLayout.with(priorityLink, indicator).expand(indicator);
                this.bodyContent.addComponent(priorityLayout);
            }
        }
    }
}

From source file:com.mycollab.module.project.view.FollowingTicketViewImpl.java

License:Open Source License

@Override
public void initContent() {
    removeAllComponents();/*from w  w w . ja  va2 s . co  m*/
    MHorizontalLayout header = new MHorizontalLayout().withFullWidth();

    ELabel layoutHeader = ELabel
            .h2(FontAwesome.EYE.getHtml() + " "
                    + UserUIContext.getMessage(FollowerI18nEnum.OPT_MY_FOLLOWING_TICKETS, 0))
            .withWidthUndefined();

    Button exportBtn = new Button(UserUIContext.getMessage(GenericI18Enum.ACTION_EXPORT),
            clickEvent -> exportButtonControl.setPopupVisible(true));
    exportButtonControl = new SplitButton(exportBtn);
    exportButtonControl.addStyleName(WebThemes.BUTTON_OPTION);
    exportButtonControl.setIcon(FontAwesome.EXTERNAL_LINK);

    OptionPopupContent popupButtonsControl = new OptionPopupContent();
    exportButtonControl.setContent(popupButtonsControl);

    Button exportPdfBtn = new Button(UserUIContext.getMessage(FileI18nEnum.PDF));
    FileDownloader pdfDownloader = new FileDownloader(constructStreamResource(ReportExportType.PDF));
    pdfDownloader.extend(exportPdfBtn);
    exportPdfBtn.setIcon(FontAwesome.FILE_PDF_O);
    popupButtonsControl.addOption(exportPdfBtn);

    Button exportExcelBtn = new Button(UserUIContext.getMessage(FileI18nEnum.EXCEL));
    FileDownloader excelDownloader = new FileDownloader(constructStreamResource(ReportExportType.EXCEL));
    excelDownloader.extend(exportExcelBtn);
    exportExcelBtn.setIcon(FontAwesome.FILE_EXCEL_O);
    popupButtonsControl.addOption(exportExcelBtn);

    header.with(layoutHeader, exportButtonControl).withAlign(layoutHeader, Alignment.MIDDLE_LEFT)
            .withAlign(exportButtonControl, Alignment.MIDDLE_RIGHT);
    this.addComponent(layoutHeader);

    searchPanel = new FollowingTicketSearchPanel();
    this.addComponent(searchPanel);

    this.ticketTable = new FollowingTicketTableDisplay();
    this.ticketTable.setMargin(new MarginInfo(true, false, false, false));
    this.addComponent(this.ticketTable);
}

From source file:com.mycollab.module.project.view.milestone.AllMilestoneTimelineWidget.java

License:Open Source License

public void display() {
    this.withMargin(new MarginInfo(false, false, true, false)).withStyleName("tm-container").withFullWidth();

    MHorizontalLayout headerLayout = new MHorizontalLayout()
            .withMargin(new MarginInfo(false, true, false, true)).withStyleName(WebThemes.PANEL_HEADER);
    headerLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    ELabel titleLbl = ELabel.h3(UserUIContext.getMessage(MilestoneI18nEnum.OPT_TIMELINE));

    final CheckBox includeNoDateSet = new CheckBox(UserUIContext.getMessage(DayI18nEnum.OPT_NO_DATE_SET));
    includeNoDateSet.setValue(false);/*from   www  .  j a  v a2s  .  c  om*/

    final CheckBox includeClosedMilestone = new CheckBox(UserUIContext.getMessage(MilestoneStatus.Closed));
    includeClosedMilestone.setValue(false);

    includeNoDateSet.addValueChangeListener(valueChangeEvent -> displayTimelines(includeNoDateSet.getValue(),
            includeClosedMilestone.getValue()));
    includeClosedMilestone
            .addValueChangeListener(valueChangeEvent -> displayTimelines(includeNoDateSet.getValue(),
                    includeClosedMilestone.getValue()));
    headerLayout.with(titleLbl, includeNoDateSet, includeClosedMilestone).expand(titleLbl)
            .withAlign(includeNoDateSet, Alignment.MIDDLE_RIGHT)
            .withAlign(includeClosedMilestone, Alignment.MIDDLE_RIGHT);

    MilestoneSearchCriteria searchCriteria = new MilestoneSearchCriteria();
    UserDashboardView userDashboardView = UIUtils.getRoot(this, UserDashboardView.class);
    searchCriteria.setProjectIds(new SetSearchField<>(userDashboardView.getInvolvedProjectKeys()));
    searchCriteria.setOrderFields(
            Collections.singletonList(new SearchCriteria.OrderField(Milestone.Field.enddate.name(), "ASC")));
    MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class);
    milestones = milestoneService.findPageableListByCriteria(new BasicSearchRequest<>(searchCriteria));

    this.addComponent(headerLayout);
    timelineContainer = new CssLayout();
    timelineContainer.setWidth("100%");
    this.addComponent(timelineContainer);
    timelineContainer.addStyleName("tm-wrapper");
    displayTimelines(false, false);
}

From source file:com.mycollab.module.project.view.milestone.MilestoneListViewImpl.java

License:Open Source License

private void initUI() {
    HeaderWithFontAwesome headerText = ComponentUtils.headerH2(ProjectTypeConstants.MILESTONE,
            UserUIContext.getMessage(MilestoneI18nEnum.LIST));

    MHorizontalLayout header = new MHorizontalLayout().withStyleName("hdr-view").withFullWidth()
            .withMargin(true).with(headerText, createHeaderRight()).withAlign(headerText, Alignment.MIDDLE_LEFT)
            .expand(headerText);//from w w w  .j a  v a  2 s.c o m
    this.addComponent(header);
}

From source file:com.mycollab.module.project.view.milestone.MilestoneRoadmapViewImpl.java

License:Open Source License

private void initUI() {
    headerText = ELabel.h2("");

    MHorizontalLayout header = new MHorizontalLayout().withStyleName("hdr-view").withFullWidth()
            .withMargin(true).with(headerText, createHeaderRight()).withAlign(headerText, Alignment.MIDDLE_LEFT)
            .expand(headerText);/*www .  ja va  2s  .c o m*/
    this.addComponent(header);
    roadMapView = new MVerticalLayout().withSpacing(false);
    filterPanel = new MVerticalLayout().withWidth("250px").withStyleName(WebThemes.BOX);
    FloatingComponent floatingComponent = FloatingComponent.floatThis(filterPanel);
    floatingComponent.setContainerId("main-body");
    this.addComponent(
            new MHorizontalLayout().withFullWidth().with(roadMapView, filterPanel).expand(roadMapView));
}

From source file:com.mycollab.module.project.view.milestone.MilestoneTimelineWidget.java

License:Open Source License

public void display() {
    this.setWidth("100%");
    this.addStyleName("tm-container");
    this.setSpacing(true);
    this.setMargin(new MarginInfo(false, false, true, false));

    MHorizontalLayout headerLayout = new MHorizontalLayout().withStyleName(WebThemes.PANEL_HEADER);
    headerLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    ELabel titleLbl = ELabel.h3(UserUIContext.getMessage(MilestoneI18nEnum.OPT_TIMELINE));

    final CheckBox noDateSetMilestone = new CheckBox(UserUIContext.getMessage(DayI18nEnum.OPT_NO_DATE_SET));
    noDateSetMilestone.setValue(false);//from   w ww. ja  v  a 2 s . c o m

    final CheckBox includeClosedMilestone = new CheckBox(UserUIContext.getMessage(MilestoneStatus.Closed));
    includeClosedMilestone.setValue(false);

    noDateSetMilestone
            .addValueChangeListener(valueChangeEvent -> displayTimelines(noDateSetMilestone.getValue(),
                    includeClosedMilestone.getValue()));
    includeClosedMilestone
            .addValueChangeListener(valueChangeEvent -> displayTimelines(noDateSetMilestone.getValue(),
                    includeClosedMilestone.getValue()));
    headerLayout.with(titleLbl, noDateSetMilestone, includeClosedMilestone).expand(titleLbl)
            .withAlign(noDateSetMilestone, Alignment.MIDDLE_RIGHT)
            .withAlign(includeClosedMilestone, Alignment.MIDDLE_RIGHT);

    MilestoneSearchCriteria searchCriteria = new MilestoneSearchCriteria();
    searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
    searchCriteria.setOrderFields(
            Collections.singletonList(new SearchCriteria.OrderField(Milestone.Field.enddate.name(), "ASC")));
    MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class);
    milestones = milestoneService.findPageableListByCriteria(new BasicSearchRequest<>(searchCriteria));

    this.addComponent(headerLayout);
    timelineContainer = new CssLayout();
    timelineContainer.setWidth("100%");
    this.addComponent(timelineContainer);
    timelineContainer.addStyleName("tm-wrapper");
    displayTimelines(false, false);
}

From source file:com.mycollab.module.project.view.page.PageListViewImpl.java

License:Open Source License

private void initHeader() {
    HeaderWithFontAwesome headerText = ComponentUtils.headerH2(ProjectTypeConstants.PAGE,
            UserUIContext.getMessage(PageI18nEnum.LIST));

    headerLayout.with(headerText).alignAll(Alignment.MIDDLE_LEFT).expand(headerText);

    Label sortLbl = new Label(UserUIContext.getMessage(PageI18nEnum.OPT_SORT_LABEL));
    sortLbl.setSizeUndefined();/*from   www  . ja va2s.c o  m*/
    headerLayout.with(sortLbl).withAlign(sortLbl, Alignment.MIDDLE_RIGHT);

    ToggleButtonGroup sortGroup = new ToggleButtonGroup();
    headerLayout.with(sortGroup).withAlign(sortGroup, Alignment.MIDDLE_RIGHT);

    SortButton sortDateBtn = new SortButton(UserUIContext.getMessage(PageI18nEnum.OPT_SORT_BY_DATE),
            clickEvent -> {
                dateSourceAscend = !dateSourceAscend;
                if (dateSourceAscend) {
                    Collections.sort(resources, Ordering.from(dateSort));
                } else {
                    Collections.sort(resources, Ordering.from(dateSort).reverse());
                }
                displayPages(resources);
            });
    sortGroup.addButton(sortDateBtn);

    SortButton sortNameBtn = new SortButton(UserUIContext.getMessage(PageI18nEnum.OPT_SORT_BY_NAME),
            clickEvent -> {
                nameSortAscend = !nameSortAscend;
                if (nameSortAscend) {
                    Collections.sort(resources, Ordering.from(nameSort));
                } else {
                    Collections.sort(resources, Ordering.from(nameSort).reverse());
                }
                displayPages(resources);
            });
    sortGroup.addButton(sortNameBtn);

    SortButton sortKindBtn = new SortButton(UserUIContext.getMessage(PageI18nEnum.OPT_SORT_BY_KIND),
            clickEvent -> {
                kindSortAscend = !kindSortAscend;
                if (kindSortAscend) {
                    Collections.sort(resources, Ordering.from(kindSort));
                } else {
                    Collections.sort(resources, Ordering.from(kindSort).reverse());
                }
                displayPages(resources);
            });
    sortGroup.addButton(sortKindBtn);
    sortGroup.withDefaultButton(sortDateBtn);

    MButton newGroupBtn = new MButton(UserUIContext.getMessage(PageI18nEnum.NEW_GROUP),
            clickEvent -> UI.getCurrent().addWindow(new GroupPageAddWindow())).withIcon(FontAwesome.PLUS)
                    .withStyleName(WebThemes.BUTTON_ACTION);
    newGroupBtn.setVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES));
    headerLayout.with(newGroupBtn).withAlign(newGroupBtn, Alignment.MIDDLE_RIGHT);

    MButton newPageBtn = new MButton(UserUIContext.getMessage(PageI18nEnum.NEW),
            clickEvent -> EventBusFactory.getInstance().post(new PageEvent.GotoAdd(this, null)))
                    .withIcon(FontAwesome.PLUS).withStyleName(WebThemes.BUTTON_ACTION);
    newPageBtn.setVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES));

    headerLayout.with(newPageBtn).withAlign(newPageBtn, Alignment.MIDDLE_RIGHT);
}