List of usage examples for com.vaadin.server BrowserWindowOpener extend
public void extend(EventTrigger eventTrigger)
From source file:com.mycollab.module.user.accountsettings.view.AccountModuleImpl.java
License:Open Source License
public AccountModuleImpl() { addStyleName("module"); ControllerRegistry.addController(new UserAccountController(this)); MHorizontalLayout topPanel = new MHorizontalLayout().withFullWidth().withMargin(true) .withStyleName("border-bottom"); AccountSettingBreadcrumb breadcrumb = ViewManager.getCacheComponent(AccountSettingBreadcrumb.class); MButton helpBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_HELP)) .withIcon(FontAwesome.MORTAR_BOARD).withStyleName(WebThemes.BUTTON_LINK); ExternalResource helpRes = new ExternalResource("https://community.mycollab.com/docs/account-management/"); BrowserWindowOpener helpOpener = new BrowserWindowOpener(helpRes); helpOpener.extend(helpBtn); topPanel.with(breadcrumb, helpBtn).expand(breadcrumb).alignAll(Alignment.MIDDLE_LEFT); tabSheet = new VerticalTabsheet(); tabSheet.setSizeFull();/* w w w. j av a 2 s. c o m*/ tabSheet.setNavigatorStyleName("sidebar-menu"); tabSheet.addToggleNavigatorControl(); VerticalLayout contentWrapper = tabSheet.getContentWrapper(); contentWrapper.addStyleName("main-content"); contentWrapper.addComponentAsFirst(topPanel); this.buildComponents(); this.setContent(tabSheet); }
From source file:com.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'>>></div>", ContentMode.HTML); informLbl.addStyleName("trialEndingNotification"); informLbl.setHeight("100%"); MHorizontalLayout informBox = new MHorizontalLayout(informLbl).withFullHeight() .withStyleName("trialInformBox"); informBox.setMargin(new MarginInfo(false, true, false, false)); informBox.addLayoutClickListener(layoutClickEvent -> 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%"); MHorizontalLayout informBox = new MHorizontalLayout(informLbl).withStyleName("trialInformBox") .withMargin(new MarginInfo(false, true, false, false)).withFullHeight(); informBox.addLayoutClickListener(layoutClickEvent -> 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 ended<br></div>"); AppContext.getInstance().setIsValidAccount(false); } else { informLbl.setValue(String.format("<div class='informBlock'>Trial ending<br>%d days " + "left</div><div class='informBlock'>>></div>", 30 - daysLeft)); }/*w ww .j a v a2s . com*/ } } } Label accountNameLabel = new Label(AppContext.getSubDomain()); accountNameLabel.addStyleName("subdomain"); accountLayout.addComponent(accountNameLabel); if (SiteConfiguration.isCommunityEdition()) { MButton buyPremiumBtn = new MButton("Upgrade to Pro edition", clickEvent -> UI.getCurrent().addWindow(new AdWindow())).withIcon(FontAwesome.SHOPPING_CART) .withStyleName("ad"); accountLayout.addComponent(buyPremiumBtn); } LicenseResolver licenseResolver = AppContextUtil.getSpringBean(LicenseResolver.class); if (licenseResolver != null) { LicenseInfo licenseInfo = licenseResolver.getLicenseInfo(); if (licenseInfo != null) { if (licenseInfo.isExpired()) { MButton buyPremiumBtn = new MButton(AppContext.getMessage(LicenseI18nEnum.EXPIRE_NOTIFICATION), clickEvent -> UI.getCurrent().addWindow(new BuyPremiumSoftwareWindow())) .withIcon(FontAwesome.SHOPPING_CART).withStyleName("ad"); accountLayout.addComponent(buyPremiumBtn); } else if (licenseInfo.isTrial()) { Duration dur = new Duration(new DateTime(), new DateTime(licenseInfo.getExpireDate())); int days = dur.toStandardDays().getDays(); MButton buyPremiumBtn = new MButton( AppContext.getMessage(LicenseI18nEnum.TRIAL_NOTIFICATION, days), clickEvent -> UI.getCurrent().addWindow(new BuyPremiumSoftwareWindow())) .withIcon(FontAwesome.SHOPPING_CART).withStyleName("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(); MButton myProfileBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_PROFILE), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "preview" })); }).withIcon(SettingAssetsManager.getAsset(SettingUIConstants.PROFILE)); accountPopupContent.addOption(myProfileBtn); MButton userMgtBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_USERS_AND_ROLES), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "user", "list" })); }).withIcon(SettingAssetsManager.getAsset(SettingUIConstants.USERS)); accountPopupContent.addOption(userMgtBtn); MButton generalSettingBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_SETTING), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setting", "general" })); }).withIcon(SettingAssetsManager.getAsset(SettingUIConstants.GENERAL_SETTING)); accountPopupContent.addOption(generalSettingBtn); MButton themeCustomizeBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_THEME), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setting", "theme" })); }).withIcon(SettingAssetsManager.getAsset(SettingUIConstants.THEME_CUSTOMIZE)); accountPopupContent.addOption(themeCustomizeBtn); if (!SiteConfiguration.isDemandEdition()) { MButton setupBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_SETUP), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setup" })); }).withIcon(FontAwesome.WRENCH); accountPopupContent.addOption(setupBtn); } accountPopupContent.addSeparator(); MButton helpBtn = new MButton(AppContext.getMessage(GenericI18Enum.ACTION_HELP)) .withIcon(FontAwesome.MORTAR_BOARD); ExternalResource helpRes = new ExternalResource("https://community.mycollab.com/meet-mycollab/"); BrowserWindowOpener helpOpener = new BrowserWindowOpener(helpRes); helpOpener.extend(helpBtn); accountPopupContent.addOption(helpBtn); MButton supportBtn = new MButton(AppContext.getMessage(GenericI18Enum.BUTTON_SUPPORT)) .withIcon(FontAwesome.LIFE_SAVER); ExternalResource supportRes = new ExternalResource("http://support.mycollab.com/"); BrowserWindowOpener supportOpener = new BrowserWindowOpener(supportRes); supportOpener.extend(supportBtn); accountPopupContent.addOption(supportBtn); MButton translateBtn = new MButton(AppContext.getMessage(GenericI18Enum.ACTION_TRANSLATE)) .withIcon(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()) { MButton myAccountBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_BILLING), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" })); }).withIcon(SettingAssetsManager.getAsset(SettingUIConstants.BILLING)); accountPopupContent.addOption(myAccountBtn); } accountPopupContent.addSeparator(); MButton aboutBtn = new MButton("About MyCollab", clickEvent -> { accountMenu.setPopupVisible(false); Window aboutWindow = ViewManager.getCacheComponent(AbstractAboutWindow.class); UI.getCurrent().addWindow(aboutWindow); }).withIcon(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); MButton signoutBtn = new MButton(AppContext.getMessage(GenericI18Enum.BUTTON_SIGNOUT), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance().post(new ShellEvent.LogOut(this, null)); }).withIcon(FontAwesome.SIGN_OUT); accountPopupContent.addSeparator(); accountPopupContent.addOption(signoutBtn); accountMenu.setContent(accountPopupContent); accountLayout.addComponent(accountMenu); return accountLayout; }
From source file:com.mycollab.web.DesktopApplication.java
License:Open Source License
private void handleException(VaadinRequest request, Throwable e) { IgnoreException ignoreException = getExceptionType(e, IgnoreException.class); if (ignoreException != null) { return;/* w ww . j ava 2s. c om*/ } DebugException debugException = getExceptionType(e, DebugException.class); if (debugException != null) { LOG.error("Debug error", e); return; } SessionExpireException sessionExpireException = getExceptionType(e, SessionExpireException.class); if (sessionExpireException != null) { Page.getCurrent().getJavaScript().execute("window.location.reload();"); return; } UsageExceedBillingPlanException usageBillingException = getExceptionType(e, UsageExceedBillingPlanException.class); if (usageBillingException != null) { if (UserUIContext.isAdmin()) { ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.WINDOW_ATTENTION_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.EXCEED_BILLING_PLAN_MSG_FOR_ADMIN), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { Collection<Window> windowsList = UI.getCurrent().getWindows(); for (Window window : windowsList) { window.close(); } EventBusFactory.getInstance().post( new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" })); } }); } else { NotificationUtil.showErrorNotification( UserUIContext.getMessage(GenericI18Enum.EXCEED_BILLING_PLAN_MSG_FOR_USER)); } return; } UserInvalidInputException invalidException = getExceptionType(e, UserInvalidInputException.class); if (invalidException != null) { NotificationUtil.showWarningNotification(UserUIContext .getMessage(GenericI18Enum.ERROR_USER_INPUT_MESSAGE, invalidException.getMessage())); return; } UnsupportedFeatureException unsupportedException = getExceptionType(e, UnsupportedFeatureException.class); if (unsupportedException != null) { NotificationUtil.showFeatureNotPresentInSubscription(); return; } ResourceNotFoundException resourceNotFoundException = getExceptionType(e, ResourceNotFoundException.class); if (resourceNotFoundException != null) { NotificationUtil.showWarningNotification(UserUIContext.getMessage(ErrorI18nEnum.RESOURCE_NOT_FOUND)); LOG.error("404", resourceNotFoundException); return; } SecureAccessException secureAccessException = getExceptionType(e, SecureAccessException.class); if (secureAccessException != null) { NotificationUtil.showWarningNotification("You can not access the specific resource"); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "preview" })); return; } for (Class systemEx : systemExceptions) { Exception ex = (Exception) getExceptionType(e, systemEx); if (ex != null) { ConfirmDialog dialog = ConfirmDialogExt.show(DesktopApplication.this, UserUIContext.getMessage(GenericI18Enum.WINDOW_ERROR_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.ERROR_USER_SYSTEM_ERROR, ex.getMessage()), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { }); Button okBtn = dialog.getOkButton(); BrowserWindowOpener opener = new BrowserWindowOpener("http://support.mycollab.com"); opener.extend(okBtn); return; } } IllegalStateException asyncNotSupport = getExceptionType(e, IllegalStateException.class); if (asyncNotSupport != null && asyncNotSupport.getMessage().contains("!asyncSupported")) { ConfirmDialog dialog = ConfirmDialogExt.show(DesktopApplication.this, UserUIContext.getMessage(GenericI18Enum.WINDOW_ERROR_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage(ErrorI18nEnum.WEBSOCKET_NOT_SUPPORT), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { }); Button okBtn = dialog.getOkButton(); BrowserWindowOpener opener = new BrowserWindowOpener("http://support.mycollab.com"); opener.extend(okBtn); if (request != null) { String remoteAddress = request.getRemoteHost(); if (remoteAddress != null) { if (!ipLists.contains(remoteAddress)) { LOG.error("Async not supported: " + printRequest(request)); ipLists.add(remoteAddress); } } } return; } EofException eofException = getExceptionType(e, EofException.class); if (eofException != null) { return; } LOG.error("Error", e); ConfirmDialog dialog = ConfirmDialogExt.show(DesktopApplication.this, UserUIContext.getMessage(GenericI18Enum.WINDOW_ERROR_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.ERROR_USER_NOTICE_INFORMATION_MESSAGE), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { }); Button okBtn = dialog.getOkButton(); BrowserWindowOpener opener = new BrowserWindowOpener("http://support.mycollab.com"); opener.extend(okBtn); }
From source file:edu.nps.moves.mmowgli.modules.cards.PlayAnIdeaPage2.java
License:Open Source License
@Override public void initGui() { setSpacing(true);/*ww w . j av a 2s. c o m*/ Label lab = new Label(); lab.setWidth(CALLTOACTION_HOR_OFFSET_STR); addComponent(lab); MovePhase phase = MovePhase.getCurrentMovePhaseTL(); String playTitle = phase.getPlayACardTitle(); if (playTitle != null && playTitle.length() > 0) { addComponent(lab = new Label(playTitle)); setComponentAlignment(lab, Alignment.TOP_CENTER); lab.addStyleName("m-calltoaction-playprompt"); } AbsoluteLayout mainAbsL = new AbsoluteLayout(); mainAbsL.setWidth(PAIP_WIDTH); mainAbsL.setHeight("675px"); addComponent(mainAbsL); // do this at the bottom so z order is top: mainAbsL.addComponent(topHL = new HorizontalLayout(),"top:0px;left:0px"); topHL = new HorizontalLayout(); topHL.addComponent(leftAbsL = new AbsoluteLayout()); topHL.addComponent(rightAbsL = new AbsoluteLayout()); leftAbsL.setWidth(PAIP_HALFWIDTH); rightAbsL.setWidth(PAIP_HALFWIDTH); leftAbsL.setHeight(PAIP_TOP_HEIGHT); rightAbsL.setHeight(PAIP_TOP_HEIGHT); GameLinks gl = GameLinks.getTL(); final String howToPlayLink = gl.getHowToPlayLink(); if (howToPlayLink != null && howToPlayLink.length() > 0) { howToPlayButt = new NativeButton(null); BrowserWindowOpener bwo = new BrowserWindowOpener(howToPlayLink); bwo.setWindowName(MmowgliConstants.PORTALTARGETWINDOWNAME); bwo.extend(howToPlayButt); } else if (mockupOnly) howToPlayButt = new NativeButton(null); else howToPlayButt = new IDNativeButton(null, HOWTOPLAYCLICK); leftAbsL.addComponent(howToPlayButt, HOWTO_POS); leftType = CardType.getCurrentPositiveIdeaCardTypeTL(); leftAbsL.addComponent(poshdr = CardSummaryListHeader.newCardSummaryListHeader(leftType, mockupOnly, null), POS_POS); poshdr.initGui(); poshdr.addNewCardListener(newCardListener); if (mockupOnly) gotoDashboardButt = new NativeButton(null); else gotoDashboardButt = new IDNativeButton(null, IDEADASHBOARDCLICK); rightAbsL.addComponent(gotoDashboardButt, GOTO_POS); rightType = CardType.getCurrentNegativeIdeaCardTypeTL(); rightAbsL.addComponent(neghdr = CardSummaryListHeader.newCardSummaryListHeader(rightType, mockupOnly, null), NEG_POS); neghdr.initGui(); neghdr.addNewCardListener(newCardListener); howToPlayButt.setStyleName("m-howToPlayButton"); gotoDashboardButt.setStyleName("m-gotoIdeaDashboardButton"); // end of top gui VerticalLayout bottomVLay = new VerticalLayout(); mainAbsL.addComponent(bottomVLay, "top:200px;left:0px"); mainAbsL.addComponent(topHL, "top:0px;left:0px"); // doing this at the bottom so z order is top: HorizontalLayout hLay = buildLabelPopupRow(leftType.getTitle(), topNewCardLabel = new Label("new card played")); bottomVLay.addComponent(hLay); bottomVLay.setComponentAlignment(hLay, Alignment.MIDDLE_LEFT); User me = Mmowgli2UI.getGlobals().getUserTL(); topholder = new HorizontalCardDisplay(new Dimension(CARDWIDTH, CARDHEIGHT), NUMCARDS, me, mockupOnly, "top"); bottomVLay.addComponent(topholder); ; topholder.initGui(); bottomVLay.addComponent(lab = new Label()); lab.setHeight("10px"); hLay = buildLabelPopupRow(rightType.getTitle(), bottomNewCardLabel = new Label("new card played")); bottomVLay.addComponent(hLay); bottomVLay.setComponentAlignment(hLay, Alignment.MIDDLE_LEFT); bottomholder = new HorizontalCardDisplay(new Dimension(CARDWIDTH, CARDHEIGHT), NUMCARDS, me, mockupOnly, "bottom"); bottomVLay.addComponent(bottomholder); bottomholder.initGui(); MCacheManager cMgr = AppMaster.instance().getMcache(); if (mockupOnly) { addCardsTL(topholder, cMgr.getPositiveIdeaCardsCurrentMove()); addCardsTL(bottomholder, cMgr.getNegativeIdeaCardsCurrentMove()); } else { Game g = Game.getTL(); if (g.isShowPriorMovesCards() || me.isAdministrator()) { addCardsTL(topholder, cMgr.getAllPositiveIdeaCards()); addCardsTL(bottomholder, cMgr.getAllNegativeIdeaCards()); } else if (!g.isShowPriorMovesCards()) { addCardsTL(topholder, cMgr.getPositiveUnhiddenIdeaCardsCurrentMove()); addCardsTL(bottomholder, cMgr.getNegativeUnhiddenIdeaCardsCurrentMove()); } } }
From source file:fr.univlorraine.mondossierweb.views.AssistanceView.java
License:Apache License
/** * Initialise la vue/* www .j a va 2s. co m*/ */ @PostConstruct public void init() { //On vrifie le droit d'accder la vue if (userController.isEnseignant()) { // Style setMargin(true); setSpacing(true); // Rcupration de la configuration pour cette vue String docUrl = configController.getAssistanceDocUrl(); String helpdeskUrl = configController.getAssistanceHelpdeskUrl(); String mailContact = configController.getAssistanceContactMail(); // Titre Label title = new Label(applicationContext.getMessage(NAME + ".title", null, getLocale())); title.addStyleName(ValoTheme.LABEL_H1); addComponent(title); // Texte if (StringUtils.hasText(applicationContext.getMessage(NAME + ".text", null, getLocale()))) { addComponent(new Label(applicationContext.getMessage(NAME + ".text", null, getLocale()), ContentMode.HTML)); } // Afficher la pop-up de dmarrage Button popupBtn = new Button(applicationContext.getMessage(NAME + ".btnPopUp", null, getLocale()), FontAwesome.INFO); popupBtn.addStyleName(ValoTheme.BUTTON_LINK); popupBtn.addClickListener(e -> MainUI.getCurrent().afficherMessageIntroEnseignants(true, false)); addComponent(popupBtn); // Accs la documentation if (StringUtils.hasText(docUrl)) { Button docBtn = new Button(applicationContext.getMessage(NAME + ".btnDoc", null, getLocale()), FontAwesome.FILE_TEXT); docBtn.addStyleName(ValoTheme.BUTTON_LINK); BrowserWindowOpener docBwo = new BrowserWindowOpener(docUrl); docBwo.extend(docBtn); addComponent(docBtn); } // Envoyer un ticket if (StringUtils.hasText(helpdeskUrl)) { Button helpDeskBtn = new Button( applicationContext.getMessage(NAME + ".btnHelpdesk", null, getLocale()), FontAwesome.AMBULANCE); helpDeskBtn.addStyleName(ValoTheme.BUTTON_LINK); BrowserWindowOpener helpDeskBwo = new BrowserWindowOpener(helpdeskUrl); helpDeskBwo.extend(helpDeskBtn); addComponent(helpDeskBtn); } // Envoyer un mail if (StringUtils.hasText(mailContact)) { Button contactBtn = new Button(applicationContext.getMessage(NAME + ".btnContact", new Object[] { mailContact }, getLocale()), FontAwesome.ENVELOPE); contactBtn.addStyleName(ValoTheme.BUTTON_LINK); BrowserWindowOpener contactBwo = new BrowserWindowOpener("mailto:" + mailContact); contactBwo.extend(contactBtn); addComponent(contactBtn); } /* Deconnexion */ //Voir si on peut accder l'appli hors ENT, le dtecter, et afficher le bouton dconnexion if (configController.isLogoutCasPropose()) { Button decoBtn = new Button("Dconnexion", FontAwesome.SIGN_OUT); decoBtn.addStyleName(ValoTheme.BUTTON_LINK); decoBtn.addClickListener(e -> { getUI().getPage().setLocation("j_spring_security_logout"); }); addComponent(decoBtn); } } }
From source file:fr.univlorraine.mondossierweb.views.windows.HelpBasicWindow.java
License:Apache License
/** * Cre une fentre de confirmation// ww w. j a v a 2 s .c o m * @param message * @param titre */ public HelpBasicWindow(String message, String titre, boolean displayLienContact) { /* Style */ setWidth(900, Unit.PIXELS); setModal(true); setResizable(false); setClosable(false); /* Layout */ VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(false); setContent(layout); /* Titre */ setCaption(titre); // Lien de contact if (displayLienContact) { String mailContact = configController.getAssistanceContactMail(); if (StringUtils.hasText(mailContact)) { Button contactBtn = new Button( applicationContext.getMessage(NAME + ".btnContact", null, getLocale()), FontAwesome.ENVELOPE); contactBtn.addStyleName(ValoTheme.BUTTON_LINK); BrowserWindowOpener contactBwo = new BrowserWindowOpener("mailto:" + mailContact); contactBwo.extend(contactBtn); layout.addComponent(contactBtn); layout.setComponentAlignment(contactBtn, Alignment.TOP_RIGHT); } } /* Texte */ Label textLabel = new Label(message, ContentMode.HTML); layout.addComponent(textLabel); /* Boutons */ HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setWidth(100, Unit.PERCENTAGE); buttonsLayout.setSpacing(true); layout.addComponent(buttonsLayout); btnFermer.setCaption(applicationContext.getMessage("helpWindow.btnFermer", null, getLocale())); btnFermer.setIcon(FontAwesome.TIMES); btnFermer.addClickListener(e -> close()); buttonsLayout.addComponent(btnFermer); buttonsLayout.setComponentAlignment(btnFermer, Alignment.MIDDLE_RIGHT); /* Centre la fentre */ center(); }
From source file:org.apache.openaz.xacml.admin.components.PolicyEditor.java
License:Apache License
protected void initializeButtons() { ///* w w w .j a v a 2 s . c o m*/ // The Save button // this.buttonSave.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { self.savePolicy(); } }); // // Attach a window opener to the View XML button // BrowserWindowOpener opener = new BrowserWindowOpener(new StreamResource(new StreamResource.StreamSource() { private static final long serialVersionUID = 1L; @Override public InputStream getStream() { try { if (logger.isDebugEnabled()) { logger.debug("Setting view xml button to: " + self.file.getAbsolutePath()); } return new FileInputStream(self.file); } catch (Exception e) { logger.error("Failed to open input stream " + self.file); } return null; } }, self.file.getName())); opener.setWindowName("_new"); opener.extend(this.buttonViewXML); }