com.vaadin.server.ErrorHandler Java Examples

The following examples show how to use com.vaadin.server.ErrorHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArtifactDetailsLayout.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private Button getArtifactDownloadButton(final Table table, final Object itemId) {
    final String fileName = (String) table.getContainerDataSource().getItem(itemId)
            .getItemProperty(PROVIDED_FILE_NAME).getValue();
    final Button downloadIcon = SPUIComponentProvider.getButton(
            fileName + "-" + UIComponentIdProvider.ARTIFACT_FILE_DOWNLOAD_ICON, "",
            i18n.getMessage(UIMessageIdProvider.TOOLTIP_ARTIFACT_DOWNLOAD), ValoTheme.BUTTON_TINY + " " + "blueicon", 
            true, FontAwesome.DOWNLOAD, SPUIButtonStyleNoBorder.class);
    downloadIcon.setData(itemId);
    FileDownloader fileDownloader = new FileDownloader(createStreamResource((Long) itemId));
    fileDownloader.extend(downloadIcon);
    fileDownloader.setErrorHandler(new ErrorHandler() {

        /**
         * Error handler for file downloader
         */
        private static final long serialVersionUID = 4030230501114422570L;

        @Override
        public void error(com.vaadin.server.ErrorEvent event) {
            uINotification.displayValidationError(i18n.getMessage(UIMessageIdProvider.ARTIFACT_DOWNLOAD_FAILURE_MSG));
        }
    });
    return downloadIcon;
}
 
Example #2
Source File: SockJSPushHandler.java    From vertx-vaadin with MIT License 5 votes vote down vote up
/**
 * Call the session's {@link ErrorHandler}, if it has one, with the given
 * exception wrapped in an {@link ErrorEvent}.
 */
private void callErrorHandler(VaadinSession session, Exception e) {
    try {
        ErrorHandler errorHandler = ErrorEvent.findErrorHandler(session);
        if (errorHandler != null) {
            errorHandler.error(new ErrorEvent(e));
        }
    } catch (Exception ex) {
        // Let's not allow error handling to cause trouble; log fails
        logger.warn("ErrorHandler call failed", ex);
    }
}