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.esofthead.mycollab.module.project.view.bug.ComponentSearchPanel.java

License:Open Source License

private HorizontalLayout createSearchTopPanel() {
    final MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%").withSpacing(true)
            .withStyleName(UIConstants.HEADER_VIEW).withMargin(new MarginInfo(true, false, true, false));

    final Label componenttitle = new ProjectViewHeader(ProjectTypeConstants.BUG_COMPONENT,
            AppContext.getMessage(ComponentI18nEnum.VIEW_LIST_TITLE));
    componenttitle.setStyleName(UIConstants.HEADER_TEXT);

    layout.with(componenttitle).withAlign(componenttitle, Alignment.MIDDLE_LEFT).expand(componenttitle);

    final Button createBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_NEW_COMPONENT),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override/*from  w w  w  .j  a  v  a2  s.  c om*/
                public void buttonClick(final Button.ClickEvent event) {
                    EventBusFactory.getInstance().post(new BugComponentEvent.GotoAdd(this, null));
                }
            });
    createBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.COMPONENTS));
    createBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    createBtn.setIcon(FontAwesome.PLUS);

    layout.with(createBtn).withAlign(createBtn, Alignment.MIDDLE_RIGHT);

    return layout;
}

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

License:Open Source License

private HorizontalLayout createSearchTopPanel() {
    final MHorizontalLayout layout = new MHorizontalLayout().withStyleName(UIConstants.HEADER_VIEW)
            .withWidth("100%").withSpacing(true).withMargin(new MarginInfo(true, false, true, false));

    final Label versionTitle = new ProjectViewHeader(ProjectTypeConstants.BUG_VERSION,
            AppContext.getMessage(VersionI18nEnum.VIEW_LIST_TITLE));
    versionTitle.setStyleName(UIConstants.HEADER_TEXT);
    layout.with(versionTitle).withAlign(versionTitle, Alignment.MIDDLE_LEFT).expand(versionTitle);

    final Button createBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_NEW_VERSION),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override//w  w  w  . jav  a2s . com
                public void buttonClick(final Button.ClickEvent event) {
                    EventBusFactory.getInstance().post(new BugVersionEvent.GotoAdd(this, null));
                }
            });
    createBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.VERSIONS));
    createBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    createBtn.setIcon(FontAwesome.PLUS);

    layout.with(createBtn).withAlign(createBtn, Alignment.MIDDLE_LEFT);

    return layout;
}

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

License:Open Source License

public FollowingTicketViewImpl() {
    this.setWidth("100%");

    final MVerticalLayout headerWrapper = new MVerticalLayout().withSpacing(false).withMargin(false)
            .withWidth("100%").withStyleName("projectfeed-hdr-wrapper");

    final MHorizontalLayout header = new MHorizontalLayout().withMargin(false).withWidth("100%");

    final Label layoutHeader = new Label(FontAwesome.EYE.getHtml() + " My Following Tickets", ContentMode.HTML);
    layoutHeader.addStyleName("h2");
    header.with(layoutHeader).withAlign(layoutHeader, Alignment.MIDDLE_LEFT).expand(layoutHeader);

    headerWrapper.addComponent(header);/* ww w.java 2s  .  co  m*/
    this.addComponent(headerWrapper);

    MHorizontalLayout controlBtns = new MHorizontalLayout().withSpacing(false)
            .withMargin(new MarginInfo(true, false, true, false)).withWidth("100%");

    final MVerticalLayout contentWrapper = new MVerticalLayout().withSpacing(false).withMargin(false)
            .withWidth("100%");
    contentWrapper.addStyleName("content-wrapper");

    contentWrapper.addComponent(controlBtns);
    this.addComponent(contentWrapper);

    final Button backBtn = new Button(AppContext.getMessage(FollowerI18nEnum.BUTTON_BACK_TO_WORKBOARD));
    backBtn.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            EventBusFactory.getInstance()
                    .post(new ShellEvent.GotoProjectModule(FollowingTicketViewImpl.this, null));
        }
    });

    backBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    backBtn.setIcon(FontAwesome.ARROW_LEFT);

    controlBtns.addComponent(backBtn);
    controlBtns.setExpandRatio(backBtn, 1.0f);

    Button exportBtn = new Button("Export", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            exportButtonControl.setPopupVisible(true);
        }
    });
    exportButtonControl = new SplitButton(exportBtn);
    exportButtonControl.setWidthUndefined();
    exportButtonControl.addStyleName(UIConstants.THEME_GRAY_LINK);
    exportButtonControl.setIcon(FontAwesome.EXTERNAL_LINK);

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

    Button exportPdfBtn = new Button("Pdf");
    FileDownloader pdfDownloader = new FileDownloader(constructStreamResource(ReportExportType.PDF));
    pdfDownloader.extend(exportPdfBtn);
    exportPdfBtn.setIcon(FontAwesome.FILE_PDF_O);
    exportPdfBtn.setStyleName("link");
    popupButtonsControl.addComponent(exportPdfBtn);

    Button exportExcelBtn = new Button("Excel");
    FileDownloader excelDownloader = new FileDownloader(constructStreamResource(ReportExportType.EXCEL));
    excelDownloader.extend(exportExcelBtn);
    exportExcelBtn.setIcon(FontAwesome.FILE_EXCEL_O);
    exportExcelBtn.setStyleName("link");
    popupButtonsControl.addComponent(exportExcelBtn);

    controlBtns.addComponent(exportButtonControl);

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

    this.ticketTable = new FollowingTicketTableDisplay();
    this.ticketTable.addStyleName("full-border-table");
    this.ticketTable.setMargin(new MarginInfo(true, false, false, false));
    contentWrapper.addComponent(this.ticketTable);
}

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

License:Open Source License

private void constructHeader() {
    final HorizontalLayout header = new HorizontalLayout();
    header.setSpacing(true);//  w  ww  .j  a v  a2s  .  c om
    header.setWidth("100%");
    final Label taskGroupSelection = new Label(AppContext.getMessage(MilestoneI18nEnum.TAB_RELATED_BUGS));
    taskGroupSelection.addStyleName("h2");
    taskGroupSelection.addStyleName(UIConstants.THEME_NO_BORDER);
    header.addComponent(taskGroupSelection);
    header.setExpandRatio(taskGroupSelection, 1.0f);
    header.setComponentAlignment(taskGroupSelection, Alignment.MIDDLE_LEFT);

    this.viewGroup = new ToggleButtonGroup();

    final Button simpleDisplay = new Button(null, new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            MilestoneBugListComp.this.displaySimpleView();
        }
    });
    simpleDisplay.setIcon(MyCollabResource.newResource("icons/16/project/list_display.png"));

    this.viewGroup.addButton(simpleDisplay);

    final Button advanceDisplay = new Button(null, new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            MilestoneBugListComp.this.displayAdvancedView();
        }
    });
    advanceDisplay.setIcon(MyCollabResource.newResource("icons/16/project/bug_advanced_display.png"));
    this.viewGroup.addButton(advanceDisplay);
    header.addComponent(this.viewGroup);
    header.setComponentAlignment(this.viewGroup, Alignment.MIDDLE_RIGHT);
    this.addComponent(header);
}

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

License:Open Source License

private void initUI() {
    Label headerText = new ProjectViewHeader(ProjectTypeConstants.MILESTONE,
            AppContext.getMessage(MilestoneI18nEnum.VIEW_LIST_TITLE));

    MHorizontalLayout header = new MHorizontalLayout().withStyleName("hdr-view").withWidth("100%")
            .withSpacing(true).withMargin(true).with(headerText, createHeaderRight())
            .withAlign(headerText, Alignment.MIDDLE_LEFT).expand(headerText);
    this.addComponent(header);
}

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

License:Open Source License

private ComponentContainer constructMilestoneBox(final SimpleMilestone milestone) {
    final CssLayout layout = new CssLayout();
    layout.addStyleName(UIConstants.MILESTONE_BOX);
    layout.setWidth("100%");

    final LabelLink milestoneLink = new LabelLink(milestone.getName(),
            ProjectLinkBuilder.generateMilestonePreviewFullLink(milestone.getProjectid(), milestone.getId()));
    milestoneLink.setStyleName("link");
    milestoneLink.addStyleName("bold");
    milestoneLink.addStyleName(UIConstants.WORD_WRAP);
    milestoneLink.addStyleName("milestone-name");
    milestoneLink.setWidth("100%");

    MHorizontalLayout milestoneHeader = new MHorizontalLayout().withWidth("100%").with(milestoneLink)
            .expand(milestoneLink);/*w  w w.  j  a v a2s . c  o  m*/

    PopupButton taskSettingPopupBtn = new PopupButton();
    taskSettingPopupBtn.setWidth("20px");
    MVerticalLayout filterBtnLayout = new MVerticalLayout().withWidth("100px");

    Button editButton = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    EventBusFactory.getInstance()
                            .post(new MilestoneEvent.GotoEdit(MilestoneListViewImpl.this, milestone));
                }
            });
    editButton.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES));
    editButton.setStyleName("link");
    filterBtnLayout.addComponent(editButton);

    Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    ConfirmDialogExt.show(UI.getCurrent(),
                            AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE,
                                    SiteConfiguration.getSiteName()),
                            AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                            AppContext.getMessage(GenericI18Enum.BUTTON_YES),
                            AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() {
                                private static final long serialVersionUID = 1L;

                                @Override
                                public void onClose(ConfirmDialog dialog) {
                                    if (dialog.isConfirmed()) {
                                        MilestoneService projectTaskService = ApplicationContextUtil
                                                .getSpringBean(MilestoneService.class);
                                        projectTaskService.removeWithSession(milestone.getId(),
                                                AppContext.getUsername(), AppContext.getAccountId());
                                        milestones.remove(milestone);
                                        displayMilestones(milestones);
                                    }
                                }
                            });
                }
            });
    deleteBtn.setStyleName("link");
    deleteBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.MILESTONES));
    filterBtnLayout.addComponent(deleteBtn);

    taskSettingPopupBtn.setIcon(FontAwesome.COG);
    taskSettingPopupBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY);
    taskSettingPopupBtn.setContent(filterBtnLayout);

    milestoneHeader.addComponent(taskSettingPopupBtn);
    layout.addComponent(milestoneHeader);

    MHorizontalLayout spacing = new MHorizontalLayout().withHeight("8px").withWidth("100%");
    layout.addComponent(spacing);

    final GridFormLayoutHelper layoutHelper = new GridFormLayoutHelper(1, 5, "100%", "80px");
    layoutHelper.addComponent(
            new Label(AppContext.formatDate(milestone.getStartdate(),
                    AppContext.getMessage(GenericI18Enum.FORM_EMPTY))),
            AppContext.getMessage(MilestoneI18nEnum.FORM_START_DATE_FIELD), 0, 0, Alignment.MIDDLE_LEFT);
    layoutHelper.addComponent(
            new Label(AppContext.formatDate(milestone.getEnddate(),
                    AppContext.getMessage(GenericI18Enum.FORM_EMPTY))),
            AppContext.getMessage(MilestoneI18nEnum.FORM_END_DATE_FIELD), 0, 1, Alignment.MIDDLE_LEFT);

    CssLayout linkWrapper = new CssLayout();
    linkWrapper.setWidth("100%");
    linkWrapper.addComponent(new ProjectUserLink(milestone.getOwner(), milestone.getOwnerAvatarId(),
            milestone.getOwnerFullName(), false, true));
    layoutHelper.addComponent(linkWrapper, AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE), 0, 2,
            Alignment.MIDDLE_LEFT);

    final ProgressBarIndicator progressTask = new ProgressBarIndicator(milestone.getNumTasks(),
            milestone.getNumOpenTasks());
    progressTask.setWidth("100%");

    layoutHelper.addComponent(progressTask, AppContext.getMessage(MilestoneI18nEnum.FORM_TASK_FIELD), 0, 3,
            Alignment.MIDDLE_LEFT);

    final ProgressBarIndicator progressBug = new ProgressBarIndicator(milestone.getNumBugs(),
            milestone.getNumOpenBugs());
    progressBug.setWidth("100%");

    layoutHelper.addComponent(progressBug, AppContext.getMessage(MilestoneI18nEnum.FORM_BUG_FIELD), 0, 4,
            Alignment.MIDDLE_LEFT);
    final GridLayout milestoneInfoLayout = layoutHelper.getLayout();
    milestoneInfoLayout.setWidth("100%");
    milestoneInfoLayout.setMargin(false);
    milestoneInfoLayout.setSpacing(true);
    layout.addComponent(milestoneInfoLayout);

    return layout;
}

From source file:com.esofthead.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);/*  ww w .  j  a v  a2 s.com*/
    this.addComponent(header);
    roadMapView = new MVerticalLayout().withSpacing(false);
    filterPanel = new MVerticalLayout().withWidth("250px").withStyleName("box");
    FloatingComponent floatingComponent = FloatingComponent.floatThis(filterPanel);
    floatingComponent.setContainerId("main-body");
    this.addComponent(
            new MHorizontalLayout().withFullWidth().with(roadMapView, filterPanel).expand(roadMapView));
}

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

License:Open Source License

private void initHeader() {
    Label headerText = new ProjectViewHeader(ProjectTypeConstants.PAGE,
            AppContext.getMessage(Page18InEnum.VIEW_LIST_TITLE));

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

    Label sortLbl = new Label(AppContext.getMessage(Page18InEnum.OPT_SORT_LABEL));
    sortLbl.setSizeUndefined();/*from   ww w.  j a  v  a 2  s  .  c  om*/
    headerLayout.with(sortLbl).withAlign(sortLbl, Alignment.MIDDLE_RIGHT);

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

    SortButton sortDateBtn = new SortButton(AppContext.getMessage(Page18InEnum.OPT_SORT_BY_DATE),
            new Button.ClickListener() {

                private static final long serialVersionUID = -6987503077975316907L;

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    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(AppContext.getMessage(Page18InEnum.OPT_SORT_BY_NAME),
            new Button.ClickListener() {

                private static final long serialVersionUID = 2847554379518387585L;

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    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(AppContext.getMessage(Page18InEnum.OPT_SORT_BY_KIND),
            new Button.ClickListener() {

                private static final long serialVersionUID = 2230933690084074590L;

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    kindSortAscend = !kindSortAscend;
                    if (kindSortAscend) {
                        Collections.sort(resources, Ordering.from(kindSort));
                    } else {
                        Collections.sort(resources, Ordering.from(kindSort).reverse());
                    }
                    displayPages(resources);

                }
            });
    sortGroup.addButton(sortKindBtn);

    sortGroup.setDefaultButton(sortDateBtn);

    final Button newGroupBtn = new Button(AppContext.getMessage(Page18InEnum.BUTTON_NEW_GROUP),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    UI.getCurrent().addWindow(new PageGroupWindow());
                }
            });
    newGroupBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    newGroupBtn.setIcon(FontAwesome.PLUS);
    newGroupBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES));
    headerLayout.with(newGroupBtn).withAlign(newGroupBtn, Alignment.MIDDLE_RIGHT);

    final Button newPageBtn = new Button(AppContext.getMessage(Page18InEnum.BUTTON_NEW_PAGE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    EventBusFactory.getInstance().post(new PageEvent.GotoAdd(this, null));
                }
            });
    newPageBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    newPageBtn.setIcon(FontAwesome.PLUS);
    newPageBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES));

    headerText.setStyleName(UIConstants.HEADER_TEXT);
    headerLayout.with(newPageBtn).withAlign(newPageBtn, Alignment.MIDDLE_RIGHT);
}

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

License:Open Source License

private void constructHeader() {
    pageVersionsSelection = new PageVersionSelectionBox();

    Label headerLbl = new ProjectViewHeader(ProjectTypeConstants.PAGE,
            AppContext.getMessage(Page18InEnum.VIEW_READ_TITLE));
    headerLbl.setWidthUndefined();/*from  w w  w .  j a  v a 2s. co  m*/
    headerLbl.setStyleName(UIConstants.HEADER_TEXT);

    ((MHorizontalLayout) header).addComponent(headerLbl, 0);
    ((MHorizontalLayout) header).addComponent(pageVersionsSelection, 1);
    ((MHorizontalLayout) header).withMargin(true).withWidth("100%").withStyleName("hdr-view")
            .expand(pageVersionsSelection).alignAll(Alignment.MIDDLE_LEFT);
}

From source file:com.esofthead.mycollab.module.project.view.ProjectInformationComponent.java

License:Open Source License

public ProjectInformationComponent() {
    this.setStyleName(UIConstants.PROJECT_INFO);
    this.prjDisplay = new BasicProjectInformation();
    this.projectInfoHeader = new MHorizontalLayout().withMargin(true).withWidth("100%");
    this.projectInfoHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    this.projectInfoHeader.setStyleName(UIConstants.PROJECT_INFO_HEADER);
    this.addComponent(this.projectInfoHeader);
    this.addComponent(this.prjDisplay);

    MHorizontalLayout projectInfoFooter = new MHorizontalLayout().withMargin(true)
            .withStyleName(UIConstants.PROJECT_INFO_FOOTER);
    final Button toggleBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_MORE));
    toggleBtn.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override/*from   www .  j av a 2 s .c  om*/
        public void buttonClick(final ClickEvent event) {
            final int replaceIndex = ProjectInformationComponent.this
                    .getComponentIndex(ProjectInformationComponent.this.prjDisplay);
            ProjectInformationComponent.this.removeComponent(ProjectInformationComponent.this.prjDisplay);
            if (ProjectInformationComponent.this.prjDisplay instanceof BasicProjectInformation) {
                ProjectInformationComponent.this.prjDisplay = new DetailProjectInformation();
                event.getButton().setCaption(AppContext.getMessage(GenericI18Enum.BUTTON_LESS));
            } else {
                ProjectInformationComponent.this.prjDisplay = new BasicProjectInformation();
                event.getButton().setCaption(AppContext.getMessage(GenericI18Enum.BUTTON_MORE));
            }
            ProjectInformationComponent.this.addComponent(ProjectInformationComponent.this.prjDisplay,
                    replaceIndex);
            ProjectInformationComponent.this.prjDisplay.show();
        }
    });
    toggleBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    projectInfoFooter.addComponent(toggleBtn);
    this.addComponent(projectInfoFooter);
}