List of usage examples for com.vaadin.ui Notification Notification
public Notification(String caption, String description, Type type, boolean htmlContentAllowed)
From source file:fr.univlorraine.mondossierweb.MdwTouchkitUI.java
License:Apache License
/** * Cration du menu tudiant/* ww w .j a v a 2s .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/*from w w w. ja va 2 s . c o 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:me.uni.emuseo.view.categories.CategoryLayout.java
License:Open Source License
private void createTable() { categoryTable = new CategoryTable() { private static final long serialVersionUID = 4201722098147104008L; @Override/*www . ja v a 2s .c o m*/ protected void onEdit(CategoryDTO itemId) { CategoryDTO category = categoryService.getCategory(itemId.getCategoryId()); CategoryPopUpWindow categoryPopUpWidow = new CategoryPopUpWindow(category, "Edytuj kategori") { private static final long serialVersionUID = 3776311059670953584L; @Override protected boolean onSave(CategoryDTO bean) throws InvalidBeanException { categoryService.editCategory(bean); pagedTableLayout.refreshPage(); return true; } }; UI.getCurrent().addWindow(categoryPopUpWidow); } @Override protected void onDelete(final CategoryDTO itemId) { ConfirmationWindow confirmationWindow = new ConfirmationWindow("Usu kategori", "Czy na pewno chcesz usun kategori: " + itemId.getName() + "?") { private static final long serialVersionUID = -39445547305022448L; @Override protected boolean onConfirm() { try { categoryService.deleteCategory(itemId.getCategoryId()); pagedTableLayout.refresh(); return true; } catch (CannotDeleteCategoryException e) { new Notification("Bd", "Nie mona usun kategorii (posiada powizane eksponaty).", Type.ERROR_MESSAGE, true).show(Page.getCurrent()); } return false; } }; UI.getCurrent().addWindow(confirmationWindow); } }; }
From source file:me.uni.emuseo.view.settings.MyAccountView.java
License:Open Source License
public MyAccountView() { authManager = EMuseoUtil.getAppContext().getBean(AuthManager.class); userService = EMuseoUtil.getAppContext().getBean(UserService.class); final Long userId = authManager.getLoggedUserId(); UserDTO user = userService.getUser(userId); FormWithButtonsLayout<UserDTO> formLayout = new FormWithButtonsLayout<UserDTO>(user) { private static final long serialVersionUID = -1826989504302110056L; @Override/*from w w w .ja v a 2 s. c o m*/ protected void onSave(UserDTO bean) { userService.editUser(bean); } @Override protected FormBuilder<UserDTO> buildForm(UserDTO bean) { return new MyAccountFormLayout(bean); } }; ExpandingPanel myAccountPanel = new ExpandingPanel(); myAccountPanel.setCaption("Moje dane"); myAccountPanel.setContent(formLayout); myAccountPanel.setExpanded(true); Button addButton = new Button("Zmie haso"); addButton.setIcon(FontAwesome.LOCK); addButton.addStyleName("emuseo-button-icon"); addButton.addStyleName("emuseo-button-margin"); addButton.setWidth(100, Unit.PERCENTAGE); addComponent(myAccountPanel); addComponent(addButton); // setComponentAlignment(formLayout, Alignment.MIDDLE_CENTER); addButton.addClickListener(new ClickListener() { private static final long serialVersionUID = -263205007196895260L; @Override public void buttonClick(ClickEvent event) { PasswordPopUpWindow exhibitPopUpWidow = new PasswordPopUpWindow("Zmie haso") { private static final long serialVersionUID = 3776311059670953583L; @Override protected boolean onSave(PasswordDTO bean) throws InvalidBeanException { try { userService.changePassword(userId, bean); return true; } catch (PasswordChangeException e) { new Notification("Bd", e.getReason(), Type.ERROR_MESSAGE, true) .show(Page.getCurrent()); } return false; } }; UI.getCurrent().addWindow(exhibitPopUpWidow); } }); }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.component.LoginDialog.java
License:Apache License
private void tryToLogIn() { try {/*from www . ja v a 2s . co m*/ //Throws exception if credentials are wrong. VMUserServer user = new VMUserServer(name.getValue(), password.getValue()); if (menu != null) { if (user.getUserStatusId() != null) { switch (user.getUserStatusId().getId()) { case 1: //Everything OK, fall thru case 2: //TODO: Inactive. Right now no special behavior menu.setUser(user); close(); break; case 3: //Locked new Notification( Lookup.getDefault().lookup(InternationalizationProvider.class) .translate("audit.user.account.lock"), Lookup.getDefault().lookup(InternationalizationProvider.class).translate( "menu.connection.error.user"), Notification.Type.ERROR_MESSAGE, true).show(Page.getCurrent()); clear(); break; case 4: //Password Aged new Notification( Lookup.getDefault().lookup(InternationalizationProvider.class) .translate("user.status.aged"), Lookup.getDefault().lookup(InternationalizationProvider.class) .translate("user.status.aged"), Notification.Type.WARNING_MESSAGE, true).show(Page.getCurrent()); menu.setUser(user); //Open the profile page ((VMUI) UI.getCurrent()).showTab("message.admin.userProfile"); close(); break; default: LOG.log(Level.SEVERE, "Unexpected User Status: {0}", user.getUserStatusId().getId()); Notification.show("Unexpected User Status", "Unexpected User Status: " + user.getUserStatusId().getId() + "\n" + TRANSLATOR.translate("message.db.error"), Notification.Type.ERROR_MESSAGE); menu.setUser(null); close(); break; } } else { new Notification( Lookup.getDefault().lookup(InternationalizationProvider.class) .translate("general.login.invalid.title"), Lookup.getDefault().lookup(InternationalizationProvider.class).translate( "general.login.invalid.message"), Notification.Type.ERROR_MESSAGE, true).show(Page.getCurrent()); clear(); } } } catch (VMException ex) { if (menu != null) { menu.setUser(null); } new Notification( Lookup.getDefault().lookup(InternationalizationProvider.class) .translate("general.login.invalid.title"), Lookup.getDefault().lookup(InternationalizationProvider.class) .translate("general.login.invalid.message"), Notification.Type.WARNING_MESSAGE, true).show(Page.getCurrent()); password.setValue(""); } }
From source file:org.apache.openaz.xacml.admin.view.components.LDAPPIPConfigurationComponent.java
License:Apache License
protected void testLDAPConnection() { Hashtable<String, String> env = new Hashtable<String, String>(); env.put(Context.INITIAL_CONTEXT_FACTORY, this.textFieldFactory.getValue()); env.put(Context.PROVIDER_URL, this.textFieldProviderURL.getValue()); env.put(Context.SECURITY_PRINCIPAL, this.textFieldPrincipal.getValue()); env.put(Context.SECURITY_CREDENTIALS, this.textFieldCredentials.getValue()); String auth = this.comboBoxAuthentication.getValue().toString(); env.put(Context.SECURITY_AUTHENTICATION, auth); ////from w w w. jav a 2s. c o m // Do we need to do anything? // /* if (auth.equals(LDAP_AUTH_ANONYMOUS)) { } else if (auth.equals(LDAP_AUTH_SIMPLE)) { } else if (auth.equals(LDAP_AUTH_SASL)) { } */ DirContext ctx = null; try { ctx = new InitialDirContext(env); new Notification("Success!", "Connection Established!", Type.HUMANIZED_MESSAGE, true) .show(Page.getCurrent()); } catch (NamingException e) { logger.error(e); new Notification("Connection Failed", "<br/>" + e.getLocalizedMessage(), Type.ERROR_MESSAGE, true) .show(Page.getCurrent()); } finally { try { if (ctx != null) { ctx.close(); } } catch (NamingException idontcare) { //NOPMD } } }
From source file:org.apache.openaz.xacml.admin.view.components.SQLPIPConfigurationComponent.java
License:Apache License
protected void testJNDIConnection() { try {//from w w w . j a v a 2 s . c o m Context initialContext = new InitialContext(); DataSource dataSource = (DataSource) initialContext.lookup(this.textFieldDataSource.getValue()); try (Connection connection = dataSource.getConnection()) { new Notification("Success!", "Connection Established!", Type.HUMANIZED_MESSAGE, true) .show(Page.getCurrent()); } } catch (NamingException e) { logger.error(e); new Notification("JNDI Naming Exception", "<br/>" + e.getLocalizedMessage() + "<br/>Is the context defined in this J2EE Container instance?", Type.ERROR_MESSAGE, true).show(Page.getCurrent()); } catch (SQLException e) { logger.error(e); new Notification("SQL Exception", "<br/>" + e.getLocalizedMessage() + "<br/>Are the configuration parameters correct?", Type.ERROR_MESSAGE, true).show(Page.getCurrent()); } }
From source file:org.apache.openaz.xacml.admin.view.components.SQLPIPConfigurationComponent.java
License:Apache License
protected void testJDBCConnection() { try {//from ww w . j a va 2 s . c o m if (this.comboBoxSQLDriver.getValue() != null) { Class.forName(this.comboBoxSQLDriver.getValue().toString()); } else { throw new ClassNotFoundException("Please select a JDBC driver to load."); } } catch (ClassNotFoundException e) { logger.error(e); new Notification("Driver Exception", "<br/>" + e.getLocalizedMessage() + "<br/>Is the JDBC driver's jar in the J2EE container path?", Type.ERROR_MESSAGE, true).show(Page.getCurrent()); return; } Connection connection = null; try { connection = DriverManager.getConnection(this.textFieldConnectionURL.getValue(), this.textFieldUser.getValue(), this.textFieldPassword.getValue()); new Notification("Success!", "Connection Established!", Type.HUMANIZED_MESSAGE, true) .show(Page.getCurrent()); } catch (SQLException e) { logger.error(e); new Notification("SQL Exception", "<br/>" + e.getLocalizedMessage() + "<br/>Are the configuration parameters correct?", Type.ERROR_MESSAGE, true).show(Page.getCurrent()); } finally { if (connection != null) { try { connection.close(); } catch (SQLException idontcare) { //NOPMD } } } }
From source file:org.eclipse.hawkbit.ui.ErrorView.java
License:Open Source License
@Override public void enter(final ViewChangeListener.ViewChangeEvent event) { final DashboardMenuItem view = dashboardMenu.getByViewName(event.getViewName()); if (view == null) { message.setValue(i18n.getMessage("message.error.view", event.getViewName())); return;// w w w.ja v a 2s. co m } if (dashboardMenu.isAccessDenied(event.getViewName())) { final Notification nt = new Notification("Access denied", i18n.getMessage("message.accessdenied.view", event.getViewName()), Type.ERROR_MESSAGE, false); nt.setStyleName(SPUIStyleDefinitions.SP_NOTIFICATION_ERROR_MESSAGE_STYLE); nt.setPosition(Position.BOTTOM_RIGHT); nt.show(UI.getCurrent().getPage()); message.setValue(i18n.getMessage("message.accessdenied.view", event.getViewName())); } }
From source file:org.hip.vif.admin.admin.ui.ReindexView.java
License:Open Source License
/** Constructor * * @param inTask {@link RefreshIndexTask} */ public ReindexView(final RefreshIndexTask inTask) { super();/*from ww w . j a v a2 s . com*/ final IMessages lMessages = Activator.getMessages(); final VerticalLayout lLayout = initLayout(lMessages, "admin.reindex.title.page"); //$NON-NLS-1$ final CheckBox lContentIndex = createCheckbox(lMessages.getMessage("admin.reindex.check.content"), //$NON-NLS-1$ Constants.INDEX_CONTENT); lContentIndex.focus(); lLayout.addComponent(lContentIndex); lLayout.addComponent( new Label(String.format(FORMAT_LABEL, lMessages.getMessage("admin.reindex.label.content")), //$NON-NLS-1$ ContentMode.HTML)); final CheckBox lPersonIndex = createCheckbox(lMessages.getMessage("admin.reindex.check.person"), //$NON-NLS-1$ Constants.INDEX_MEMBER); lLayout.addComponent(lPersonIndex); lLayout.addComponent(new Label( String.format(FORMAT_LABEL, lMessages.getMessage("admin.reindex.label.person")), ContentMode.HTML)); //$NON-NLS-1$ lLayout.addComponent(RiplaViewHelper.createSpacer()); reindex = new Button(lMessages.getMessage("admin.reindex.button.start")); //$NON-NLS-1$ reindex.setClickShortcut(KeyCode.ENTER); reindex.setEnabled(false); reindex.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { // NOPMD try { final String lFeedback = inTask.reindex(checkBoxes); new Notification(lMessages.getMessage("admin.reindex.check.content"), lFeedback, Type.TRAY_NOTIFICATION, true).show(Page.getCurrent()); } catch (final Exception exc) { // NOPMD LOG.error("Error encountered during search index refresh!", exc); Notification.show(lMessages.getMessage("errmsg.reindex"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } }); lLayout.addComponent(reindex); }