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.page.PageReadViewImpl.java

License:Open Source License

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

    HeaderWithFontAwesome headerLbl = ComponentUtils.headerH2(ProjectTypeConstants.PAGE,
            UserUIContext.getMessage(PageI18nEnum.DETAIL));
    headerLbl.setWidthUndefined();// w  ww .jav a 2 s.c  om

    header.addComponent(headerLbl, 0);
    header.addComponent(pageVersionsSelection, 1);
    header.withFullWidth().withStyleName("hdr-view").expand(pageVersionsSelection)
            .alignAll(Alignment.MIDDLE_LEFT);
}

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

License:Open Source License

public ProjectBreadcrumb() {
    setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
}

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

License:Open Source License

private void generateDisplayTable() {
    tableItem = new DefaultPagedBeanTable<>(AppContextUtil.getSpringBean(ProjectService.class),
            SimpleProject.class, ProjectTypeConstants.PROJECT, ProjectTableFieldDef.selected(),
            Arrays.asList(ProjectTableFieldDef.projectName(), ProjectTableFieldDef.lead(),
                    ProjectTableFieldDef.client(), ProjectTableFieldDef.startDate(),
                    ProjectTableFieldDef.homePage(), ProjectTableFieldDef.status()));

    tableItem.addGeneratedColumn("selected", (source, itemId, columnId) -> {
        final SimpleProject item = tableItem.getBeanByIndex(itemId);
        final CheckBoxDecor cb = new CheckBoxDecor("", item.isSelected());
        cb.setImmediate(true);/*from  www  . j a va2  s  .com*/
        cb.addValueChangeListener(valueChangeEvent -> tableItem.fireSelectItemEvent(item));
        item.setExtraData(cb);
        return cb;
    });

    tableItem.addGeneratedColumn(Project.Field.name.name(), (source, itemId, columnId) -> {
        SimpleProject project = tableItem.getBeanByIndex(itemId);
        LabelLink b = new LabelLink(project.getName(),
                ProjectLinkBuilder.generateProjectFullLink(project.getId()));
        b.setDescription(ProjectTooltipGenerator.generateToolTipProject(UserUIContext.getUserLocale(),
                MyCollabUI.getDateFormat(), project, MyCollabUI.getSiteUrl(), UserUIContext.getUserTimeZone()));
        return new MHorizontalLayout(ProjectAssetsUtil.buildProjectLogo(project.getShortname(), project.getId(),
                project.getAvatarid(), 32), b).expand(b).alignAll(Alignment.MIDDLE_LEFT).withMargin(false)
                        .withFullHeight();
    });

    tableItem.addGeneratedColumn(Project.Field.lead.name(), (source, itemId, columnId) -> {
        SimpleProject project = tableItem.getBeanByIndex(itemId);
        return new Label(ProjectLinkBuilder.generateProjectMemberHtmlLink(project.getId(), project.getLead(),
                project.getLeadFullName(), project.getLeadAvatarId(), true), ContentMode.HTML);
    });

    tableItem.addGeneratedColumn(Project.Field.accountid.name(), (source, itemId, columnId) -> {
        SimpleProject project = tableItem.getBeanByIndex(itemId);
        if (project.getAccountid() != null) {
            LabelLink b = new LabelLink(project.getClientName(),
                    ProjectLinkBuilder.generateClientPreviewFullLink(project.getAccountid()));
            b.setIconLink(CrmAssetsManager.getAsset(CrmTypeConstants.ACCOUNT));
            return b;
        } else {
            return new Label();
        }
    });

    tableItem.addGeneratedColumn(Project.Field.planstartdate.name(), (source, itemId, columnId) -> {
        SimpleProject project = tableItem.getBeanByIndex(itemId);
        return new Label(UserUIContext.formatDate(project.getPlanstartdate()));
    });

    tableItem.addGeneratedColumn(Project.Field.planenddate.name(), (source, itemId, columnId) -> {
        SimpleProject project = tableItem.getBeanByIndex(itemId);
        return new Label(UserUIContext.formatDate(project.getPlanenddate()));
    });

    tableItem.addGeneratedColumn(Project.Field.projectstatus.name(), (source, itemId, columnId) -> {
        SimpleProject project = tableItem.getBeanByIndex(itemId);
        return ELabel.i18n(project.getProjectstatus(), StatusI18nEnum.class);
    });

    tableItem.addGeneratedColumn(Project.Field.createdtime.name(), (source, itemId, columnId) -> {
        SimpleProject project = tableItem.getBeanByIndex(itemId);
        return new Label(UserUIContext.formatDate(project.getCreatedtime()));
    });

    tableItem.addGeneratedColumn(Project.Field.homepage.name(), (source, itemId, columnId) -> {
        SimpleProject project = tableItem.getBeanByIndex(itemId);
        if (StringUtils.isNotBlank(project.getHomepage())) {
            return new Label(new A(project.getHomepage(), "_blank").appendText(project.getHomepage()).write(),
                    ContentMode.HTML);
        } else {
            return new Label();
        }
    });

    tableItem.setWidth("100%");

    bodyLayout.addComponent(constructTableActionControls());
    bodyLayout.addComponent(tableItem);
}

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

License:Open Source License

@Override
public MHorizontalLayout buildMenu() {
    if (serviceMenuContainer == null) {
        serviceMenuContainer = new MHorizontalLayout().withHeight("45px")
                .withMargin(new MarginInfo(false, true, false, true)).withStyleName("service-menu");
        serviceMenuContainer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

        MButton boardBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_BOARD),
                clickEvent -> {/*from   www .  j ava2  s .com*/
                    EventBusFactory.getInstance().post(new ProjectEvent.GotoUserDashboard(this, null));
                });
        serviceMenuContainer.with(boardBtn);

        Button switchPrjBtn = new SwitchProjectPopupButton();
        serviceMenuContainer.with(switchPrjBtn);

        if (!SiteConfiguration.isCommunityEdition()) {
            MButton clientBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_CLIENTS),
                    clickEvent -> {
                        EventBusFactory.getInstance().post(new ClientEvent.GotoList(this, null));
                    });

            MButton reportBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_REPORTS),
                    clickEvent -> {
                        EventBusFactory.getInstance().post(new ReportEvent.GotoConsole(this));
                    });
            serviceMenuContainer.with(clientBtn, reportBtn);
        }

        PopupButton newBtn = new PopupButton(UserUIContext.getMessage(GenericI18Enum.ACTION_NEW));
        newBtn.addStyleName("add-btn-popup");
        newBtn.setIcon(FontAwesome.PLUS_CIRCLE);
        OptionPopupContent contentLayout = new OptionPopupContent();
        MButton newPrjButton = new MButton(UserUIContext.getMessage(ProjectI18nEnum.SINGLE), clickEvent -> {
            UI.getCurrent().addWindow(ViewManager.getCacheComponent(AbstractProjectAddWindow.class));
            newBtn.setPopupVisible(false);
        }).withIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.PROJECT));
        contentLayout.addOption(newPrjButton);
        newBtn.setContent(contentLayout);
        newBtn.setVisible(UserUIContext.canBeYes(RolePermissionCollections.CREATE_NEW_PROJECT));

        serviceMenuContainer.with(newBtn).withAlign(newBtn, Alignment.MIDDLE_LEFT);
    }

    return serviceMenuContainer;
}

From source file:com.mycollab.module.project.view.settings.component.NotificationSettingWindow.java

License:Open Source License

public NotificationSettingWindow(SimpleProjectMember projectMember) {
    super(UserUIContext.getMessage(ProjectCommonI18nEnum.ACTION_EDIT_NOTIFICATION));
    withModal(true).withResizable(false).withWidth("600px").withCenter();
    ProjectNotificationSettingService prjNotificationSettingService = AppContextUtil
            .getSpringBean(ProjectNotificationSettingService.class);
    ProjectNotificationSetting notification = prjNotificationSettingService.findNotification(
            projectMember.getUsername(), projectMember.getProjectid(), projectMember.getSaccountid());

    MVerticalLayout body = new MVerticalLayout();

    final OptionGroup optionGroup = new OptionGroup(null);
    optionGroup.setItemCaptionMode(AbstractSelect.ItemCaptionMode.EXPLICIT);

    optionGroup.addItem(NotificationType.Default.name());
    optionGroup.setItemCaption(NotificationType.Default.name(),
            UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_DEFAULT_SETTING));

    optionGroup.addItem(NotificationType.None.name());
    optionGroup.setItemCaption(NotificationType.None.name(),
            UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_NONE_SETTING));

    optionGroup.addItem(NotificationType.Minimal.name());
    optionGroup.setItemCaption(NotificationType.Minimal.name(),
            UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_MINIMUM_SETTING));

    optionGroup.addItem(NotificationType.Full.name());
    optionGroup.setItemCaption(NotificationType.Full.name(),
            UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_MAXIMUM_SETTING));

    optionGroup.setWidth("100%");

    body.with(optionGroup).withAlign(optionGroup, Alignment.MIDDLE_LEFT);

    String levelVal = notification.getLevel();
    if (levelVal == null) {
        optionGroup.select(NotificationType.Default.name());
    } else {/*from  w ww  .j  av a 2s  .c om*/
        optionGroup.select(levelVal);
    }

    MButton closeBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLOSE), clickEvent -> close())
            .withStyleName(WebThemes.BUTTON_OPTION);
    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> {
        try {
            notification.setLevel((String) optionGroup.getValue());
            ProjectNotificationSettingService projectNotificationSettingService = AppContextUtil
                    .getSpringBean(ProjectNotificationSettingService.class);

            if (notification.getId() == null) {
                projectNotificationSettingService.saveWithSession(notification, UserUIContext.getUsername());
            } else {
                projectNotificationSettingService.updateWithSession(notification, UserUIContext.getUsername());
            }
            NotificationUtil.showNotification(UserUIContext.getMessage(GenericI18Enum.OPT_CONGRATS),
                    UserUIContext.getMessage(ProjectSettingI18nEnum.DIALOG_UPDATE_SUCCESS));
            close();
        } catch (Exception e) {
            throw new MyCollabException(e);
        }
    }).withStyleName(WebThemes.BUTTON_ACTION).withIcon(FontAwesome.SAVE);
    MHorizontalLayout btnControls = new MHorizontalLayout(closeBtn, saveBtn);
    body.with(btnControls).withAlign(btnControls, Alignment.TOP_RIGHT);

    withContent(body);
}

From source file:com.mycollab.module.project.view.settings.ProjectMemberListViewImpl.java

License:Open Source License

public ProjectMemberListViewImpl() {
    super();/*www  . j  ava  2s.  c o m*/
    this.setMargin(new MarginInfo(false, true, true, true));
    MHorizontalLayout viewHeader = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false))
            .withFullWidth();
    viewHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    headerText = ComponentUtils.headerH2(ProjectTypeConstants.MEMBER,
            UserUIContext.getMessage(ProjectMemberI18nEnum.LIST));
    viewHeader.with(headerText).expand(headerText);

    final MButton sortBtn = new MButton().withIcon(FontAwesome.SORT_ALPHA_ASC)
            .withStyleName(WebThemes.BUTTON_ICON_ONLY);
    sortBtn.addClickListener(clickEvent -> {
        sortAsc = !sortAsc;
        if (sortAsc) {
            sortBtn.setIcon(FontAwesome.SORT_ALPHA_ASC);
            displayMembers();
        } else {
            sortBtn.setIcon(FontAwesome.SORT_ALPHA_DESC);
            displayMembers();
        }
    });
    viewHeader.addComponent(sortBtn);

    final SearchTextField searchTextField = new SearchTextField() {
        @Override
        public void doSearch(String value) {
            searchCriteria.setMemberFullName(StringSearchField.and(value));
            displayMembers();
        }

        @Override
        public void emptySearch() {
            searchCriteria.setMemberFullName(null);
            displayMembers();
        }
    };
    searchTextField.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    viewHeader.addComponent(searchTextField);

    MButton printBtn = new MButton("", clickEvent -> {
        UI.getCurrent().addWindow(new ProjectMemberCustomizeReportOutputWindow(new LazyValueInjector() {
            @Override
            protected Object doEval() {
                return searchCriteria;
            }
        }));
    }).withIcon(FontAwesome.PRINT).withStyleName(WebThemes.BUTTON_OPTION)
            .withDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_EXPORT));
    viewHeader.addComponent(printBtn);

    MButton createBtn = new MButton(UserUIContext.getMessage(ProjectMemberI18nEnum.BUTTON_NEW_INVITEES),
            clickEvent -> EventBusFactory.getInstance()
                    .post(new ProjectMemberEvent.GotoInviteMembers(this, null)))
                            .withStyleName(WebThemes.BUTTON_ACTION).withIcon(FontAwesome.SEND);
    createBtn.setVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS));
    viewHeader.addComponent(createBtn);

    addComponent(viewHeader);

    contentLayout = new CssLayout();
    contentLayout.setWidth("100%");
    addComponent(contentLayout);
}

From source file:com.mycollab.module.project.view.settings.ProjectNotificationSettingViewComponent.java

License:Open Source License

public ProjectNotificationSettingViewComponent(final ProjectNotificationSetting bean) {
    super(UserUIContext.getMessage(ProjectSettingI18nEnum.VIEW_TITLE));

    MVerticalLayout body = new MVerticalLayout().withMargin(new MarginInfo(true, false, false, false));
    body.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    final OptionGroup optionGroup = new OptionGroup(null);
    optionGroup.setItemCaptionMode(ItemCaptionMode.EXPLICIT);

    optionGroup.addItem(NotificationType.Default.name());
    optionGroup.setItemCaption(NotificationType.Default.name(),
            UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_DEFAULT_SETTING));

    optionGroup.addItem(NotificationType.None.name());
    optionGroup.setItemCaption(NotificationType.None.name(),
            UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_NONE_SETTING));

    optionGroup.addItem(NotificationType.Minimal.name());
    optionGroup.setItemCaption(NotificationType.Minimal.name(),
            UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_MINIMUM_SETTING));

    optionGroup.addItem(NotificationType.Full.name());
    optionGroup.setItemCaption(NotificationType.Full.name(),
            UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_MAXIMUM_SETTING));

    optionGroup.setWidth("100%");
    body.with(optionGroup);/* w w  w . j av a 2 s .  c  o m*/

    String levelVal = bean.getLevel();
    if (levelVal == null) {
        optionGroup.select(NotificationType.Default.name());
    } else {
        optionGroup.select(levelVal);
    }

    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> {
        try {
            bean.setLevel((String) optionGroup.getValue());
            ProjectNotificationSettingService projectNotificationSettingService = AppContextUtil
                    .getSpringBean(ProjectNotificationSettingService.class);

            if (bean.getId() == null) {
                projectNotificationSettingService.saveWithSession(bean, UserUIContext.getUsername());
            } else {
                projectNotificationSettingService.updateWithSession(bean, UserUIContext.getUsername());
            }
            NotificationUtil.showNotification(UserUIContext.getMessage(GenericI18Enum.OPT_CONGRATS),
                    UserUIContext.getMessage(ProjectSettingI18nEnum.DIALOG_UPDATE_SUCCESS));
        } catch (Exception e) {
            throw new MyCollabException(e);
        }
    }).withIcon(FontAwesome.SAVE).withStyleName(WebThemes.BUTTON_ACTION);
    body.addComponent(saveBtn);

    this.addComponent(body);
}

From source file:com.mycollab.module.project.view.settings.ProjectRoleListViewImpl.java

License:Open Source License

private ComponentContainer constructTableActionControls() {
    CssLayout layoutWrapper = new CssLayout();
    layoutWrapper.setWidth("100%");
    MHorizontalLayout layout = new MHorizontalLayout();
    layoutWrapper.addStyleName(WebThemes.TABLE_ACTION_CONTROLS);
    layoutWrapper.addComponent(layout);//from  w w w .  j  a va  2s  .  c o  m

    selectOptionButton = new SelectionOptionButton(this.tableItem);
    layout.addComponent(this.selectOptionButton);

    tableActionControls = new DefaultMassItemActionHandlerContainer();
    if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.ROLES)) {
        tableActionControls.addDeleteActionItem();
    }

    tableActionControls.addDownloadPdfActionItem();
    tableActionControls.addDownloadExcelActionItem();
    tableActionControls.addDownloadCsvActionItem();

    layout.with(this.tableActionControls, this.selectedItemsNumberLabel).withAlign(selectedItemsNumberLabel,
            Alignment.MIDDLE_LEFT);
    return layoutWrapper;
}

From source file:com.mycollab.module.project.view.settings.ProjectRoleReadViewImpl.java

License:Open Source License

private ComponentContainer constructHeader() {
    header = new MHorizontalLayout().withStyleName("hdr-view").withFullWidth().withMargin(true);
    header.with(headerText).alignAll(Alignment.MIDDLE_LEFT).expand(headerText);
    return header;
}

From source file:com.mycollab.module.project.view.task.TaskDashboardViewImpl.java

License:Open Source License

public TaskDashboardViewImpl() {
    this.withMargin(new MarginInfo(false, true, true, true));
    taskSearchPanel = new TaskSearchPanel();

    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(new Property.ValueChangeListener() {
        @Override/*from ww w.j a  v a2s.  com*/
        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
            String sortValue = (String) sortCombo.getValue();
            if (AppContext.getMessage(GenericI18Enum.OPT_SORT_ASCENDING).equals(sortValue)) {
                sortDirection = SearchCriteria.ASC;
            } else {
                sortDirection = SearchCriteria.DESC;
            }
            queryAndDisplayTasks();
        }
    });
    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();
        queryAndDisplayTasks();
    });
    groupByState = GROUP_DUE_DATE;
    groupWrapLayout.addComponent(groupCombo);

    taskSearchPanel.addHeaderRight(groupWrapLayout);

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

    MButton newTaskBtn = new MButton(AppContext.getMessage(TaskI18nEnum.NEW), clickEvent -> {
        if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) {
            SimpleTask newTask = new SimpleTask();
            newTask.setProjectid(CurrentProjectVariables.getProjectId());
            newTask.setSaccountid(AppContext.getAccountId());
            newTask.setLogby(AppContext.getUsername());
            UI.getCurrent().addWindow(new TaskAddWindow(newTask));
        }
    }).withIcon(FontAwesome.PLUS).withStyleName(UIConstants.BUTTON_ACTION);
    newTaskBtn.setVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS));
    groupWrapLayout.addComponent(newTaskBtn);

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

    MButton kanbanBtn = new MButton("Kanban", clickEvent -> displayKanbanView()).withWidth("100px")
            .withIcon(FontAwesome.TH).withDescription("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, false, false));
    mainLayout.with(wrapBody, rightColumn).expand(wrapBody);
    this.with(taskSearchPanel, mainLayout);
}