Package com.vaadin.ui.Window

Examples of com.vaadin.ui.Window.Notification


                }

                m_artifactsPanel.setValue(selection);

                // Notify the user what the overall status was...
                Notification notification = createNotification(failedMsg, successMsg);
                getMainWindow().showNotification(notification);

                m_progress.setStyleName("invisible");
                m_statusLine.setStatus(notification.getCaption() + "...");
            }

            @Override
            protected void uploadStarted(UploadHandle upload) {
                m_progress.setStyleName("visible");
                m_progress.setValue(new Float(0.0f));

                m_statusLine.setStatus("Upload of '%s' started...", upload.getFilename());
            }

            private void appendFailure(StringBuilder sb, UploadHandle handle) {
                appendFailure(sb, handle, handle.getFailureReason());
            }

            private void appendFailure(StringBuilder sb, UploadHandle handle, Exception cause) {
                sb.append("<li>'").append(handle.getFile().getName()).append("': failed");
                if (cause != null) {
                    sb.append(", possible reason:<br/>").append(cause.getMessage());
                }
                sb.append("</li>");
            }

            private void appendFailureExists(StringBuilder sb, UploadHandle handle) {
                sb.append("<li>'").append(handle.getFile().getName()).append("': already exists in repository</li>");
            }

            private void appendSuccess(StringBuilder sb, UploadHandle handle) {
                sb.append("<li>'").append(handle.getFile().getName()).append("': added to repository</li>");
            }

            private Notification createNotification(StringBuilder failedMsg, StringBuilder successMsg) {
                String caption = "Upload completed";
                int delay = 500; // msec.
                StringBuilder notification = new StringBuilder();
                if (failedMsg.length() > 0) {
                    caption = "Upload completed with failures";
                    delay = -1;
                    notification.append("<ul>").append(failedMsg).append("</ul>");
                }
                if (successMsg.length() > 0) {
                    notification.append("<ul>").append(successMsg).append("</ul>");
                }
                if (delay < 0) {
                    notification.append("<p>(click to dismiss this notification).</p>");
                }

                Notification summary = new Notification(caption, notification.toString(), Notification.TYPE_TRAY_NOTIFICATION);
                summary.setDelayMsec(delay);
                return summary;
            }

            private ArtifactObject uploadToOBR(UploadHandle handle) throws IOException {
                return UploadHelper.importRemoteBundle(m_artifactRepository, handle.getFile());
View Full Code Here


            "<br/>" + exception.getMessage(),
            Notification.TYPE_ERROR_MESSAGE);
  }
 
  public void showWarningNotification(String captionKey, String descriptionKey) {
    Notification notification = new Notification(i18nManager.getMessage(captionKey),
            i18nManager.getMessage(descriptionKey),
            Notification.TYPE_WARNING_MESSAGE);
    notification.setDelayMsec(-1); // click to hide
    mainWindow.showNotification(notification);
  }
View Full Code Here

    notification.setDelayMsec(-1); // click to hide
    mainWindow.showNotification(notification);
  }
 
  public void showWarningNotification(String captionKey, String descriptionKey, Object ... params) {
    Notification notification = new Notification(i18nManager.getMessage(captionKey) + "<br/>",
            MessageFormat.format(i18nManager.getMessage(descriptionKey), params),
            Notification.TYPE_WARNING_MESSAGE);
    notification.setDelayMsec(5000); // click to hide
    mainWindow.showNotification(notification);
  }
View Full Code Here

        }
        return hl;
    }

    public static Notification validationNotification(String caption, String description) {
        Notification notification = new Notification(caption, description, Notification.TYPE_ERROR_MESSAGE);
        notification.setStyleName("invalid");
        return notification;
    }
View Full Code Here

    public static void informationNotification(Application application, String message) {
        informationNotification(application, message, 3000);
    }

    public static void informationNotification(Application application, String message, int delay) {
        Notification notification = new Notification("<b>" + message + "</b>", TYPE_HUMANIZED_MESSAGE);
        notification.setPosition(POSITION_CENTERED);
        notification.setDelayMsec(delay);
        application.getMainWindow().showNotification(notification);
    }
View Full Code Here

        notification.setDelayMsec(delay);
        application.getMainWindow().showNotification(notification);
    }

    public static void validationNotification(Application application, I18NSource messageSource, String errorMessage) {
        Notification notification = new Notification(messageSource.getMessage("process.data.data-error"),
                "<br/>" + errorMessage,
                Notification.TYPE_ERROR_MESSAGE);
        notification.setStyleName("invalid");
        application.getMainWindow().showNotification(notification);
    }
View Full Code Here

    /////////////////////////////////////////////////////
    /////////////////////////////////////////////////////

    public static void errorNotification(Application application, I18NSource messageSource, String message) {
        Notification notification = new Notification(messageSource.getMessage("notification.error"),
                "<br/><b>" + message + "</b>", TYPE_ERROR_MESSAGE);
        notification.setPosition(POSITION_CENTERED);
        notification.setStyleName("error");
        application.getMainWindow().showNotification(notification);
    }
View Full Code Here

        }
        return hl;
    }

    public static Notification validationNotification(String caption, String description) {
        Notification notification = new Notification(caption, description, Notification.TYPE_ERROR_MESSAGE);
        notification.setStyleName("invalid");
        return notification;
    }
View Full Code Here

    public static void informationNotification(Application application, String message) {
        informationNotification(application, message, 3000);
    }

    public static void informationNotification(Application application, String message, int delay) {
        Notification notification = new Notification("<b>" + message + "</b>", TYPE_HUMANIZED_MESSAGE);
        notification.setPosition(POSITION_CENTERED);
        notification.setDelayMsec(delay);
        application.getMainWindow().showNotification(notification);
    }
View Full Code Here

        notification.setDelayMsec(delay);
        application.getMainWindow().showNotification(notification);
    }

    public static void validationNotification(Application application, I18NSource messageSource, String errorMessage) {
        Notification notification = new Notification(messageSource.getMessage("process.data.data-error"),
                "<br/>" + errorMessage,
                Notification.TYPE_ERROR_MESSAGE);
        notification.setStyleName("invalid");
        application.getMainWindow().showNotification(notification);
    }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.Window.Notification

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.