Java Code Examples for org.vaadin.viritin.layouts.MVerticalLayout#setDefaultComponentAlignment()

The following examples show how to use org.vaadin.viritin.layouts.MVerticalLayout#setDefaultComponentAlignment() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReportContainerImpl.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void showDashboard() {
    body.removeAllComponents();
    body.with(ELabel.h2(VaadinIcons.PIE_CHART.getHtml() + " " + UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_REPORTS)));
    MCssLayout contentLayout = new MCssLayout().withStyleName(WebThemes.FLEX_DISPLAY);

    MVerticalLayout standupConsole = new MVerticalLayout().withWidth("300px").withStyleName("member-block");
    standupConsole.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    standupConsole.addComponent(ELabel.fontIcon(VaadinIcons.CALENDAR_CLOCK).withStyleName("icon-38px"));
    A standupReportLink = new A(ProjectLinkGenerator.generateStandupDashboardLink())
            .appendText(UserUIContext.getMessage(ProjectReportI18nEnum.REPORT_STANDUP));
    standupConsole.addComponent(ELabel.h3(standupReportLink.write()).withUndefinedWidth());
    standupConsole.addComponent(new ELabel(UserUIContext.getMessage(ProjectReportI18nEnum.REPORT_STANDUP_HELP)).withFullWidth());
    contentLayout.addComponent(standupConsole);


    MVerticalLayout userWorkloadReport = new MVerticalLayout().withWidth("300px").withStyleName("member-block");
    userWorkloadReport.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    userWorkloadReport.addComponent(ELabel.fontIcon(VaadinIcons.CALENDAR_CLOCK).withStyleName("icon-38px"));
    A userWorkloadReportLink = new A(ProjectLinkGenerator.generateUsersWorkloadReportLink())
            .appendText(UserUIContext.getMessage(ProjectReportI18nEnum.REPORT_TICKET_ASSIGNMENT));
    userWorkloadReport.addComponent(ELabel.h3(userWorkloadReportLink.write()).withUndefinedWidth());
    userWorkloadReport.addComponent(new ELabel(UserUIContext.getMessage(ProjectReportI18nEnum.REPORT_TICKET_ASSIGNMENT_HELP)).withFullWidth());
    contentLayout.addComponent(userWorkloadReport);

    body.with(contentLayout).expand(contentLayout).withAlign(contentLayout, Alignment.TOP_LEFT);
}
 
Example 2
Source File: StandupListViewImpl.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public Component generateRow(IBeanList<SimpleStandupReport> host, SimpleStandupReport report, int rowIndex) {
    MHorizontalLayout rowLayout = new MHorizontalLayout().withStyleName(WebThemes.BORDER);

    MVerticalLayout userInfo = new MVerticalLayout().withWidth("200px").withFullHeight().withStyleName(WebThemes
            .HOVER_EFFECT_NOT_BOX);
    userInfo.setDefaultComponentAlignment(Alignment.TOP_CENTER);

    Image userAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(report.getLogByAvatarId(), 100);
    userAvatar.addStyleName(WebThemes.CIRCLE_BOX);
    userInfo.addComponent(userAvatar);
    Label memberLink = ELabel.html(buildMemberLink(report));
    userInfo.with(memberLink).expand(memberLink).withAlign(memberLink, Alignment.TOP_CENTER);
    rowLayout.addComponent(userInfo);

    MVerticalLayout reportContent = new MVerticalLayout().withStyleName(WebThemes.BORDER_LEFT, WebThemes.HOVER_EFFECT_NOT_BOX);

    reportContent.addComponent(ELabel.h3(UserUIContext.getMessage(StandupI18nEnum.STANDUP_LASTDAY)).withStyleName(WebThemes.LABEL_WORD_WRAP).withFullWidth());
    Label whatYesterdayField = new SafeHtmlLabel(report.getWhatlastday());
    whatYesterdayField.setWidth("100%");
    reportContent.addComponent(whatYesterdayField);

    reportContent.addComponent(ELabel.h3(UserUIContext.getMessage(StandupI18nEnum.STANDUP_TODAY)).withStyleName(WebThemes.LABEL_WORD_WRAP).withFullWidth());
    Label whatTodayField = new SafeHtmlLabel(report.getWhattoday());
    whatTodayField.setWidth("100%");
    reportContent.addComponent(whatTodayField);

    reportContent.addComponent(ELabel.h3(UserUIContext.getMessage(StandupI18nEnum.STANDUP_ISSUE)).withStyleName(WebThemes.LABEL_WORD_WRAP).withFullWidth());
    Label whatProblemField = new SafeHtmlLabel(report.getWhatproblem());
    whatProblemField.setWidth("100%");
    reportContent.addComponent(whatProblemField);

    rowLayout.with(reportContent).expand(reportContent);
    return rowLayout;
}
 
Example 3
Source File: ProjectNotificationSettingViewComponent.java    From mycollab with GNU Affero General Public License v3.0 4 votes vote down vote up
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 RadioButtonGroup<String> optionGroup = new RadioButtonGroup<>(null);
    optionGroup.setItems(NotificationType.Default.name(), NotificationType.None.name(), NotificationType.Minimal.name(), NotificationType.Full.name());
    optionGroup.setItemCaptionGenerator((ItemCaptionGenerator<String>) item -> {
        if (item.equals(NotificationType.Default.name())) {
            return UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_DEFAULT_SETTING);
        } else if (item.equals(NotificationType.None.name())) {
            return UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_NONE_SETTING);
        } else if (item.equals(NotificationType.Minimal.name())) {
            return UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_MINIMUM_SETTING);
        } else if (item.equals(NotificationType.Full.name())) {
            return UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_MAXIMUM_SETTING);
        } else {
            throw new MyCollabException("Not supported");
        }
    });

    optionGroup.setWidth("100%");
    body.with(optionGroup);

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

    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> {
        try {
            bean.setLevel(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(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION).withVisible(!CurrentProjectVariables.isProjectArchived())
            .withClickShortcut(KeyCode.ENTER);
    body.addComponent(saveBtn);

    this.addComponent(body);
}