com.vaadin.ui.CustomLayout Java Examples

The following examples show how to use com.vaadin.ui.CustomLayout. 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: AbstractMainView.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
private CustomLayout createTopMenu() {
    headerLayout = CustomLayoutExt.createLayout("topNavigation");
    headerLayout.setStyleName("topNavigation");
    headerLayout.setHeight("45px");
    headerLayout.setWidth("100%");

    Resource logoResource = AccountAssetsResolver.createLogoResource(AppUI.getBillingAccount().getLogopath(), 150);

    headerLayout.addComponent(new Image("", logoResource), "mainLogo");

    accountLayout = new MHorizontalLayout().withMargin(new MarginInfo(false, true, false, false)).withHeight("45px");
    accountLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    buildAccountMenuLayout();

    headerLayout.addComponent(accountLayout, "accountMenu");
    return headerLayout;
}
 
Example #2
Source File: DynamicQueryParamLayout.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
public DynamicQueryParamLayout(DefaultGenericSearchPanel<S> parent, String type) {
    super(parent);
    CustomLayout layout = CustomLayoutExt.createLayout("advancedSearch");
    this.type = type;
    headerLayout = constructHeader();
    buildCriterionComp = new BuildCriterionComponent<S>(this, getParamFields(), type) {
        private static final long serialVersionUID = 1L;

        @Override
        protected Component buildPropertySearchComp(String fieldId) {
            return buildSelectionComp(fieldId);
        }
    };

    layout.addComponent(headerLayout, "advSearchHeader");
    layout.addComponent(buildCriterionComp, "advSearchBody");
    layout.addComponent(createButtonControls(), "advSearchFooter");
    setCompositionRoot(layout);
}
 
Example #3
Source File: AbstractHawkbitLoginUI.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void addFooter(final VerticalLayout rootLayout) {
    final Resource resource = context
            .getResource("classpath:/VAADIN/themes/" + UI.getCurrent().getTheme() + "/layouts/footer.html");

    try (final InputStream resourceStream = resource.getInputStream()) {
        final CustomLayout customLayout = new CustomLayout(resourceStream);
        customLayout.setSizeUndefined();
        rootLayout.addComponent(customLayout);
        rootLayout.setComponentAlignment(customLayout, Alignment.BOTTOM_LEFT);
    } catch (final IOException ex) {
        LOG.error("Footer file cannot be loaded", ex);
    }
}
 
Example #4
Source File: CustomLayoutExt.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
public static CustomLayout createLayout(String layoutId) {
    try {
        return new CustomLayout(CustomLayoutExt.class.getClassLoader().getResourceAsStream("layouts/" + layoutId + ".html"));
    } catch (Exception e) {
        throw new MyCollabException(e);
    }
}
 
Example #5
Source File: ForgotPasswordViewImpl.java    From mycollab with GNU Affero General Public License v3.0 4 votes vote down vote up
ForgotPwdForm() {
    CustomLayout customLayout = CustomLayoutExt.createLayout("forgotPassword");
    customLayout.setStyleName("forgotPwdForm");

    Resource logoResource = AccountAssetsResolver.createLogoResource(AppUI.getBillingAccount().getLogopath(), 150);
    customLayout.addComponent(new Image(null, logoResource), "logo-here");

    customLayout.addComponent(new ELabel(LocalizationHelper.getMessage(AppUI.getDefaultLocale(),
            ShellI18nEnum.BUTTON_FORGOT_PASSWORD)), "formHeader");
    customLayout.addComponent(ELabel.html(LocalizationHelper.getMessage(AppUI.getDefaultLocale(),
            ShellI18nEnum.OPT_FORGOT_PASSWORD_INTRO)), "intro-text");
    nameOrEmailField = new TextField(LocalizationHelper.getMessage(AppUI.getDefaultLocale(), GenericI18Enum.FORM_EMAIL));
    customLayout.addComponent(nameOrEmailField, "nameoremail");

    MButton sendEmail = new MButton(LocalizationHelper.getMessage(AppUI.getDefaultLocale(), ShellI18nEnum.BUTTON_RESET_PASSWORD), clickEvent -> {
        String username = nameOrEmailField.getValue();
        if (StringUtils.isValidEmail(username)) {
            UserService userService = AppContextUtil.getSpringBean(UserService.class);
            User user = userService.findUserByUserName(username);

            if (user == null) {
                NotificationUtil.showErrorNotification(LocalizationHelper.getMessage(AppUI.getDefaultLocale(), GenericI18Enum.ERROR_USER_IS_NOT_EXISTED, username));
            } else {
                userService.requestToResetPassword(user.getUsername());
                NotificationUtil.showNotification(LocalizationHelper.getMessage(AppUI.getDefaultLocale(), GenericI18Enum.OPT_SUCCESS),
                        LocalizationHelper.getMessage(AppUI.getDefaultLocale(), ShellI18nEnum.OPT_EMAIL_SENDER_NOTIFICATION));
                EventBusFactory.getInstance().post(new ShellEvent.LogOut(this, null));
            }
        } else {
            NotificationUtil.showErrorNotification(LocalizationHelper.getMessage(AppUI.getDefaultLocale(), ErrorI18nEnum.NOT_VALID_EMAIL, username));
        }
    }).withStyleName(WebThemes.BUTTON_ACTION).withClickShortcut(ShortcutAction.KeyCode.ENTER);
    customLayout.addComponent(sendEmail, "loginButton");

    MButton memoBackBtn = new MButton(LocalizationHelper.getMessage(AppUI.getDefaultLocale(), ShellI18nEnum.BUTTON_IGNORE_RESET_PASSWORD),
            clickEvent -> EventBusFactory.getInstance().post(new ShellEvent.LogOut(this, null)))
            .withStyleName(WebThemes.BUTTON_LINK);
    customLayout.addComponent(memoBackBtn, "forgotLink");

    this.setCompositionRoot(customLayout);
}