Example usage for com.vaadin.ui Button addStyleName

List of usage examples for com.vaadin.ui Button addStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui Button addStyleName.

Prototype

@Override
    public void addStyleName(String style) 

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);//  w w w  .jav  a  2s  .  c  o  m
    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.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);/*from  w w w .j  a v a2s .com*/
    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.UserTableDisplay.java

License:Open Source License

public UserTableDisplay(TableViewField requiredColumn, List<TableViewField> displayColumns) {
    super(ApplicationContextUtil.getSpringBean(UserService.class), SimpleUser.class, requiredColumn,
            displayColumns);/*from ww w  .j  a  va  2  s. com*/

    this.addGeneratedColumn("selected", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public Object generateCell(final Table source, final Object itemId, Object columnId) {
            final SimpleUser user = UserTableDisplay.this.getBeanByIndex(itemId);
            final CheckBoxDecor cb = new CheckBoxDecor("", user.isSelected());
            cb.setImmediate(true);
            cb.addValueChangeListener(new Property.ValueChangeListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void valueChange(ValueChangeEvent event) {
                    UserTableDisplay.this.fireSelectItemEvent(user);
                }
            });

            user.setExtraData(cb);
            return cb;
        }
    });

    this.addGeneratedColumn("username", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleUser user = UserTableDisplay.this.getBeanByIndex(itemId);
            UserLink b = new UserLink(user.getUsername(), user.getAvatarid(), user.getDisplayName(), false);

            b.addClickListener(new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    fireTableEvent(new TableClickEvent(UserTableDisplay.this, user.getUsername(), "username"));
                }
            });

            if (RegisterStatusConstants.ACTIVE.equals(user.getRegisterstatus())) {
                return b;
            } else {
                HorizontalLayout layout = new HorizontalLayout();
                layout.setWidth("100%");
                layout.setSpacing(true);

                if (RegisterStatusConstants.DELETE.equals(user.getRegisterstatus())) {
                    layout.addComponent(b);
                    Label statusLbl = new Label("(Removed)");
                    layout.addComponent(statusLbl);
                    layout.addComponent(statusLbl);
                } else {
                    HorizontalLayout userLayout = new HorizontalLayout();
                    userLayout.addComponent(b);
                    userLayout.setWidth("100%");

                    Label statusLbl = new Label("(Waiting for accept)");
                    userLayout.addComponent(statusLbl);
                    userLayout.setExpandRatio(statusLbl, 1.0f);

                    layout.addComponent(userLayout);
                    layout.setExpandRatio(userLayout, 1.0f);

                    Button resendBtn = new Button("Resend invitation", new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(ClickEvent event) {
                            UserAccountInvitationMapper userAccountInvitationMapper = ApplicationContextUtil
                                    .getSpringBean(UserAccountInvitationMapper.class);
                            UserAccountInvitation invitation = new UserAccountInvitation();
                            invitation.setAccountid(user.getAccountId());
                            invitation.setCreatedtime(new GregorianCalendar().getTime());
                            invitation.setUsername(user.getUsername());
                            invitation.setInvitationstatus(
                                    (user.getRegisterstatus() == null) ? RegisterStatusConstants.VERIFICATING
                                            : user.getRegisterstatus());
                            userAccountInvitationMapper.insert(invitation);

                        }
                    });
                    resendBtn.addStyleName("link");
                    layout.addComponent(resendBtn);
                }
                return layout;
            }
        }
    });

    this.addGeneratedColumn("email", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, Object itemId, Object columnId) {
            SimpleUser user = UserTableDisplay.this.getBeanByIndex(itemId);
            return new EmailLink(user.getEmail());
        }
    });

    this.addGeneratedColumn("lastaccessedtime", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleUser user = UserTableDisplay.this.getBeanByIndex(itemId);
            Label dateLbl = new Label(
                    DateTimeUtils.getPrettyDateValue(user.getLastaccessedtime(), AppContext.getUserLocale()));
            return dateLbl;
        }
    });
}

From source file:com.esofthead.mycollab.reporting.CustomizeReportOutputWindow.java

License:Open Source License

public CustomizeReportOutputWindow(final String viewId, final String reportTitle, final Class<B> beanCls,
        final ISearchableService<S> searchableService, final VariableInjector<S> variableInjector) {
    super("Export");
    this.setModal(true);
    this.setWidth("1000px");
    this.setResizable(false);
    this.center();
    this.viewId = viewId;
    this.variableInjector = variableInjector;

    MVerticalLayout contentLayout = new MVerticalLayout();
    setContent(contentLayout);/*from ww w.java2  s .  c  om*/

    final OptionGroup optionGroup = new OptionGroup();
    optionGroup.addStyleName("sortDirection");
    optionGroup.addItems(AppContext.getMessage(FileI18nEnum.CSV), AppContext.getMessage(FileI18nEnum.PDF),
            AppContext.getMessage(FileI18nEnum.EXCEL));
    optionGroup.setValue(AppContext.getMessage(FileI18nEnum.CSV));
    contentLayout.with(
            new MHorizontalLayout(ELabel.h3(AppContext.getMessage(GenericI18Enum.ACTION_EXPORT)), optionGroup)
                    .alignAll(Alignment.MIDDLE_LEFT));

    contentLayout.with(ELabel.h3(AppContext.getMessage(GenericI18Enum.ACTION_SELECT_COLUMNS)));
    listBuilder = new ListBuilder();
    listBuilder.setImmediate(true);
    listBuilder.setColumns(0);
    listBuilder.setLeftColumnCaption(AppContext.getMessage(GenericI18Enum.OPT_AVAILABLE_COLUMNS));
    listBuilder.setRightColumnCaption(AppContext.getMessage(GenericI18Enum.OPT_VIEW_COLUMNS));
    listBuilder.setWidth(100, Sizeable.Unit.PERCENTAGE);
    listBuilder.setItemCaptionMode(AbstractSelect.ItemCaptionMode.EXPLICIT);
    final BeanItemContainer<TableViewField> container = new BeanItemContainer<>(TableViewField.class,
            this.getAvailableColumns());
    listBuilder.setContainerDataSource(container);
    Iterator<TableViewField> iterator = getAvailableColumns().iterator();
    while (iterator.hasNext()) {
        TableViewField field = iterator.next();
        listBuilder.setItemCaption(field, AppContext.getMessage(field.getDescKey()));
    }
    final Collection<TableViewField> viewColumnIds = this.getViewColumns();
    listBuilder.setValue(viewColumnIds);
    contentLayout.with(listBuilder).withAlign(listBuilder, Alignment.TOP_CENTER);

    contentLayout.with(ELabel.h3(AppContext.getMessage(GenericI18Enum.ACTION_PREVIEW)));
    sampleTableDisplay = new Table();
    for (TableViewField field : getAvailableColumns()) {
        sampleTableDisplay.addContainerProperty(field.getField(), String.class, "",
                AppContext.getMessage(field.getDescKey()), null, Table.Align.LEFT);
        sampleTableDisplay.setColumnWidth(field.getField(), field.getDefaultWidth());
    }
    sampleTableDisplay.setWidth("100%");
    sampleTableDisplay.addItem(buildSampleData(), 1);
    sampleTableDisplay.setPageLength(1);
    contentLayout.with(sampleTableDisplay);
    filterColumns();

    listBuilder.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
            filterColumns();
        }
    });

    Button resetBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_RESET),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent clickEvent) {
                    listBuilder.setValue(getDefaultColumns());
                    filterColumns();
                }
            });
    resetBtn.addStyleName(UIConstants.BUTTON_LINK);

    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent clickEvent) {
                    close();
                }
            });
    cancelBtn.addStyleName(UIConstants.BUTTON_OPTION);

    final Button exportBtn = new Button(AppContext.getMessage(GenericI18Enum.ACTION_EXPORT));
    exportBtn.addStyleName(UIConstants.BUTTON_ACTION);
    OnDemandFileDownloader pdfFileDownloader = new OnDemandFileDownloader(new LazyStreamSource() {
        @Override
        protected StreamResource.StreamSource buildStreamSource() {
            return new StreamResource.StreamSource() {
                @Override
                public InputStream getStream() {
                    Collection<TableViewField> columns = (Collection<TableViewField>) listBuilder.getValue();
                    // Save custom table view def
                    CustomViewStoreService customViewStoreService = AppContextUtil
                            .getSpringBean(CustomViewStoreService.class);
                    CustomViewStore viewDef = new CustomViewStore();
                    viewDef.setSaccountid(AppContext.getAccountId());
                    viewDef.setCreateduser(AppContext.getUsername());
                    viewDef.setViewid(viewId);
                    viewDef.setViewinfo(FieldDefAnalyzer.toJson(new ArrayList<>(columns)));
                    customViewStoreService.saveOrUpdateViewLayoutDef(viewDef);

                    SimpleReportTemplateExecutor reportTemplateExecutor = new SimpleReportTemplateExecutor.AllItems<>(
                            reportTitle, new RpFieldsBuilder(columns), exportType, beanCls, searchableService);
                    ReportStreamSource streamSource = new ReportStreamSource(reportTemplateExecutor) {
                        @Override
                        protected void initReportParameters(Map<String, Object> parameters) {
                            parameters.put(SimpleReportTemplateExecutor.CRITERIA, variableInjector.eval());
                        }
                    };
                    return streamSource.getStream();
                }
            };
        }

        @Override
        public String getFilename() {
            String exportTypeVal = (String) optionGroup.getValue();
            if (AppContext.getMessage(FileI18nEnum.CSV).equals(exportTypeVal)) {
                exportType = ReportExportType.CSV;
            } else if (AppContext.getMessage(FileI18nEnum.EXCEL).equals(exportTypeVal)) {
                exportType = ReportExportType.EXCEL;
            } else {
                exportType = ReportExportType.PDF;
            }
            return exportType.getDefaultFileName();
        }
    });
    pdfFileDownloader.extend(exportBtn);

    MHorizontalLayout buttonControls = new MHorizontalLayout(resetBtn, cancelBtn, exportBtn);
    contentLayout.with(buttonControls).withAlign(buttonControls, Alignment.TOP_RIGHT);
}

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);/* w  ww . ja v  a 2  s.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.NoSubDomainExistedWindow.java

License:Open Source License

public NoSubDomainExistedWindow(final String domain) {
    this.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    final Label titleIcon = new ELabel(FontAwesome.EXCLAMATION_CIRCLE.getHtml(), ContentMode.HTML)
            .withWidthUndefined();/*from   ww  w.jav a2 s  .  com*/
    titleIcon.setStyleName("warning-icon");
    titleIcon.addStyleName(ValoTheme.LABEL_NO_MARGIN);

    Label warningMsg = new ELabel(AppContext.getMessage(ShellI18nEnum.ERROR_NO_SUB_DOMAIN, domain))
            .withWidthUndefined();

    Button backToHome = new Button(AppContext.getMessage(ShellI18nEnum.BUTTON_BACK_TO_HOME_PAGE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    getUI().getPage().setLocation("https://www.mycollab.com");
                }
            });
    backToHome.addStyleName(UIConstants.BUTTON_ACTION);
    this.with(titleIcon, warningMsg, backToHome);
}

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();/*from w  w  w.j  ava 2s . co  m*/

    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 MHorizontalLayout buildAccountMenuLayout() {
    accountLayout.removeAllComponents();

    if (SiteConfiguration.isDemandEdition()) {
        // display trial box if user in trial mode
        SimpleBillingAccount billingAccount = AppContext.getBillingAccount();
        if (AccountStatusConstants.TRIAL.equals(billingAccount.getStatus())) {
            if ("Free".equals(billingAccount.getBillingPlan().getBillingtype())) {
                Label informLbl = new Label(
                        "<div class='informBlock'>FREE CHARGE<br>UPGRADE</div><div class='informBlock'>&gt;&gt;</div>",
                        ContentMode.HTML);
                informLbl.addStyleName("trialEndingNotification");
                informLbl.setHeight("100%");
                HorizontalLayout informBox = new HorizontalLayout();
                informBox.addStyleName("trialInformBox");
                informBox.setSizeFull();
                informBox.addComponent(informLbl);
                informBox.setMargin(new MarginInfo(false, true, false, false));
                informBox.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override/*from w  w w.  j  av a 2s.  co m*/
                    public void layoutClick(LayoutClickEvent event) {
                        EventBusFactory.getInstance()
                                .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" }));
                    }
                });
                accountLayout.with(informBox).withAlign(informBox, Alignment.MIDDLE_LEFT);
            } else {
                Label informLbl = new Label("", ContentMode.HTML);
                informLbl.addStyleName("trialEndingNotification");
                informLbl.setHeight("100%");
                HorizontalLayout informBox = new HorizontalLayout();
                informBox.addStyleName("trialInformBox");
                informBox.setSizeFull();
                informBox.setMargin(new MarginInfo(false, true, false, false));
                informBox.addComponent(informLbl);
                informBox.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void layoutClick(LayoutClickEvent event) {
                        EventBusFactory.getInstance()
                                .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" }));
                    }
                });
                accountLayout.with(informBox).withAlign(informBox, Alignment.MIDDLE_LEFT);

                Duration dur = new Duration(new DateTime(billingAccount.getCreatedtime()), new DateTime());
                int daysLeft = dur.toStandardDays().getDays();
                if (daysLeft > 30) {
                    informLbl.setValue(
                            "<div class='informBlock'>Trial<br></div><div class='informBlock'>&gt;&gt;</div>");
                    //                        AppContext.getInstance().setIsValidAccount(false);
                } else {
                    informLbl.setValue(String.format("<div class='informBlock'>Trial ending<br>%d days "
                            + "left</div><div class='informBlock'>&gt;&gt;</div>", 30 - daysLeft));
                }
            }
        }
    }

    Label accountNameLabel = new Label(AppContext.getSubDomain());
    accountNameLabel.addStyleName("subdomain");
    accountLayout.addComponent(accountNameLabel);

    if (SiteConfiguration.isCommunityEdition()) {
        Button buyPremiumBtn = new Button("Upgrade to Pro edition", new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                UI.getCurrent().addWindow(new AdWindow());
            }
        });
        buyPremiumBtn.setIcon(FontAwesome.SHOPPING_CART);
        buyPremiumBtn.addStyleName("ad");
        accountLayout.addComponent(buyPremiumBtn);
    }

    LicenseResolver licenseResolver = AppContextUtil.getSpringBean(LicenseResolver.class);
    if (licenseResolver != null) {
        LicenseInfo licenseInfo = licenseResolver.getLicenseInfo();
        if (licenseInfo != null) {
            if (licenseInfo.isExpired()) {
                Button buyPremiumBtn = new Button(AppContext.getMessage(LicenseI18nEnum.EXPIRE_NOTIFICATION),
                        new ClickListener() {
                            @Override
                            public void buttonClick(ClickEvent event) {
                                UI.getCurrent().addWindow(new BuyPremiumSoftwareWindow());
                            }
                        });
                buyPremiumBtn.setIcon(FontAwesome.SHOPPING_CART);
                buyPremiumBtn.addStyleName("ad");
                accountLayout.addComponent(buyPremiumBtn);
            } else if (licenseInfo.isTrial()) {
                Duration dur = new Duration(new DateTime(), new DateTime(licenseInfo.getExpireDate()));
                int days = dur.toStandardDays().getDays();
                Button buyPremiumBtn = new Button(
                        AppContext.getMessage(LicenseI18nEnum.TRIAL_NOTIFICATION, days), new ClickListener() {
                            @Override
                            public void buttonClick(ClickEvent event) {
                                UI.getCurrent().addWindow(new BuyPremiumSoftwareWindow());
                            }
                        });
                buyPremiumBtn.setIcon(FontAwesome.SHOPPING_CART);
                buyPremiumBtn.addStyleName("ad");
                accountLayout.addComponent(buyPremiumBtn);
            }
        }
    }

    NotificationComponent notificationComponent = new NotificationComponent();
    accountLayout.addComponent(notificationComponent);

    if (StringUtils.isBlank(AppContext.getUser().getAvatarid())) {
        EventBusFactory.getInstance()
                .post(new ShellEvent.NewNotification(this, new RequestUploadAvatarNotification()));
    }

    if (!SiteConfiguration.isDemandEdition()) {
        ExtMailService mailService = AppContextUtil.getSpringBean(ExtMailService.class);
        if (!mailService.isMailSetupValid()) {
            EventBusFactory.getInstance()
                    .post(new ShellEvent.NewNotification(this, new SmtpSetupNotification()));
        }

        SimpleUser user = AppContext.getUser();
        GregorianCalendar tenDaysAgo = new GregorianCalendar();
        tenDaysAgo.add(Calendar.DATE, -10);

        if (Boolean.TRUE.equals(user.getRequestad()) && user.getRegisteredtime().before(tenDaysAgo.getTime())) {
            UI.getCurrent().addWindow(new AdRequestWindow(user));
        }
    }

    Resource userAvatarRes = UserAvatarControlFactory.createAvatarResource(AppContext.getUserAvatarId(), 24);
    final PopupButton accountMenu = new PopupButton("");
    accountMenu.setIcon(userAvatarRes);
    accountMenu.setDescription(AppContext.getUserDisplayName());

    OptionPopupContent accountPopupContent = new OptionPopupContent();

    Button myProfileBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_PROFILE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    accountMenu.setPopupVisible(false);
                    EventBusFactory.getInstance()
                            .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "preview" }));
                }
            });
    myProfileBtn.setIcon(SettingAssetsManager.getAsset(SettingUIConstants.PROFILE));
    accountPopupContent.addOption(myProfileBtn);

    Button userMgtBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_USERS_AND_ROLES),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    accountMenu.setPopupVisible(false);
                    EventBusFactory.getInstance()
                            .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "user", "list" }));
                }
            });
    userMgtBtn.setIcon(SettingAssetsManager.getAsset(SettingUIConstants.USERS));
    accountPopupContent.addOption(userMgtBtn);

    Button generalSettingBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_SETTING),
            new ClickListener() {
                @Override
                public void buttonClick(ClickEvent clickEvent) {
                    accountMenu.setPopupVisible(false);
                    EventBusFactory.getInstance().post(
                            new ShellEvent.GotoUserAccountModule(this, new String[] { "setting", "general" }));
                }
            });
    generalSettingBtn.setIcon(SettingAssetsManager.getAsset(SettingUIConstants.GENERAL_SETTING));
    accountPopupContent.addOption(generalSettingBtn);

    Button themeCustomizeBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_THEME), new ClickListener() {
        @Override
        public void buttonClick(ClickEvent clickEvent) {
            accountMenu.setPopupVisible(false);
            EventBusFactory.getInstance()
                    .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setting", "theme" }));
        }
    });
    themeCustomizeBtn.setIcon(SettingAssetsManager.getAsset(SettingUIConstants.THEME_CUSTOMIZE));
    accountPopupContent.addOption(themeCustomizeBtn);

    if (!SiteConfiguration.isDemandEdition()) {
        Button setupBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_SETUP), new ClickListener() {
            @Override
            public void buttonClick(ClickEvent clickEvent) {
                accountMenu.setPopupVisible(false);
                EventBusFactory.getInstance()
                        .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setup" }));
            }
        });
        setupBtn.setIcon(FontAwesome.WRENCH);
        accountPopupContent.addOption(setupBtn);
    }

    accountPopupContent.addSeparator();

    Button helpBtn = new Button(AppContext.getMessage(GenericI18Enum.ACTION_HELP));
    helpBtn.setIcon(FontAwesome.MORTAR_BOARD);
    ExternalResource helpRes = new ExternalResource("https://community.mycollab.com/meet-mycollab/");
    BrowserWindowOpener helpOpener = new BrowserWindowOpener(helpRes);
    helpOpener.extend(helpBtn);
    accountPopupContent.addOption(helpBtn);

    Button supportBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SUPPORT));
    supportBtn.setIcon(FontAwesome.LIFE_SAVER);
    ExternalResource supportRes = new ExternalResource("http://support.mycollab.com/");
    BrowserWindowOpener supportOpener = new BrowserWindowOpener(supportRes);
    supportOpener.extend(supportBtn);
    accountPopupContent.addOption(supportBtn);

    Button translateBtn = new Button(AppContext.getMessage(GenericI18Enum.ACTION_TRANSLATE));
    translateBtn.setIcon(FontAwesome.PENCIL);
    ExternalResource translateRes = new ExternalResource(
            "https://community.mycollab.com/docs/developing-mycollab/translating/");
    BrowserWindowOpener translateOpener = new BrowserWindowOpener(translateRes);
    translateOpener.extend(translateBtn);
    accountPopupContent.addOption(translateBtn);

    if (!SiteConfiguration.isCommunityEdition()) {
        Button myAccountBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_BILLING),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        accountMenu.setPopupVisible(false);
                        EventBusFactory.getInstance()
                                .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" }));
                    }
                });
        myAccountBtn.setIcon(SettingAssetsManager.getAsset(SettingUIConstants.BILLING));
        accountPopupContent.addOption(myAccountBtn);
    }

    accountPopupContent.addSeparator();
    Button aboutBtn = new Button("About MyCollab", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent clickEvent) {
            accountMenu.setPopupVisible(false);
            Window aboutWindow = ViewManager.getCacheComponent(AbstractAboutWindow.class);
            UI.getCurrent().addWindow(aboutWindow);
        }
    });
    aboutBtn.setIcon(FontAwesome.INFO_CIRCLE);
    accountPopupContent.addOption(aboutBtn);

    Button releaseNotesBtn = new Button("Release Notes");
    ExternalResource releaseNotesRes = new ExternalResource(
            "https://community.mycollab.com/docs/hosting-mycollab-on-your-own-server/releases/");
    BrowserWindowOpener releaseNotesOpener = new BrowserWindowOpener(releaseNotesRes);
    releaseNotesOpener.extend(releaseNotesBtn);

    releaseNotesBtn.setIcon(FontAwesome.BULLHORN);
    accountPopupContent.addOption(releaseNotesBtn);

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

                @Override
                public void buttonClick(ClickEvent event) {
                    accountMenu.setPopupVisible(false);
                    EventBusFactory.getInstance().post(new ShellEvent.LogOut(this, null));
                }
            });
    signoutBtn.setIcon(FontAwesome.SIGN_OUT);
    accountPopupContent.addSeparator();
    accountPopupContent.addOption(signoutBtn);

    accountMenu.setContent(accountPopupContent);
    accountLayout.addComponent(accountMenu);
    return accountLayout;
}

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

License:Open Source License

public SetupNewInstanceView() {
    this.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    MVerticalLayout content = new MVerticalLayout().withWidth("600px");
    this.with(content);
    content.with(ELabel.h2("Last step, you are almost there!").withWidthUndefined());
    content.with(ELabel.h3("All fields are required *").withStyleName("overdue").withWidthUndefined());
    content.with(/*ww w.j av a  2  s  . c o m*/
            new ELabel(AppContext.getMessage(ShellI18nEnum.OPT_SUPPORTED_LANGUAGES_INTRO), ContentMode.HTML)
                    .withStyleName(UIConstants.META_COLOR));
    GridFormLayoutHelper formLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(2, 8, "200px");
    formLayoutHelper.getLayout().setWidth("600px");
    final TextField adminField = formLayoutHelper.addComponent(new TextField(), "Admin email", 0, 0);
    final PasswordField passwordField = formLayoutHelper.addComponent(new PasswordField(), "Admin password", 0,
            1);
    final PasswordField retypePasswordField = formLayoutHelper.addComponent(new PasswordField(),
            "Retype Admin password", 0, 2);
    final DateFormatField dateFormatField = formLayoutHelper.addComponent(
            new DateFormatField(SimpleBillingAccount.DEFAULT_DATE_FORMAT),
            AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_YYMMDD_FORMAT),
            AppContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 0, 3);

    final DateFormatField shortDateFormatField = formLayoutHelper.addComponent(
            new DateFormatField(SimpleBillingAccount.DEFAULT_SHORT_DATE_FORMAT),
            AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_MMDD_FORMAT),
            AppContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 0, 4);

    final DateFormatField longDateFormatField = formLayoutHelper.addComponent(
            new DateFormatField(SimpleBillingAccount.DEFAULT_LONG_DATE_FORMAT),
            AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_HUMAN_DATE_FORMAT),
            AppContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 0, 5);

    final TimeZoneSelectionField timeZoneSelectionField = formLayoutHelper.addComponent(
            new TimeZoneSelectionField(false), AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_TIMEZONE), 0,
            6);
    timeZoneSelectionField.setValue(TimeZone.getDefault().getID());
    final LanguageSelectionField languageBox = formLayoutHelper.addComponent(new LanguageSelectionField(),
            AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_LANGUAGE), 0, 7);
    languageBox.setValue(Locale.US.toLanguageTag());
    content.with(formLayoutHelper.getLayout());

    Button installBtn = new Button("Setup", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            String adminName = adminField.getValue();
            String password = passwordField.getValue();
            String retypePassword = retypePasswordField.getValue();
            if (!StringUtils.isValidEmail(adminName)) {
                NotificationUtil.showErrorNotification("Invalid email value");
                return;
            }

            if (!password.equals(retypePassword)) {
                NotificationUtil.showErrorNotification("Password is not match");
                return;
            }

            String dateFormat = dateFormatField.getValue();
            String shortDateFormat = shortDateFormatField.getValue();
            String longDateFormat = longDateFormatField.getValue();
            if (!isValidDayPattern(dateFormat) || !isValidDayPattern(shortDateFormat)
                    || !isValidDayPattern(longDateFormat)) {
                NotificationUtil.showErrorNotification("Invalid date format");
                return;
            }
            String language = languageBox.getValue();
            String timezoneDbId = timeZoneSelectionField.getValue();
            BillingAccountMapper billingAccountMapper = AppContextUtil
                    .getSpringBean(BillingAccountMapper.class);
            BillingAccountExample ex = new BillingAccountExample();
            ex.createCriteria().andIdEqualTo(AppContext.getAccountId());
            List<BillingAccount> billingAccounts = billingAccountMapper.selectByExample(ex);
            BillingAccount billingAccount = billingAccounts.get(0);
            billingAccount.setDefaultlanguagetag(language);
            billingAccount.setDefaultyymmddformat(dateFormat);
            billingAccount.setDefaultmmddformat(shortDateFormat);
            billingAccount.setDefaulthumandateformat(longDateFormat);
            billingAccount.setDefaulttimezone(timezoneDbId);
            billingAccountMapper.updateByPrimaryKey(billingAccount);

            BillingAccountService billingAccountService = AppContextUtil
                    .getSpringBean(BillingAccountService.class);

            billingAccountService.createDefaultAccountData(adminName, password, timezoneDbId, language, true,
                    true, AppContext.getAccountId());
            ((DesktopApplication) UI.getCurrent()).doLogin(adminName, password, false);

        }
    });
    installBtn.addStyleName(UIConstants.BUTTON_ACTION);
    content.with(installBtn).withAlign(installBtn, Alignment.TOP_RIGHT);
}

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.j a v  a2 s.c  o 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);
}