Example usage for com.vaadin.server BrowserWindowOpener extend

List of usage examples for com.vaadin.server BrowserWindowOpener extend

Introduction

In this page you can find the example usage for com.vaadin.server BrowserWindowOpener extend.

Prototype

public void extend(EventTrigger eventTrigger) 

Source Link

Document

Add this extension to the EventTrigger .

Usage

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  ww  w . j  a  v  a2 s.  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.foc.vaadin.gui.components.FVBlobDisplay.java

License:Apache License

public void displayPDFFile() {
    BlobResource blobResource = getBlobResource();
    if (blobResource != null) {
        String fileName = blobResource.getFilename();
        if (fileName != null) {
            String mimeType = blobResource.getMIMEType();

            StreamSource streamSource = new StreamSource() {
                private DownloadStream downloadStream = getBlobResource() != null
                        ? getBlobResource().getStream()
                        : null;/*from   w  w w . ja va2s  .c o  m*/

                @Override
                public InputStream getStream() {

                    return downloadStream != null ? downloadStream.getStream() : null;
                }
            };
            String viewButtonCaption = "View "
                    + fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length()) + " File";
            Button viewDocButton = new Button(viewButtonCaption);
            viewDocButton.setStyleName(Reindeer.BUTTON_LINK);
            if (streamSource != null) {
                StreamResource streamResource = new StreamResource(streamSource, fileName);
                streamResource.setMIMEType(mimeType);

                BrowserWindowOpener opener = new BrowserWindowOpener(streamResource);
                opener.extend(viewDocButton);
                settingsLayout.addComponent(viewDocButton);
                Resource resource = FVIconFactory.getInstance().getFVIcon(FVIconFactory.ICON_NOTE);
                Image image = new Image();
                image.setSource(resource);
                addComponent(image);
            }
        }
    }
}

From source file:com.foc.vaadin.gui.layouts.validationLayout.FVHelpButton.java

License:Apache License

private void applyBrowserWindowOpenerToPrintButton(Button printButton) {
    BrowserWindowOpener opener = new BrowserWindowOpener(HelpUI.class);
    //    opener.setFeatures("height=700,width=600,resizable");
    opener.extend(printButton);
}

From source file:com.foc.vaadin.gui.layouts.validationLayout.FVValidationLayout.java

License:Apache License

public Button getPdfGeneratorButton(boolean createIfNeeded) {
    if (pdfGeneratorButton == null && createIfNeeded && ConfigInfo.isForDevelopment()) {
        pdfGeneratorButton = new Button();
        pdfGeneratorButton.setStyleName(BaseTheme.BUTTON_LINK);
        pdfGeneratorButton.setIcon(FVIconFactory.getInstance().getFVIcon_Big(FVIconFactory.ICON_ADOBE));

        focXmlPDFParser = new FocXmlPDFParser(getCentralPanel(), getFocData());
        focXmlMSWordParser = new FocXmlMSWordParser(getCentralPanel(), getFocData());

        pdfGeneratorButton.addClickListener(new ClickListener() {

            @Override/*from   w ww .  ja  v a2  s  .co  m*/
            public void buttonClick(ClickEvent event) {
            }
        });
        BrowserWindowOpener opener = new BrowserWindowOpener(focXmlMSWordParser.getStreamResource());
        opener.extend(pdfGeneratorButton);
    }
    return pdfGeneratorButton;
}

From source file:com.foc.vaadin.gui.layouts.validationLayout.FVValidationLayout.java

License:Apache License

public void applyBrowserWindowOpenerToPrintButton(AbstractComponent printButton) {
    BrowserWindowOpener opener = null;
    if (validationSettings != null && validationSettings.avoidRowBreak()) {
        opener = new BrowserWindowOpener(PrintUI_Break.class);
    } else {//from   ww  w  .  j a va  2 s . co m
        opener = new BrowserWindowOpener(PrintUI.class);
    }
    opener.setFeatures("height=700,width=900,resizable,titlebar=no");
    opener.extend(printButton);
}

From source file:com.foc.vaadin.gui.layouts.validationLayout.FVValidationLayout.java

License:Apache License

public Embedded valo_GetPdfGeneratorEmbedded(boolean createIfNeeded) {
    if (valo_PdfGeneratorEmbedded == null && createIfNeeded && ConfigInfo.isForDevelopment()) {
        valo_PdfGeneratorEmbedded = new Embedded();
        valo_PdfGeneratorEmbedded.addStyleName(FocXMLGuiComponentStatic.STYLE_HAND_POINTER_ON_HOVER);
        valo_PdfGeneratorEmbedded/*  w ww.ja va2  s.co m*/
                .setSource(FVIconFactory.getInstance().getFVIcon_Big(FVIconFactory.ICON_ADOBE));

        focXmlPDFParser = new FocXmlPDFParser(getCentralPanel(), getFocData());

        valo_PdfGeneratorEmbedded.addClickListener(new MouseEvents.ClickListener() {

            @Override
            public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
            }
        });

        BrowserWindowOpener opener = new BrowserWindowOpener(focXmlPDFParser.getStreamResource());
        opener.extend(valo_PdfGeneratorEmbedded);
    }
    return valo_PdfGeneratorEmbedded;
}

From source file:com.foc.vaadin.gui.layouts.validationLayout.FVValidationLayout.java

License:Apache License

public Embedded valo_GetMSWordGeneratorEmbedded(boolean createIfNeeded) {
    if (valo_MSWordGeneratorEmbedded == null && createIfNeeded && ConfigInfo.isForDevelopment()) {
        valo_MSWordGeneratorEmbedded = new Embedded();
        valo_MSWordGeneratorEmbedded.addStyleName(FocXMLGuiComponentStatic.STYLE_HAND_POINTER_ON_HOVER);
        valo_MSWordGeneratorEmbedded/*from  w ww  .ja  v  a  2s . c  om*/
                .setSource(FVIconFactory.getInstance().getFVIcon_Big(FVIconFactory.ICON_WORD));

        focXmlMSWordParser = new FocXmlMSWordParser(getCentralPanel(), getFocData());

        valo_MSWordGeneratorEmbedded.addClickListener(new MouseEvents.ClickListener() {

            @Override
            public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
            }
        });

        BrowserWindowOpener opener = new BrowserWindowOpener(focXmlMSWordParser.getStreamResource());
        opener.extend(valo_MSWordGeneratorEmbedded);
    }
    return valo_MSWordGeneratorEmbedded;
}

From source file:com.foc.web.modules.business.PrnLayout_Table.java

License:Apache License

@Override
protected void afterLayoutConstruction() {
    super.afterLayoutConstruction();

    if (getPrintLogoCheckBox() != null) {
        getPrintLogoCheckBox().setValue(true);
    }//w  w w .  j a v a 2s .  co m

    adjustAddButtonVisibilityDependingOnGroupRights();
    TableTreeDelegate tableTreeDelegate = getTableTreeDelegate();
    if (tableTreeDelegate != null) {

        if (isShowRTFPrinting()) {
            tableTreeDelegate.getTable().addGeneratedColumn("PRINT_RTF_BUTTON", new Table.ColumnGenerator() {

                @Override
                public Object generateCell(Table source, Object itemId, Object columnId) {
                    Button button = new Button("RTF");
                    if (getFocList() != null && itemId != null) {
                        PrnLayout layout = (PrnLayout) getFocList().searchByReference((long) itemId);
                        if (layout != null) {
                            BrowserWindowOpener browserWindowOpener = new BrowserWindowOpener(
                                    new PrnLayout_BrowserWindowOpenerStreamResource(layout,
                                            PrnLayout_Table.this.getPrintingAction(),
                                            PrnLayout_BrowserWindowOpenerStreamResource.RTF) {
                                        protected boolean isWithLogo() {
                                            if (getPrintLogoCheckBox() != null) {
                                                return getPrintLogoCheckBox().getValue();
                                            }
                                            return true;
                                        }
                                    });
                            browserWindowOpener.extend(button);
                        }
                    }
                    return button;
                }
            });
            tableTreeDelegate.getTable().setColumnHeader("PRINT_RTF_BUTTON", "RTF");
        }

        if (isShowWordPrinting()) {
            tableTreeDelegate.getTable().addGeneratedColumn("PRINT_WORD_BUTTON", new Table.ColumnGenerator() {

                @Override
                public Object generateCell(Table source, Object itemId, Object columnId) {
                    Button button = new Button("MS Word");
                    if (getFocList() != null && itemId != null) {
                        PrnLayout layout = (PrnLayout) getFocList().searchByReference((long) itemId);
                        if (layout != null) {
                            BrowserWindowOpener browserWindowOpener = new BrowserWindowOpener(
                                    new PrnLayout_BrowserWindowOpenerStreamResource(layout,
                                            PrnLayout_Table.this.getPrintingAction(),
                                            PrnLayout_BrowserWindowOpenerStreamResource.DOC) {
                                        protected boolean isWithLogo() {
                                            if (getPrintLogoCheckBox() != null) {
                                                return getPrintLogoCheckBox().getValue();
                                            }
                                            return true;
                                        }
                                    });
                            browserWindowOpener.extend(button);
                        }
                    }
                    return button;
                }
            });
            tableTreeDelegate.getTable().setColumnHeader("PRINT_WORD_BUTTON", "MS Word");
        }

        tableTreeDelegate.getTable().addGeneratedColumn("PRINT_BUTTON", new Table.ColumnGenerator() {

            @Override
            public Object generateCell(Table source, Object itemId, Object columnId) {
                Button button = new Button("PDF");
                PrnLayout layout = (PrnLayout) getFocList().searchByReference((long) itemId);
                if (layout != null) {
                    BrowserWindowOpener browserWindowOpener = new BrowserWindowOpener(
                            new PrnLayout_BrowserWindowOpenerStreamResource(layout,
                                    PrnLayout_Table.this.getPrintingAction())) {
                        protected boolean isWithLogo() {
                            if (getPrintLogoCheckBox() != null) {
                                return getPrintLogoCheckBox().getValue();
                            }
                            return true;
                        }
                    };
                    browserWindowOpener.extend(button);
                }
                return button;
            }
        });
        tableTreeDelegate.getTable().setColumnHeader("PRINT_BUTTON", "PDF");

        if (isShowEMailSending()) {
            tableTreeDelegate.getTable().addGeneratedColumn("SEND_EMAIL_BUTTON", new Table.ColumnGenerator() {

                @Override
                public Object generateCell(Table source, final Object itemId, Object columnId) {
                    FVButton button = new FVButton("Send Email");
                    button.addClickListener(new ClickListener() {

                        @Override
                        public void buttonClick(ClickEvent event) {

                            PrintingAction printingAction = getPrintingAction();
                            if (getFocList() != null && itemId != null && printingAction != null) {
                                PrnLayout prnLayout = (PrnLayout) getFocList().searchByReference((Long) itemId);
                                if (prnLayout != null) {
                                    boolean withLogo = false;

                                    if (getPrintLogoCheckBox() != null) {
                                        withLogo = getPrintLogoCheckBox().getValue();
                                    }

                                    FocNotificationEmailTemplate template = (FocNotificationEmailTemplate) BusinessConfig
                                            .getInstance().getGeneralEmailTemplate();
                                    FocNotificationEmail email = new FocNotificationEmail(
                                            new FocConstructor(FocNotificationEmailDesc.getInstance(), null));
                                    email.init(template, printingAction.getObjectToPrint());
                                    prnLayout.attachToEmail(email, printingAction, withLogo);
                                    email.fill();
                                    email.send();
                                    email.setCreated(true);
                                    email.validate(true);

                                    //                           Globals.popup(email, false, FocNotificationEmailDesc.getInstance().getStorageName(), XMLViewKey.TYPE_FORM, XMLViewKey.CONTEXT_DEFAULT, XMLViewKey.VIEW_DEFAULT);
                                }
                            }
                        }
                    });
                    return button;
                }
            });
            tableTreeDelegate.getTable().setColumnHeader("SEND_EMAIL_BUTTON", "Send Email");
        }
    }

}

From source file:com.haulmont.cuba.web.gui.components.mainwindow.WebNewWindowButton.java

License:Apache License

public WebNewWindowButton() {
    component = new CubaButton();
    component.addStyleName(NEW_WINDOW_BUTTON_STYLENAME);
    component.setDescription(null);/*  ww  w  .  ja  v a 2 s  . co  m*/

    URL pageUrl;
    try {
        pageUrl = Page.getCurrent().getLocation().toURL();
    } catch (MalformedURLException ignored) {
        LoggerFactory.getLogger(WebNewWindowButton.class).warn("Couldn't get URL of current Page");
        return;
    }

    ExternalResource currentPage = new ExternalResource(pageUrl);
    final BrowserWindowOpener opener = new BrowserWindowOpener(currentPage);
    opener.setWindowName("_blank");

    opener.extend(component);
}

From source file:com.mycollab.module.user.accountsettings.customize.view.GeneralSettingViewImpl.java

License:Open Source License

private void buildLanguageUpdatePanel() {
    FormContainer formContainer = new FormContainer();
    MHorizontalLayout layout = new MHorizontalLayout().withFullWidth().withMargin(new MarginInfo(true));
    MVerticalLayout leftPanel = new MVerticalLayout().withMargin(false);
    Label logoDesc = new Label(UserUIContext.getMessage(ShellI18nEnum.OPT_LANGUAGE_DOWNLOAD));
    leftPanel.with(logoDesc).withWidth("250px");
    MVerticalLayout rightPanel = new MVerticalLayout().withMargin(false);
    MButton downloadBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DOWNLOAD))
            .withStyleName(WebThemes.BUTTON_ACTION).withIcon(FontAwesome.DOWNLOAD);
    BrowserWindowOpener opener = new BrowserWindowOpener(
            SiteConfiguration.getApiUrl("localization/translations"));
    opener.extend(downloadBtn);
    rightPanel.with(downloadBtn,//from w  w w.j av  a 2s.  c  o  m
            new ELabel(UserUIContext.getMessage(ShellI18nEnum.OPT_UPDATE_LANGUAGE_INSTRUCTION))
                    .withStyleName(UIConstants.META_INFO));
    layout.with(leftPanel, rightPanel).expand(rightPanel);
    formContainer.addSection("Languages", layout);
    this.with(formContainer);
}