List of usage examples for com.vaadin.shared Position MIDDLE_CENTER
Position MIDDLE_CENTER
To view the source code for com.vaadin.shared Position MIDDLE_CENTER.
Click Source Link
From source file:edu.nps.moves.mmowgli.AbstractMmowgliControllerHelper.java
License:Open Source License
private void showNotifInAllBrowserWindows(String content, String title, String style) { StringBuilder sb = new StringBuilder(); sb.append("<br/>"); sb.append(content);/* w ww. j ava2 s . com*/ filterContent(sb); sb.append("<br/><span style='font-size:x-small'>Click to close.</span>"); Notification notif = new Notification(title, sb.toString(), Notification.Type.ERROR_MESSAGE); notif.setHtmlContentAllowed(true); notif.setPosition(Position.MIDDLE_CENTER); notif.setStyleName(style); iterateUIs(notif, new UIHandler() { public boolean handle(Mmowgli2UI ui, Object notif) { ((Notification) notif).show(ui.getPage()); return true; } }); }
From source file:edu.nps.moves.mmowgli.AbstractMmowgliControllerHelper2.java
License:Open Source License
private void showNotification(String content, String title, String style) { StringBuilder sb = new StringBuilder(); sb.append("<br/>"); sb.append(content);//from www . j a v a 2 s.c o m // filterContent(sb); sb.append("<br/><span style='font-size:x-small'>Click to close.</span>"); Notification notif = new Notification(title, sb.toString(), Notification.Type.ERROR_MESSAGE); notif.setHtmlContentAllowed(true); notif.setPosition(Position.MIDDLE_CENTER); notif.setStyleName(style); notif.show(myUI.getPage()); }
From source file:edu.nps.moves.mmowgli.export.BaseExporter.java
License:Open Source License
protected void showStartNotification(String exportType) { Notification notif = new Notification("", "Export of " + exportType + " begun. Results may appear in another browser window (unless popups blocked).", Notification.Type.WARNING_MESSAGE); // not warning, but want yellow notif.setPosition(Position.MIDDLE_CENTER); notif.setDelayMsec(-1);/*from w w w .ja va2 s . c om*/ notif.show(Page.getCurrent()); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboard.java
License:Open Source License
public void initGuiTL() { setSizeUndefined();// w w w. jav a 2 s.c o m setWidth(APPLICATION_SCREEN_WIDTH); // setHeight("855px"); //ACTIONDASHBOARD_H); Label sp; addComponent(sp = new Label()); sp.setHeight("10px"); HorizontalLayout titleHL = new HorizontalLayout(); titleHL.setWidth("95%"); addComponent(titleHL); titleHL.addComponent(sp = new Label()); sp.setWidth("20px"); Component titleC; titleHL.addComponent(titleC = Mmowgli2UI.getGlobals().getMediaLocator().getActionDashboardTitle()); titleHL.setComponentAlignment(titleC, Alignment.MIDDLE_LEFT); titleHL.addComponent(sp = new Label()); sp.setWidth("1px"); titleHL.setExpandRatio(sp, 1.0f); titleHL.addComponent(howToWinActionButt); howToWinActionButt.setDescription(howWinAction_tt); AbsoluteLayout absL = new AbsoluteLayout(); addComponent(absL); absL.setWidth(APPLICATION_SCREEN_WIDTH); absL.setHeight(ACTIONDASHBOARD_H); MediaLocator medLoc = Mmowgli2UI.getGlobals().getMediaLocator(); AbsoluteLayout mainAbsLay = new AbsoluteLayout(); // offset it from master mainAbsLay.setWidth(APPLICATION_SCREEN_WIDTH); mainAbsLay.setHeight(ACTIONDASHBOARD_H); absL.addComponent(mainAbsLay, ACTIONDASHBOARD_OFFSET_POS); // Now the background Embedded backgroundImage = new Embedded(null, medLoc.getActionDashboardPlanBackground()); backgroundImage.setWidth(ACTIONDASHBOARD_W); backgroundImage.setHeight(ACTIONDASHBOARD_H); mainAbsLay.addComponent(backgroundImage, "top:0px;left:0px"); HorizontalLayout tabsHL = new HorizontalLayout(); tabsHL.setStyleName("m-actionDashboardBlackTabs"); tabsHL.setSpacing(false); tabsHL.addComponent(sp = new Label()); sp.setWidth("12px"); TabClickHandler tabHndlr = new TabClickHandler(); actionPlansTabButt.setStyleName("m-actionDashboardActionPlansTab"); actionPlansTabButt.addClickListener(tabHndlr); actionPlansTabButt.setId(ACTION_DASHBOARD_ACTION_PLANS_TAB); tabsHL.addComponent(actionPlansTabButt); tabsHL.addComponent(sp = new Label()); sp.setWidth("1px"); myPlansTabButt.setStyleName("m-actionDashboardMyPlansTab"); myPlansTabButt.addClickListener(tabHndlr); myPlansTabButt.setId(ACTION_DASHBOARD_MY_ACTION_PLANS_TAB); tabsHL.addComponent(myPlansTabButt); myPlansTabButt.addStyleName("m-transparent-background"); // initially tabsHL.addComponent(sp = new Label()); sp.setWidth("1px"); needAuthorsTabButt.setStyleName("m-actionDashboardNeedAuthorsTab"); needAuthorsTabButt.addClickListener(tabHndlr); needAuthorsTabButt.setId(ACTION_DASHBOARD_NEED_AUTHORS_TAB); tabsHL.addComponent(needAuthorsTabButt); needAuthorsTabButt.addStyleName("m-transparent-background"); // initially absL.addComponent(tabsHL, "left:7px;top:8px"); // stack the pages absL.addComponent(actionPlansTab, ACTIONDASHBOARD_TABCONTENT_POS); actionPlansTab.initGuiTL(); absL.addComponent(myPlansTab, ACTIONDASHBOARD_TABCONTENT_POS); myPlansTab.initGuiTL(); myPlansTab.setVisible(false); absL.addComponent(needAuthorsTab, ACTIONDASHBOARD_TABCONTENT_POS); needAuthorsTab.initGuiTL(); needAuthorsTab.setVisible(false); User me = Mmowgli2UI.getGlobals().getUserTL(); Set<ActionPlan> invitedSet = me.getActionPlansInvited(); if (invitedSet != null && (invitedSet.size()) > 0) { Notification note = new Notification("<center>You're invited to an Action Plan!</center>", "<center> Look for the \"you're invited to join!\" notice.<br/>" + "First, check out the plan. Then, if you want to join,<br/>" + "click the link to become an author." + "</center>", Type.HUMANIZED_MESSAGE, true); // allow html note.setPosition(Position.MIDDLE_CENTER); note.setDelayMsec(5000);// 5 secs note.show(Page.getCurrent()); } }
From source file:edu.nps.moves.mmowgli.signupServer.SignupServer.java
License:Open Source License
private void doRedirNotification(final String url) { Notification notif = new Notification("<center>Welcome to MMOWGLI!<center>", "<br/><center>We're taking you directly to the game.<center>", Notification.Type.HUMANIZED_MESSAGE); notif.setDelayMsec(5000);/*from ww w .j av a 2s . c o m*/ notif.setPosition(Position.MIDDLE_CENTER); notif.setHtmlContentAllowed(true); notif.setStyleName("m-green-notification"); notif.show(Page.getCurrent()); Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { UI.getCurrent().access(new Runnable() { @Override public void run() { quitUIAndGoTo(url); } }); } }, 4000); }
From source file:fr.univlorraine.mondossierweb.MdwTouchkitUI.java
License:Apache License
/** * Affiche du message d'intro// w w w. ja v a 2 s. com */ private void afficherMessageIntro(String text) { Notification note = new Notification(text, "", Notification.TYPE_TRAY_NOTIFICATION, true); note.setPosition(Position.MIDDLE_CENTER); note.setDelayMsec(6000); note.show(this.getPage()); /** * ANCIENNE VERSION AVEC POPUP WINDOW */ /* //Recuperer dans la base si l'utilisateur a une prfrence pour l'affichage le message String val = userController.getPreference(Utils.SHOW_MESSAGE_INTRO_MOBILE_PREFERENCE); //Par dfaut on affiche le message boolean afficherMessage = true; //Si on a une prfrence pour l'utilisateur en ce qui concerne l'affichage du message d'accueil mobile if(StringUtils.hasText(val)){ //On rcupre ce choix dans afficherMessage afficherMessage = Boolean.valueOf(val); } //Si on doit afficher le message if(afficherMessage){ //Cration de la pop-pup contenant le message HelpMobileWindow hbw = new HelpMobileWindow(text,applicationContext.getMessage("helpWindow.defaultTitle", null, getLocale()),true); //Sur la fermeture de la fentre hbw.addCloseListener(g->{ //On va enregistrer en base que l'utilisateur ne souhaite plus afficher le message si la checkbox propose par la pop-up a t coche boolean choix = hbw.getCheckBox().getValue(); //Test si l'utilisateur a coch la case pour ne plus afficher le message if(choix){ //mettre a jour dans la base de donnes userController.updatePreference(Utils.SHOW_MESSAGE_INTRO_MOBILE_PREFERENCE, "false"); } }); //Affichage de la pop_up UI.getCurrent().addWindow(hbw); } */ }
From source file:fr.univlorraine.mondossierweb.MdwTouchkitUI.java
License:Apache License
/** * Cration du menu tudiant//from ww w .ja v a2 s .c om */ private void initMenuEtudiant() { //Si le menuEtudiant n'a jamais t initialis if (menuEtudiant == null) { //On cr le menuEtudiant menuEtudiant = new TabBarView(); } //Cration de l'onglet Informations tabInfoAnnuelles = menuEtudiant.addTab(informationsAnnuellesMobileView, applicationContext.getMessage("mobileUI.infoannuelles.title", null, getLocale()), FontAwesome.INFO); tabInfoAnnuelles.setId("tabInfoAnnuelles"); //Cration de l'onglet Calendrier tabCalendrier = menuEtudiant.addTab(calendrierMobileView, applicationContext.getMessage("mobileUI.calendrier.title", null, getLocale()), FontAwesome.CALENDAR); tabCalendrier.setId("tabCalendrier"); //Si le navigationManager des notes est null if (noteNavigationManager == null) { //On cr le navigationManager noteNavigationManager = new NavigationManager(); } //le composant affich dans le navigationManager est la vue des notes noteNavigationManager.setCurrentComponent(notesMobileView); //le composant suivant afficher dans le navigationManager est la vue du dtail des notes noteNavigationManager.setNextComponent(notesDetailMobileView); //Cration de l'onglet Rsultats tabNotes = menuEtudiant.addTab(noteNavigationManager, applicationContext.getMessage("mobileUI.resultats.title", null, getLocale()), FontAwesome.LIST); tabNotes.setId("tabNotes"); //Dtection du retour sur la vue du dtail des notes pour mettre jour le JS menuEtudiant.addListener(new SelectedTabChangeListener() { @Override public void selectedTabChange(SelectedTabChangeEvent event) { //test si on se rend sur la vue des notes if (menuEtudiant.getSelelectedTab().equals(tabNotes)) { //test si on se rend sur le dtail des notes if (noteNavigationManager.getCurrentComponent().equals(notesDetailMobileView)) { //On met jour le JS (qui est normalement perdu, sans explication) notesDetailMobileView.refreshJavascript(); } } //test si on se rend sur la vue calendrier if (menuEtudiant.getSelelectedTab().equals(tabCalendrier)) { /* Message d'info */ if (applicationContext.getMessage(CalendrierMobileView.NAME + ".message.info", null, getLocale()) != null) { Notification note = new Notification(applicationContext .getMessage(CalendrierMobileView.NAME + ".message.info", null, getLocale()), "", Notification.TYPE_TRAY_NOTIFICATION, true); note.setPosition(Position.MIDDLE_CENTER); note.setDelayMsec(6000); note.show(Page.getCurrent()); //Notification.show("", applicationContext.getMessage(CalendrierMobileView.NAME+".message.info", null, getLocale()), Notification.TYPE_TRAY_NOTIFICATION); } } } }); }
From source file:fr.univlorraine.mondossierweb.views.FavorisMobileView.java
License:Apache License
/** * Initialise la vue// ww w .ja v a 2s . co m */ @PostConstruct public void init() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MdwTouchkitUI && userController.isEnseignant()) { removeAllComponents(); /* Style */ setSizeFull(); liste_types_inscrits = new LinkedList<String>(); liste_types_inscrits.add("ELP"); liste_types_inscrits.add("VET"); liste_type_arbo = new LinkedList<String>(); liste_type_arbo.add("CMP"); liste_type_arbo.add("VET"); List<Favoris> lfav = favorisController.getFavoris(); //NAVBAR HorizontalLayout navbar = new HorizontalLayout(); navbar.setSizeFull(); navbar.setHeight("40px"); navbar.setStyleName("navigation-bar"); //Bouton info infoButton = new Button(); infoButton.setIcon(FontAwesome.INFO); infoButton.setStyleName("v-nav-button"); infoButton.addClickListener(e -> { /** * NOUVELLE VERSION */ Notification note = new Notification( applicationContext.getMessage("helpWindowMobile.text.enseignant", null, getLocale()), "", Notification.TYPE_TRAY_NOTIFICATION, true); note.setPosition(Position.MIDDLE_CENTER); note.setDelayMsec(6000); note.show(UI.getCurrent().getPage()); /** * ANCIENNE VERSION */ /* //afficher message HelpMobileWindow hbw = new HelpMobileWindow(applicationContext.getMessage("helpWindowMobile.text.enseignant", null, getLocale()),applicationContext.getMessage("helpWindow.defaultTitle", null, getLocale()),false); UI.getCurrent().addWindow(hbw); */ }); navbar.addComponent(infoButton); navbar.setComponentAlignment(infoButton, Alignment.MIDDLE_LEFT); //Title Label labelFav = new Label(applicationContext.getMessage(NAME + ".title.label", null, getLocale())); labelFav.setStyleName("v-label-navbar"); navbar.addComponent(labelFav); navbar.setComponentAlignment(labelFav, Alignment.MIDDLE_CENTER); //Bouton Search Button searchButton = new Button(); searchButton.setIcon(FontAwesome.SEARCH); searchButton.setStyleName("v-nav-button"); navbar.addComponent(searchButton); navbar.setComponentAlignment(searchButton, Alignment.MIDDLE_RIGHT); searchButton.addClickListener(e -> { ((MdwTouchkitUI) MdwTouchkitUI.getCurrent()).navigateToRecherche(NAME); }); navbar.setExpandRatio(labelFav, 1); addComponent(navbar); VerticalLayout globalLayout = new VerticalLayout(); globalLayout.setSizeFull(); globalLayout.setSpacing(true); globalLayout.setMargin(true); FormLayout labelLayout = new FormLayout(); labelLayout.setSizeFull(); labelLayout.setMargin(false); labelLayout.setSpacing(false); Label infoLabel = new Label(applicationContext.getMessage(NAME + ".info.label", null, getLocale())); infoLabel.setStyleName(ValoTheme.LABEL_SMALL); infoLabel.setIcon(FontAwesome.INFO_CIRCLE); infoLabel.setWidth("100%"); labelLayout.addComponent(infoLabel); globalLayout.addComponent(labelLayout); if (lfav != null && lfav.size() > 0) { if (favorisContientVet(lfav)) { Panel vetPanel = new Panel( applicationContext.getMessage(NAME + ".vetpanel.title", null, getLocale())); vetPanel.setStyleName("centertitle-panel"); vetPanel.addStyleName("v-colored-panel-caption"); vetPanel.setSizeFull(); VerticalLayout vetLayout = new VerticalLayout(); vetLayout.setSizeFull(); vetLayout.setHeight(null); int i = 0; for (Favoris fav : lfav) { if (fav.getId().getTypfav().equals(Utils.VET)) { i++; HorizontalLayout favVetLayout = new HorizontalLayout(); favVetLayout.setSizeFull(); favVetLayout.setMargin(true); favVetLayout.setSpacing(true); favVetLayout.setStyleName("v-layout-multiline"); favVetLayout.setWidth("100%"); favVetLayout.setHeight("100%"); Button codeButton = new Button(fav.getId().getIdfav()); codeButton.setCaption(fav.getId().getIdfav()); Utils.setButtonStyle(codeButton); codeButton.setWidth("90px"); codeButton.addClickListener(e -> { accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav()); }); Button libButton = new Button(favorisController.getLibObjFavori(fav.getId().getTypfav(), fav.getId().getIdfav())); Utils.setButtonStyle(libButton); libButton.setHeight("100%"); libButton.setWidth("100%"); libButton.addClickListener(e -> { accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav()); }); favVetLayout.addComponent(codeButton); //favVetLayout.setComponentAlignment(codeButton, Alignment.MIDDLE_CENTER); favVetLayout.addComponent(libButton); favVetLayout.setComponentAlignment(libButton, Alignment.MIDDLE_CENTER); favVetLayout.setExpandRatio(libButton, 1); vetLayout.addComponent(favVetLayout); if (i > 1) { favVetLayout.addStyleName("line-separator"); } } } vetPanel.setContent(vetLayout); globalLayout.addComponent(vetPanel); } if (favorisContientElp(lfav)) { Panel elpPanel = new Panel( applicationContext.getMessage(NAME + ".elppanel.title", null, getLocale())); elpPanel.setStyleName("centertitle-panel"); elpPanel.addStyleName("v-colored-panel-caption"); elpPanel.setSizeFull(); VerticalLayout elpLayout = new VerticalLayout(); elpLayout.setSizeFull(); elpLayout.setHeight(null); int i = 0; for (Favoris fav : lfav) { if (fav.getId().getTypfav().equals(Utils.ELP)) { i++; HorizontalLayout favElpLayout = new HorizontalLayout(); favElpLayout.setSizeFull(); favElpLayout.setMargin(true); favElpLayout.setSpacing(true); favElpLayout.setStyleName("v-layout-multiline"); favElpLayout.setWidth("100%"); favElpLayout.setHeight("100%"); Button codeButton = new Button(fav.getId().getIdfav()); Utils.setButtonStyle(codeButton); codeButton.setWidth("90px"); codeButton.addClickListener(e -> { accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav()); }); Button libButton = new Button(favorisController.getLibObjFavori(fav.getId().getTypfav(), fav.getId().getIdfav())); Utils.setButtonStyle(libButton); libButton.setHeight("100%"); libButton.setWidth("100%"); libButton.addClickListener(e -> { accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav()); }); favElpLayout.addComponent(codeButton); favElpLayout.addComponent(libButton); favElpLayout.setComponentAlignment(libButton, Alignment.MIDDLE_CENTER); favElpLayout.setExpandRatio(libButton, 1); elpLayout.addComponent(favElpLayout); if (i > 1) { favElpLayout.addStyleName("line-separator"); } } } elpPanel.setContent(elpLayout); globalLayout.addComponent(elpPanel); } } labelAucunFavoriLayout = new HorizontalLayout(); labelAucunFavoriLayout.setMargin(true); labelAucunFavoriLayout.setSizeFull(); Button aucunFavoris = new Button( applicationContext.getMessage(NAME + ".favoris.aucun", null, getLocale())); aucunFavoris.setStyleName("v-nav-button"); aucunFavoris.addStyleName(ValoTheme.BUTTON_LINK); aucunFavoris.addClickListener(e -> { ((MdwTouchkitUI) MdwTouchkitUI.getCurrent()).navigateToRecherche(NAME); }); labelAucunFavoriLayout.addComponent(aucunFavoris); labelAucunFavoriLayout.setVisible(false); globalLayout.addComponent(labelAucunFavoriLayout); if (lfav == null || lfav.size() == 0) { labelAucunFavoriLayout.setVisible(true); } //addComponent(globalLayout); contentLayout.setStyleName("v-scrollableelement"); contentLayout.addComponent(globalLayout); addComponent(contentLayout); setExpandRatio(contentLayout, 1); } }
From source file:org.jumpmind.vaadin.ui.common.CommonUiUtils.java
License:Open Source License
public static void notify(String caption, String message, Throwable ex, Type type) { Page page = Page.getCurrent();/* w ww . j av a 2s . c o m*/ if (page != null) { Notification notification = new Notification(caption, contactWithLineFeed(FormatUtils.wordWrap(message, 150)), Type.HUMANIZED_MESSAGE); notification.setPosition(Position.MIDDLE_CENTER); notification.setDelayMsec(-1); String style = ValoTheme.NOTIFICATION_SUCCESS; if (type == Type.ERROR_MESSAGE) { style = ValoTheme.NOTIFICATION_FAILURE; } else if (type == Type.WARNING_MESSAGE) { style = ValoTheme.NOTIFICATION_WARNING; } notification.setStyleName( notification.getStyleName() + " " + ValoTheme.NOTIFICATION_CLOSABLE + " " + style); notification.show(Page.getCurrent()); } }