Java Code Examples for org.vaadin.viritin.button.MButton#setEnabled()

The following examples show how to use org.vaadin.viritin.button.MButton#setEnabled() . 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: ProjectActivityStreamPagedList.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected MHorizontalLayout createPageControls() {
    controlBarWrapper = new MHorizontalLayout().withFullHeight().withStyleName("page-controls");

    MButton prevBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_NAV_NEWER), clickEvent -> pageChange(currentPage - 1))
            .withWidth("64px").withStyleName(WebThemes.BUTTON_ACTION);
    if (currentPage == 1) {
        prevBtn.setEnabled(false);
    }

    MButton nextBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_NAV_OLDER), clickEvent -> pageChange(currentPage + 1))
            .withWidth("64px").withStyleName(WebThemes.BUTTON_ACTION);
    if (currentPage == totalPage) {
        nextBtn.setEnabled(false);
    }

    ButtonGroup controlBtns = new ButtonGroup(prevBtn, nextBtn);
    controlBtns.setStyleName(WebThemes.BUTTON_ACTION);

    controlBarWrapper.addComponent(controlBtns);
    return controlBarWrapper;
}
 
Example 2
Source File: UpgradeConfirmWindow.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
public UpgradeConfirmWindow(final String version, String manualDownloadLink, final String installerFilePath) {
    super(UserUIContext.getMessage(ShellI18nEnum.OPT_NEW_UPGRADE_IS_READY));
    this.withModal(true).withResizable(false).withCenter().withWidth("600px");
    this.installerFilePath = installerFilePath;

    currentUI = UI.getCurrent();

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

    Div titleDiv = new Div().appendText(UserUIContext.getMessage(ShellI18nEnum.OPT_REQUEST_UPGRADE, version)).setStyle("font-weight:bold");
    content.with(ELabel.html(titleDiv.write()));

    Div manualInstallLink = new Div().appendText("    " + UserUIContext.getMessage(ShellI18nEnum.OPT_MANUAL_INSTALL) + ": ")
            .appendChild(new A(manualDownloadLink, "_blank")
                    .appendText(UserUIContext.getMessage(ShellI18nEnum.OPT_DOWNLOAD_LINK)));
    content.with(ELabel.html(manualInstallLink.write()));

    Div manualUpgradeHowtoLink = new Div().appendText("    " + UserUIContext.getMessage(ShellI18nEnum.OPT_MANUAL_UPGRADE) + ": ")
            .appendChild(new A("https://docs.mycollab.com/administration/upgrade-mycollab-automatically/", "_blank").appendText("Link"));
    content.with(ELabel.html(manualUpgradeHowtoLink.write()));

    Div releaseNoteLink = new Div().appendText("    " + UserUIContext.getMessage(ShellI18nEnum.OPT_RELEASE_NOTES) + ": ")
            .appendChild(new A("https://docs.mycollab.com/administration/hosting-mycollab-on-your-own-server/releases/", "_blank").appendText("Link"));
    content.with(ELabel.html(releaseNoteLink.write()));

    MButton skipBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_SKIP), clickEvent -> close())
            .withStyleName(WebThemes.BUTTON_OPTION);

    MButton autoUpgradeBtn = new MButton(UserUIContext.getMessage(ShellI18nEnum.ACTION_AUTO_UPGRADE), clickEvent -> {
        close();
        navigateToWaitingUpgradePage();
    }).withStyleName(WebThemes.BUTTON_ACTION);
    if (installerFilePath == null) {
        autoUpgradeBtn.setEnabled(false);
    }

    MHorizontalLayout buttonControls = new MHorizontalLayout(skipBtn, autoUpgradeBtn).withMargin(true);
    content.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT);
}