Example usage for com.vaadin.ui Alignment MIDDLE_RIGHT

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

Introduction

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

Prototype

Alignment MIDDLE_RIGHT

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

Click Source Link

Usage

From source file:com.esofthead.mycollab.module.user.accountsettings.team.view.NewUserAddedWindow.java

License:Open Source License

public NewUserAddedWindow(final SimpleUser user, String uncryptPassword) {
    super(AppContext.getMessage(UserI18nEnum.NEW));
    this.setModal(true);
    this.setResizable(false);
    this.setClosable(false);
    this.center();
    this.setWidth("600px");
    MVerticalLayout content = new MVerticalLayout();
    this.setContent(content);

    ELabel infoLbl = new ELabel(
            FontAwesome.CHECK_CIRCLE.getHtml()
                    + AppContext.getMessage(UserI18nEnum.OPT_NEW_USER_CREATED, user.getDisplayName()),
            ContentMode.HTML);//  ww  w .j a v  a 2s  .  c  om
    content.with(infoLbl);

    String signinInstruction = AppContext.getMessage(UserI18nEnum.OPT_SIGN_IN_MSG, AppContext.getSiteUrl(),
            AppContext.getSiteUrl());
    content.with(new MVerticalLayout(new Label(signinInstruction, ContentMode.HTML),
            new ELabel(AppContext.getMessage(ShellI18nEnum.FORM_EMAIL)).withStyleName(UIConstants.META_INFO),
            new Label("    " + user.getUsername()),
            new ELabel(AppContext.getMessage(ShellI18nEnum.FORM_PASSWORD)).withStyleName(UIConstants.META_INFO),
            new Label("    " + (uncryptPassword != null ? uncryptPassword
                    : AppContext.getMessage(UserI18nEnum.OPT_USER_SET_OWN_PASSWORD)))));

    Button sendEmailBtn = new Button(AppContext.getMessage(GenericI18Enum.ACTION_SEND_EMAIL),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent clickEvent) {
                    ExtMailService mailService = AppContextUtil.getSpringBean(ExtMailService.class);
                    if (!mailService.isMailSetupValid()) {
                        UI.getCurrent().addWindow(new GetStartedInstructionWindow(user));
                    } else {

                        NotificationUtil.showNotification(
                                AppContext.getMessage(GenericI18Enum.HELP_SPAM_FILTER_PREVENT_TITLE),
                                AppContext.getMessage(GenericI18Enum.HELP_SPAM_FILTER_PREVENT_MESSAGE));
                    }
                }
            });

    content.with(new ELabel(AppContext.getMessage(GenericI18Enum.HELP_SPAM_FILTER_PREVENT_MESSAGE))
            .withStyleName(UIConstants.META_INFO));

    Button createMoreUserBtn = new Button(AppContext.getMessage(UserI18nEnum.OPT_CREATE_ANOTHER_USER),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent clickEvent) {
                    EventBusFactory.getInstance().post(new UserEvent.GotoAdd(this, null));
                    close();
                }
            });
    createMoreUserBtn.addStyleName(UIConstants.BUTTON_LINK);

    Button doneBtn = new Button(AppContext.getMessage(GenericI18Enum.ACTION_DONE), new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            EventBusFactory.getInstance().post(new UserEvent.GotoList(this, null));
            close();
        }
    });
    doneBtn.addStyleName(UIConstants.BUTTON_ACTION);
    MHorizontalLayout buttonControls = new MHorizontalLayout(createMoreUserBtn, doneBtn).withFullWidth()
            .withAlign(createMoreUserBtn, Alignment.MIDDLE_LEFT).withAlign(doneBtn, Alignment.MIDDLE_RIGHT);
    content.with(buttonControls);
}

From source file:com.esofthead.mycollab.module.user.accountsettings.team.view.RoleSearchPanel.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));
    layout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    final Label searchtitle = new Label(
            FontAwesome.USERS.getHtml() + " " + AppContext.getMessage(RoleI18nEnum.VIEW_LIST_TITLE),
            ContentMode.HTML);/*from w  w w. j  ava 2  s. c o  m*/
    searchtitle.setStyleName(UIConstants.HEADER_TEXT);
    layout.addComponent(searchtitle);
    layout.setExpandRatio(searchtitle, 1.0f);

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

                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    EventBusFactory.getInstance().post(new RoleEvent.GotoAdd(this, null));
                }
            });
    createBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    createBtn.setIcon(FontAwesome.PLUS);
    createBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.ACCOUNT_ROLE));

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

    return layout;
}

From source file:com.esofthead.mycollab.module.user.accountsettings.team.view.UserListViewImpl.java

License:Open Source License

@SuppressWarnings("unchecked")
@Override/*from  w  w w.  ja  v a2s .  co m*/
public void setSearchCriteria(UserSearchCriteria searchCriteria) {
    UserService userService = ApplicationContextUtil.getSpringBean(UserService.class);
    List<SimpleUser> userAccountList = userService
            .findPagableListByCriteria(new SearchRequest<>(searchCriteria, 0, Integer.MAX_VALUE));

    this.removeAllComponents();
    this.setSpacing(true);
    HorizontalLayout header = new HorizontalLayout();
    header.setStyleName(UIConstants.HEADER_VIEW);
    header.setWidth("100%");
    header.setMargin(new MarginInfo(true, false, true, false));
    Button createBtn = new Button("Invite user", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new UserEvent.GotoAdd(this, null));
        }
    });
    createBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.ACCOUNT_USER));
    createBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    createBtn.setIcon(FontAwesome.PLUS);

    header.addComponent(createBtn);
    header.setComponentAlignment(createBtn, Alignment.MIDDLE_RIGHT);
    this.addComponent(header);

    CssLayout contentLayout = new CssLayout();
    contentLayout.setWidth("100%");
    for (SimpleUser userAccount : userAccountList) {
        contentLayout.addComponent(generateMemberBlock(userAccount));
    }
    this.addComponent(contentLayout);
}

From source file:com.esofthead.mycollab.module.user.accountsettings.team.view.UserListViewImpl.java

License:Open Source License

private Component generateMemberBlock(final SimpleUser member) {
    CssLayout memberBlock = new CssLayout();
    memberBlock.addStyleName("member-block");

    VerticalLayout blockContent = new VerticalLayout();
    HorizontalLayout blockTop = new HorizontalLayout();
    blockTop.setSpacing(true);//ww  w  . j  a  v a2s  .  co  m
    Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getAvatarid(), 100);
    blockTop.addComponent(memberAvatar);

    VerticalLayout memberInfo = new VerticalLayout();

    HorizontalLayout layoutButtonDelete = new HorizontalLayout();
    layoutButtonDelete.setVisible(AppContext.canWrite(RolePermissionCollections.ACCOUNT_USER));
    layoutButtonDelete.setWidth("100%");

    Label emptylb = new Label("");
    layoutButtonDelete.addComponent(emptylb);
    layoutButtonDelete.setExpandRatio(emptylb, 1.0f);

    Button deleteBtn = new Button();
    deleteBtn.addClickListener(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()) {
                                UserService userService = ApplicationContextUtil
                                        .getSpringBean(UserService.class);
                                userService.pendingUserAccounts(Arrays.asList(member.getUsername()),
                                        AppContext.getAccountId());
                                EventBusFactory.getInstance()
                                        .post(new UserEvent.GotoList(UserListViewImpl.this, null));
                            }
                        }
                    });
        }
    });
    deleteBtn.setIcon(FontAwesome.TRASH_O);
    deleteBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY);
    layoutButtonDelete.addComponent(deleteBtn);

    memberInfo.addComponent(layoutButtonDelete);

    ButtonLink userAccountLink = new ButtonLink(member.getDisplayName());
    userAccountLink.addClickListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance()
                    .post(new UserEvent.GotoRead(UserListViewImpl.this, member.getUsername()));
        }
    });
    userAccountLink.setWidth("100%");
    userAccountLink.setHeight("100%");

    memberInfo.addComponent(userAccountLink);

    Label memberEmailLabel = new Label(
            "<a href='mailto:" + member.getUsername() + "'>" + member.getUsername() + "</a>", ContentMode.HTML);
    memberEmailLabel.addStyleName("member-email");
    memberEmailLabel.setWidth("100%");
    memberInfo.addComponent(memberEmailLabel);

    Label memberSinceLabel = new Label("Member since: " + AppContext.formatDate(member.getRegisteredtime()));
    memberSinceLabel.addStyleName("member-email");
    memberSinceLabel.setWidth("100%");
    memberInfo.addComponent(memberSinceLabel);

    if (RegisterStatusConstants.SENT_VERIFICATION_EMAIL.equals(member.getRegisterstatus())) {
        final VerticalLayout waitingNotLayout = new VerticalLayout();
        Label infoStatus = new Label("Waiting for accept invitation");
        infoStatus.addStyleName("member-email");
        waitingNotLayout.addComponent(infoStatus);

        ButtonLink resendInvitationLink = new ButtonLink("Resend Invitation", new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                UserService userService = ApplicationContextUtil.getSpringBean(UserService.class);
                userService.updateUserAccountStatus(member.getUsername(), member.getAccountId(),
                        RegisterStatusConstants.VERIFICATING);
                waitingNotLayout.removeAllComponents();
                Label statusEmail = new Label("Sending invitation email");
                statusEmail.addStyleName("member-email");
                waitingNotLayout.addComponent(statusEmail);
            }
        });
        resendInvitationLink.setStyleName("link");
        resendInvitationLink.addStyleName("member-email");
        waitingNotLayout.addComponent(resendInvitationLink);
        memberInfo.addComponent(waitingNotLayout);
    } else if (RegisterStatusConstants.ACTIVE.equals(member.getRegisterstatus())) {
        Label lastAccessTimeLbl = new Label("Logged in "
                + DateTimeUtils.getPrettyDateValue(member.getLastaccessedtime(), AppContext.getUserLocale()));
        lastAccessTimeLbl.addStyleName("member-email");
        memberInfo.addComponent(lastAccessTimeLbl);
    } else if (RegisterStatusConstants.VERIFICATING.equals(member.getRegisterstatus())) {
        Label infoStatus = new Label("Sending invitation email");
        infoStatus.addStyleName("member-email");
        memberInfo.addComponent(infoStatus);
    }

    blockTop.addComponent(memberInfo);
    blockTop.setExpandRatio(memberInfo, 1.0f);
    blockTop.setWidth("100%");
    blockContent.addComponent(blockTop);

    if (member.getRoleid() != null) {
        String memberRoleLinkPrefix = "<a href=\""
                + AccountLinkBuilder.generatePreviewFullRoleLink(member.getRoleid()) + "\"";
        Label memberRole = new Label();
        memberRole.setContentMode(ContentMode.HTML);
        if (member.getIsAccountOwner() != null && member.getIsAccountOwner()) {
            memberRole.setValue(memberRoleLinkPrefix + "style=\"color: #B00000;\">" + "Account Owner" + "</a>");
        } else {
            memberRole.setValue(memberRoleLinkPrefix + "style=\"color:gray;font-size:12px;\">"
                    + member.getRoleName() + "</a>");
        }
        memberRole.setSizeUndefined();
        blockContent.addComponent(memberRole);
        blockContent.setComponentAlignment(memberRole, Alignment.MIDDLE_RIGHT);
    } else if (member.getIsAccountOwner() != null && member.getIsAccountOwner() == Boolean.TRUE) {
        Label memberRole = new Label();
        memberRole.setContentMode(ContentMode.HTML);
        memberRole.setValue("<a style=\"color: #B00000;\">" + "Account Owner" + "</a>");
        memberRole.setSizeUndefined();
        blockContent.addComponent(memberRole);
        blockContent.setComponentAlignment(memberRole, Alignment.MIDDLE_RIGHT);
    } else {
        Label lbl = new Label();
        lbl.setHeight("10px");
        blockContent.addComponent(lbl);
    }
    blockContent.setWidth("100%");

    memberBlock.addComponent(blockContent);

    return memberBlock;
}

From source file:com.esofthead.mycollab.module.user.accountsettings.team.view.UserSearchPanel.java

License:Open Source License

private HorizontalLayout createSearchTopPanel() {
    final MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%").withSpacing(true)
            .withMargin(true);/*from  www .ja  v a 2 s . c  o  m*/

    final Label searchtitle = new Label("Users");
    searchtitle.setStyleName(Reindeer.LABEL_H2);
    layout.addComponent(searchtitle);
    layout.setComponentAlignment(searchtitle, Alignment.MIDDLE_LEFT);

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

        @Override
        public void buttonClick(final Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new UserEvent.GotoAdd(this, null));
        }
    });
    createBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    createBtn.setIcon(FontAwesome.PLUS);
    createBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.ACCOUNT_USER));

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

    return layout;
}

From source file:com.esofthead.mycollab.shell.view.components.AdRequestWindow.java

License:Open Source License

public AdRequestWindow(final SimpleUser user) {
    super("Need help!");
    this.setModal(true);
    this.setResizable(false);
    this.setWidth("600px");

    MVerticalLayout content = new MVerticalLayout();

    Label message = new Label("Hey <b>" + AppContext.getUser().getDisplayName() + "</b>, you've been "
            + "using MyCollab for a while now. And we hope you are happy with it. We spent countless hours and money developing this free "
            + "software for you. If you like it, please write a few words on twitter, blog or our "
            + "testimonial form. It will help other "
            + "people find this useful software quickly. <b> Thank you</b>", ContentMode.HTML);

    MVerticalLayout shareControls = new MVerticalLayout();
    Label rateSourceforge = new Label(
            new Div().appendChild(new Text(FontAwesome.THUMBS_O_UP.getHtml()), DivLessFormatter.EMPTY_SPACE(),
                    new A("http://sourceforge.net/projects/mycollab/reviews/new", "_blank")
                            .appendText("Rate us on Sourceforge"))
                    .setStyle("color:#006dac").write(),
            ContentMode.HTML);// www  .j  av  a2s . c o m

    Label tweetUs = new Label(new Div().appendChild(new Text(FontAwesome.TWITTER.getHtml()),
            DivLessFormatter.EMPTY_SPACE(),
            new A("https://twitter.com/intent/tweet?text=Im using MyCollab to manage all project activities, accounts and it works great @mycollabdotcom&source=webclient",
                    "_blank").appendText("Share on Twitter"))
            .setStyle("color:#006dac").write(), ContentMode.HTML);

    Label linkedIn = new Label(new Div().appendChild(new Text(FontAwesome.LINKEDIN_SQUARE.getHtml()),
            DivLessFormatter.EMPTY_SPACE(),
            new A("https://www.linkedin.com/cws/share?url=https%3A%2F%2Fwww.mycollab.com&original_referer=https%3A%2F%2Fwww.mycollab.com&token=&isFramed=false&lang=en_US",
                    "_blank").appendText("Share on LinkedIn"))
            .setStyle("color:#006dac").write(), ContentMode.HTML);

    Button testimonialBtn = new Button("Write a testimonial", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            AdRequestWindow.this.close();
            turnOffAdd(user);
            UI.getCurrent().addWindow(new TestimonialWindow());
        }
    });
    testimonialBtn.setStyleName(UIConstants.BUTTON_LINK);
    testimonialBtn.setIcon(FontAwesome.KEYBOARD_O);

    shareControls.with(rateSourceforge, tweetUs, linkedIn, testimonialBtn);

    MHorizontalLayout btnControls = new MHorizontalLayout();
    Button ignoreBtn = new Button("No, thanks", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            close();
            turnOffAdd(user);
        }
    });
    ignoreBtn.addStyleName(UIConstants.BUTTON_OPTION);

    Button loveBtn = new Button("I did", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            AdRequestWindow.this.close();
            NotificationUtil.showNotification("We appreciate your kindness action", "Thank you for your time");
            turnOffAdd(user);
        }
    });
    loveBtn.addStyleName(UIConstants.BUTTON_ACTION);
    loveBtn.setIcon(FontAwesome.HEART);

    btnControls.with(ignoreBtn, loveBtn);

    content.with(message, shareControls, btnControls).withAlign(btnControls, Alignment.MIDDLE_RIGHT);
    this.setContent(content);
}

From source file:com.esofthead.mycollab.shell.view.components.UpgradeConfirmWindow.java

License:Open Source License

public UpgradeConfirmWindow(final String version, String manualDownloadLink, final String installerFilePath) {
    super("A new update is ready to install");
    this.setModal(true);
    this.setResizable(false);
    this.center();
    this.setWidth("600px");
    this.installerFilePath = installerFilePath;

    currentUI = UI.getCurrent();// w w w . j  av a 2 s .com

    MVerticalLayout content = new MVerticalLayout();
    this.setContent(content);

    String headerTemplate = "MyCollab just got better . For the "
            + "enhancements and security purpose, you should upgrade to the latest version";
    Div titleDiv = new Div().appendText(String.format(headerTemplate, version)).setStyle("font-weight:bold");
    content.with(new Label(titleDiv.write(), ContentMode.HTML));

    Div manualInstallLink = new Div().appendText("&nbsp;&nbsp;&nbsp;&nbsp;Manual install: ")
            .appendChild(new A(manualDownloadLink, "_blank").appendText("Download link"));
    content.with(new Label(manualInstallLink.write(), ContentMode.HTML));

    Div manualUpgradeHowtoLink = new Div().appendText("&nbsp;&nbsp;&nbsp;&nbsp;Manual upgrade: ").appendChild(
            new A("https://community.mycollab.com/docs/hosting-mycollab-on-your-own-server/upgrade-mycollab-automatically/",
                    "_blank").appendText("Link"));
    content.with(new Label(manualUpgradeHowtoLink.write(), ContentMode.HTML));

    Div releaseNoteLink = new Div().appendText("&nbsp;&nbsp;&nbsp;&nbsp;Release Notes: ").appendChild(
            new A("https://community.mycollab.com/docs/hosting-mycollab-on-your-own-server/releases/", "_blank")
                    .appendText("Link"));
    content.with(new Label(releaseNoteLink.write(), ContentMode.HTML));

    MHorizontalLayout buttonControls = new MHorizontalLayout().withMargin(true);
    Button skipBtn = new Button(AppContext.getMessage(GenericI18Enum.ACTION_SKIP), new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            UpgradeConfirmWindow.this.close();
        }
    });
    skipBtn.addStyleName(UIConstants.BUTTON_OPTION);

    Button autoUpgradeBtn = new Button("Auto Upgrade", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            close();
            navigateToWaitingUpgradePage();
        }
    });
    if (installerFilePath == null) {
        autoUpgradeBtn.setEnabled(false);
    }
    autoUpgradeBtn.addStyleName(UIConstants.BUTTON_ACTION);
    buttonControls.with(skipBtn, autoUpgradeBtn);
    content.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT);
}

From source file:com.esofthead.mycollab.shell.view.MainViewImpl.java

License:Open Source License

private ComponentContainer createFooter() {
    MHorizontalLayout footer = new MHorizontalLayout().withFullWidth()
            .withMargin(new MarginInfo(false, true, false, true));
    footer.setStyleName("footer");
    footer.setHeight("30px");

    Div companyInfoDiv = new Div().appendText("Powered by ")
            .appendChild(new A("https://www.mycollab.com", "_blank").appendText("MyCollab"))
            .appendText(" &copy; " + new LocalDate().getYear());
    ELabel companyInfoLbl = new ELabel(companyInfoDiv.write(), ContentMode.HTML).withWidth("-1px");
    footer.with(companyInfoLbl).withAlign(companyInfoLbl, Alignment.MIDDLE_LEFT);

    Div socialLinksDiv = new Div().appendText(FontAwesome.RSS.getHtml())
            .appendChild(new A("https://www.mycollab.com/blog", "_blank").appendText(" Blog"))
            .appendText("  " + FontAwesome.REPLY_ALL.getHtml())
            .appendChild(new A("http://support.mycollab.com", "_blank").appendText(" Support"));

    if (SiteConfiguration.isCommunityEdition()) {
        socialLinksDiv.appendText("  " + FontAwesome.THUMBS_O_UP.getHtml())
                .appendChild(new A("http://sourceforge.net/projects/mycollab/reviews/new", "_blank")
                        .appendText("" + " Rate us"));
    }/*w w  w .j  av a 2 s .com*/

    socialLinksDiv.appendText("  " + FontAwesome.FACEBOOK.getHtml())
            .appendChild(new A("https://www.facebook.com/mycollab2", "_blank").appendText(" FB page"));
    socialLinksDiv.appendText("  " + FontAwesome.TWITTER.getHtml())
            .appendChild(new A(
                    "https://twitter.com/intent/tweet?text=I am using MyCollab to manage all project "
                            + "activities, accounts and it works great @mycollabdotcom &source=webclient",
                    "_blank").appendText(" Tweet"));

    ELabel socialsLbl = new ELabel(socialLinksDiv.write(), ContentMode.HTML).withWidth("-1px");
    footer.with(socialsLbl).withAlign(socialsLbl, Alignment.MIDDLE_RIGHT);
    return footer;
}

From source file:com.esofthead.mycollab.shell.view.UpgradeConfirmWindow.java

License:Open Source License

public UpgradeConfirmWindow(Properties props) {
    super("There is the new MyCollab update");
    this.props = props;
    this.setModal(true);
    this.setResizable(false);
    this.center();
    this.setWidth("600px");

    MVerticalLayout content = new MVerticalLayout();
    this.setContent(content);

    Div titleDiv = new Div().appendText(String.format(headerTemplate, props.getProperty("version")))
            .setStyle("font-weight:bold");
    content.with(new Label(titleDiv.write(), ContentMode.HTML));

    Div manualInstallLink = new Div().appendText("&nbsp;&nbsp;&nbsp;&nbsp;Manual install: ")
            .appendChild(new A(props.getProperty("downloadLink"), "_blank").appendText("Download link"));
    content.with(new Label(manualInstallLink.write(), ContentMode.HTML));

    Div releaseNoteLink = new Div().appendText("&nbsp;&nbsp;&nbsp;&nbsp;Release Notes: ")
            .appendChild(new A(props.getProperty("releaseNotes"), "_blank").appendText("Link"));
    content.with(new Label(releaseNoteLink.write(), ContentMode.HTML));

    MHorizontalLayout buttonControls = new MHorizontalLayout().withMargin(true);
    Button skipBtn = new Button("Skip", new Button.ClickListener() {
        @Override//from  w w w .ja va  2  s . co m
        public void buttonClick(Button.ClickEvent clickEvent) {
            UpgradeConfirmWindow.this.close();
        }
    });
    skipBtn.addStyleName(UIConstants.THEME_GRAY_LINK);

    Button autoUpgradeBtn = new Button("Auto Upgrade", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            UI.getCurrent().setPollInterval(1000);
            new Thread(new AutoUpgradeProcess()).start();
            UpgradeConfirmWindow.this.close();
        }
    });
    autoUpgradeBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    buttonControls.with(skipBtn, autoUpgradeBtn);
    content.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT);
}

From source file:com.esofthead.mycollab.vaadin.ui.AbstractBeanBlockList.java

License:Open Source License

protected CssLayout createPageControls() {
    this.controlBarWrapper = new CssLayout();
    this.controlBarWrapper.setWidth("100%");

    final HorizontalLayout controlBar = new HorizontalLayout();
    controlBar.setWidth("100%");
    this.controlBarWrapper.addComponent(controlBar);

    this.pageManagement = new HorizontalLayout();

    // defined layout here ---------------------------

    if (this.currentPage > 1) {
        final Button firstLink = new ButtonLink("1", new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override/*from   ww  w.ja v a  2s  . c  o m*/
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(1);
            }
        }, false);
        firstLink.addStyleName("buttonPaging");
        this.pageManagement.addComponent(firstLink);
    }
    if (this.currentPage >= 5) {
        final Label ss1 = new Label("...");
        ss1.addStyleName("buttonPaging");
        this.pageManagement.addComponent(ss1);
    }
    if (this.currentPage > 3) {
        final Button previous2 = new ButtonLink("" + (this.currentPage - 2), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(AbstractBeanBlockList.this.currentPage - 2);
            }
        }, false);
        previous2.addStyleName("buttonPaging");
        this.pageManagement.addComponent(previous2);
    }
    if (this.currentPage > 2) {
        final Button previous1 = new ButtonLink("" + (this.currentPage - 1), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(AbstractBeanBlockList.this.currentPage - 1);
            }
        }, false);
        previous1.addStyleName("buttonPaging");
        this.pageManagement.addComponent(previous1);
    }
    // Here add current ButtonLink
    final Button current = new ButtonLink("" + this.currentPage, new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            AbstractBeanBlockList.this.pageChange(AbstractBeanBlockList.this.currentPage);
        }
    }, false);
    current.addStyleName("buttonPaging");
    current.addStyleName("buttonPagingcurrent");

    this.pageManagement.addComponent(current);
    final int range = this.totalPage - this.currentPage;
    if (range >= 1) {
        final Button next1 = new ButtonLink("" + (this.currentPage + 1), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(AbstractBeanBlockList.this.currentPage + 1);
            }
        }, false);
        next1.addStyleName("buttonPaging");
        this.pageManagement.addComponent(next1);
    }
    if (range >= 2) {
        final Button next2 = new ButtonLink("" + (this.currentPage + 2), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(AbstractBeanBlockList.this.currentPage + 2);
            }
        }, false);
        next2.addStyleName("buttonPaging");
        this.pageManagement.addComponent(next2);
    }
    if (range >= 4) {
        final Label ss2 = new Label("...");
        ss2.addStyleName("buttonPaging");
        this.pageManagement.addComponent(ss2);
    }
    if (range >= 3) {
        final Button last = new ButtonLink("" + this.totalPage, new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(AbstractBeanBlockList.this.totalPage);
            }
        }, false);
        last.addStyleName("buttonPaging");
        this.pageManagement.addComponent(last);
    }

    this.pageManagement.setWidth(null);
    this.pageManagement.setSpacing(true);
    controlBar.addComponent(this.pageManagement);
    controlBar.setComponentAlignment(this.pageManagement, Alignment.MIDDLE_RIGHT);

    return this.controlBarWrapper;
}