List of usage examples for com.vaadin.ui Notification setDelayMsec
public void setDelayMsec(int delayMsec)
From source file:org.groom.shell.Shell.java
License:Apache License
/** * Executes requested shell command.//from w w w .j av a 2 s. c o m * * @param cmd the shell command to execute */ public static String execute(final String cmd, final String path) { LOGGER.debug("Executing shell command: " + cmd); try { if (UI.getCurrent() != null) { Notification.show(cmd, Notification.Type.TRAY_NOTIFICATION); } List<String> commands = new ArrayList<String>(); if (PropertiesUtil.getProperty("groom", "os").equals("windows")) { commands.add("cmd"); commands.add("/c"); commands.add(cmd); } else { commands.add("/bin/sh"); commands.add("-c"); commands.add(cmd); } SystemCommandExecutor commandExecutor = new SystemCommandExecutor(path, commands); commandExecutor.executeCommand(); StringBuilder errorOutput = commandExecutor.getErrorOutput(); if (errorOutput.length() > 0) { LOGGER.error(errorOutput); { if (UI.getCurrent() != null) { final Notification notification = new Notification("Shell", errorOutput.toString(), Notification.Type.WARNING_MESSAGE); notification.setDelayMsec(5000); notification.setPosition(Position.BOTTOM_RIGHT); notification.show(Page.getCurrent()); } } } StringBuilder standardOutput = commandExecutor.getStandardOutput(); if (standardOutput == null) { return ""; } return standardOutput.toString(); } catch (final Throwable t) { LOGGER.error("Error executing shell command: " + cmd, t); return ""; } }
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();/*from www .j av a 2 s .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()); } }
From source file:org.opencms.ui.apps.CmsAppWorkplaceUi.java
License:Open Source License
/** * Checks for new broadcasts.<p>/*w w w .ja v a 2 s . c om*/ */ public void checkBroadcasts() { CmsSessionInfo info = OpenCms.getSessionManager().getSessionInfo(getHttpSession()); Buffer queue = info.getBroadcastQueue(); if (!queue.isEmpty()) { StringBuffer broadcasts = new StringBuffer(); while (!queue.isEmpty()) { CmsBroadcast broadcastMessage = (CmsBroadcast) queue.remove(); String from = broadcastMessage.getUser() != null ? broadcastMessage.getUser().getName() : CmsVaadinUtils .getMessageText(org.opencms.workplace.Messages.GUI_LABEL_BROADCAST_FROM_SYSTEM_0); String date = CmsVaadinUtils.getWpMessagesForCurrentLocale() .getDateTime(broadcastMessage.getSendTime()); String content = broadcastMessage.getMessage(); content = content.replaceAll("\\n", "<br />"); broadcasts.append("<p><em>").append(date).append("</em><br />"); broadcasts .append(CmsVaadinUtils .getMessageText(org.opencms.workplace.Messages.GUI_LABEL_BROADCASTMESSAGEFROM_0)) .append(" <b>").append(from).append("</b>:</p><p>"); broadcasts.append(content).append("<br /></p>"); } Notification notification = new Notification( CmsVaadinUtils.getMessageText(Messages.GUI_BROADCAST_TITLE_0), broadcasts.toString(), Type.WARNING_MESSAGE, true); notification.setDelayMsec(-1); notification.show(getPage()); } }
From source file:org.opencms.ui.editors.messagebundle.CmsMessageBundleEditor.java
License:Open Source License
/** * @see org.opencms.ui.editors.messagebundle.CmsMessageBundleEditorTypes.I_OptionListener#handleLanguageChange(java.util.Locale) *///from w w w. j a v a 2 s .c om public void handleLanguageChange(final Locale locale) { if (!locale.equals(m_model.getLocale())) { Object sortProperty = m_table.getSortContainerPropertyId(); boolean isAcending = m_table.isSortAscending(); Map<Object, Object> filters = getFilters(); m_table.clearFilters(); if (m_model.setLocale(locale)) { m_options.setEditedFilePath(m_model.getEditedFilePath()); m_table.sort(new Object[] { sortProperty }, new boolean[] { isAcending }); } else { String caption = m_messages .key(Messages.GUI_NOTIFICATION_MESSAGEBUNDLEEDITOR_LOCALE_SWITCHING_FAILED_CAPTION_0); String description = m_messages .key(Messages.GUI_NOTIFICATION_MESSAGEBUNDLEEDITOR_LOCALE_SWITCHING_FAILED_DESCRIPTION_0); Notification warning = new Notification(caption, description, Type.WARNING_MESSAGE, true); warning.setDelayMsec(-1); warning.show(UI.getCurrent().getPage()); m_options.setLanguage(m_model.getLocale()); } setFilters(filters); m_table.select(m_table.getCurrentPageFirstItemId()); } }
From source file:org.opencms.ui.editors.messagebundle.CmsMessageBundleEditorTypes.java
License:Open Source License
/** * Displays a localized warning.//from w w w . j av a2 s. c om * @param caption the caption of the warning. * @param description the description of the warning. */ static void showWarning(final String caption, final String description) { Notification warning = new Notification(caption, description, Type.WARNING_MESSAGE, true); warning.setDelayMsec(-1); warning.show(UI.getCurrent().getPage()); }
From source file:org.opennms.features.vaadin.jmxconfiggenerator.ui.UIHelper.java
License:Open Source License
public static void showNotification(String title, String message, Type type, int delayMsec) { Notification notification = new Notification(title, message, type, true); notification.setDelayMsec(delayMsec); notification.show(Page.getCurrent()); }
From source file:org.opennms.features.vaadin.surveillanceviews.ui.SurveillanceViewsConfigUI.java
License:Open Source License
/** * Method for displaying notification for the user. * * @param message the message to be displayed * @param description the description of this message * @param type the type of this notification *///from ww w .ja va2 s . c o m public void notifyMessage(String message, String description, Notification.Type type) { Notification m_notification = new Notification("Message", type); m_notification.setCaption(message); m_notification.setDescription(description); m_notification.setDelayMsec(1000); if (getUI() != null) { if (getPage() != null) { m_notification.show(getUI().getPage()); } } }
From source file:org.s23m.cell.editor.semanticdomain.ui.components.ContainmentTreePanel.java
License:Mozilla Public License
private void showNotification(final String caption, final String description, final int timeDelay) { final Notification note = new Notification(caption, description); note.setDelayMsec(timeDelay); application.getMainWindow().showNotification(note); }
From source file:ru.inovus.ui.SignInUI.java
License:Apache License
private void notification() { Notification notification = new Notification("!"); notification.setDescription(// w ww. j a v a 2 s . co m "<span> ?? ? <b>User</b> <b>password</b>.</span>"); notification.setHtmlContentAllowed(true); notification.setStyleName("tray dark small closable login-help"); notification.setPosition(Position.BOTTOM_CENTER); notification.setDelayMsec(20000); notification.show(Page.getCurrent()); }
From source file:uicomponents.LigandExtractPanel.java
License:Open Source License
public boolean isValid() { boolean res = true; String error = ""; for (Iterator i = extractionExperiments.getItemIds().iterator(); i.hasNext();) { // Get the current item identifier, which is an integer. int iid = (Integer) i.next(); // Now get the actual item from the table. Item item = extractionExperiments.getItem(iid); TextField mass = (TextField) item.getItemProperty("Mass [mg]").getValue(); try {/*ww w .ja v a2 s .c o m*/ Integer.parseInt(mass.getValue()); } catch (NumberFormatException e) { res = false; error = "Sample mass has to be a number!"; } DateField d = (DateField) item.getItemProperty("Date").getValue(); if (d.getValue() == null) { error = "Please select preparation dates for all samples!"; } ComboBox ab1 = (ComboBox) item.getItemProperty("Antibody 1").getValue(); TextField mass1 = (TextField) item.getItemProperty("Mass 1 [mg]").getValue(); ComboBox ab2 = (ComboBox) item.getItemProperty("Antibody 2").getValue(); TextField mass2 = (TextField) item.getItemProperty("Mass 2 [mg]").getValue(); ComboBox ab3 = (ComboBox) item.getItemProperty("Antibody 3").getValue(); TextField mass3 = (TextField) item.getItemProperty("Mass 3 [mg]").getValue(); String antibodyError = "Please choose at least one antibody and fill in the mass."; if (ab1.getValue() != null && !mass1.getValue().isEmpty()) { try { Integer.parseInt(mass.getValue()); } catch (NumberFormatException e) { res = false; error = "Antibody 1 mass has to be a number!"; } } else { res = false; error = antibodyError; } if (ab2.getValue() != null && !mass2.getValue().isEmpty()) { try { Integer.parseInt(mass.getValue()); } catch (NumberFormatException e) { res = false; error = "Antibody 2 mass has to be a number!"; } } if (ab3.getValue() != null && !mass3.getValue().isEmpty()) { try { Integer.parseInt(mass.getValue()); } catch (NumberFormatException e) { res = false; error = "Antibody 3 mass has to be a number!"; } } } if (!res) { Notification n = new Notification(error); n.setStyleName(ValoTheme.NOTIFICATION_CLOSABLE); n.setDelayMsec(-1); n.show(UI.getCurrent().getPage()); return false; } else return true; }