当前位置: 首页>>代码示例>>Java>>正文


Java DefaultErrorHandler类代码示例

本文整理汇总了Java中com.vaadin.server.DefaultErrorHandler的典型用法代码示例。如果您正苦于以下问题:Java DefaultErrorHandler类的具体用法?Java DefaultErrorHandler怎么用?Java DefaultErrorHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DefaultErrorHandler类属于com.vaadin.server包,在下文中一共展示了DefaultErrorHandler类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: error

import com.vaadin.server.DefaultErrorHandler; //导入依赖的package包/类
@Override
public final void error(final ErrorEvent event)
{
	//
	// Extract the relevant exception
	Throwable t = event.getThrowable();
	if (t instanceof SocketException)
	{
		// Most likely client browser closed socket
		logger.info("SocketException in CommunicationManager. Most likely client (browser) closed socket.");
		return;
	}
	t = DefaultErrorHandler.findRelevantThrowable(t);

	//
	// Create error message
	final ErrorMessage errorMessage = createErrorMessage(t);

	//
	// Display it
	displayError(errorMessage, event);

	// also print the error on console
	logger.error("", t);
}
 
开发者ID:metasfresh,项目名称:metasfresh-procurement-webui,代码行数:26,代码来源:AbstractErrorHandler.java

示例2: handle

import com.vaadin.server.DefaultErrorHandler; //导入依赖的package包/类
@Override
public boolean handle(ErrorEvent event, App app) {
    boolean handled = super.handle(event, app);

    //noinspection ThrowableResultOfMethodCallIgnored
    if (handled && event.getThrowable() != null) {
        // Finds the original source of the error/exception
        AbstractComponent component = DefaultErrorHandler.findAbstractComponent(event);
        if (component != null) {
            component.markAsDirty();
        }

        if (component instanceof Component.Focusable) {
            ((Component.Focusable) component).focus();
        }

        //noinspection ThrowableResultOfMethodCallIgnored
        if (event.getThrowable() instanceof Validator.InvalidValueException) {
            app.getAppUI().discardAccumulatedEvents();
        }
    }
    return handled;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:24,代码来源:InvalidValueExceptionHandler.java

示例3: init

import com.vaadin.server.DefaultErrorHandler; //导入依赖的package包/类
@Override
protected void init(VaadinRequest request) {
    getPage().setTitle("Vaadin Managed Security Demo");
    // Let's register a custom error handler to make the 'access denied' messages a bit friendlier.
    setErrorHandler(new DefaultErrorHandler() {
        @Override
        public void error(com.vaadin.server.ErrorEvent event) {
            if (SecurityExceptionUtils.isAccessDeniedException(event.getThrowable())) {
                Notification.show("Sorry, you don't have access to do that.");
            } else {
                super.error(event);
            }
        }
    });
    if (vaadinSecurity.isAuthenticated()) {
        showMainScreen();
    } else {
        showLoginScreen(request.getParameter("goodbye") != null);
    }
}
 
开发者ID:peholmst,项目名称:vaadin4spring,代码行数:21,代码来源:SingleSecuredUI.java

示例4: init

import com.vaadin.server.DefaultErrorHandler; //导入依赖的package包/类
@Override
protected void init(VaadinRequest request) {
    getPage().setTitle("Vaadin Shared Security Demo");
    // Let's register a custom error handler to make the 'access denied' messages a bit friendlier.
    setErrorHandler(new DefaultErrorHandler() {
        @Override
        public void error(com.vaadin.server.ErrorEvent event) {
            if (SecurityExceptionUtils.isAccessDeniedException(event.getThrowable())) {
                Notification.show("Sorry, you don't have access to do that.");
            } else {
                super.error(event);
            }
        }
    });
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSizeFull();

    // By adding a security item filter, only views that are accessible to the user will show up in the side bar.
    sideBar.setItemFilter(new VaadinSecurityItemFilter(vaadinSecurity));
    layout.addComponent(sideBar);

    CssLayout viewContainer = new CssLayout();
    viewContainer.setSizeFull();
    layout.addComponent(viewContainer);
    layout.setExpandRatio(viewContainer, 1f);

    Navigator navigator = new Navigator(this, viewContainer);
    // Without an AccessDeniedView, the view provider would act like the restricted views did not exist at all.
    springViewProvider.setAccessDeniedViewClass(AccessDeniedView.class);
    navigator.addProvider(springViewProvider);
    navigator.setErrorView(ErrorView.class);
    navigator.navigateTo(navigator.getState());

    setContent(layout); // Call this here because the Navigator must have been configured before the Side Bar can be attached to a UI.
}
 
开发者ID:peholmst,项目名称:vaadin4spring,代码行数:36,代码来源:MainUI.java

示例5: ErrorWindow

import com.vaadin.server.DefaultErrorHandler; //导入依赖的package包/类
public ErrorWindow()
{
	// Configure the error handler for the UI
	UI.getCurrent().setErrorHandler(new DefaultErrorHandler()
	{
		private static final long serialVersionUID = 1L;

		@Override
		public void error(com.vaadin.server.ErrorEvent event)
		{
			new ErrorWindow(true).internalShowErrorWindow(event.getThrowable());
		}

	});
}
 
开发者ID:rlsutton1,项目名称:VaadinUtils,代码行数:16,代码来源:ErrorWindow.java

示例6: init

import com.vaadin.server.DefaultErrorHandler; //导入依赖的package包/类
@Override
protected void init(VaadinRequest request) {
	getUI().setLocale(BBPlay.getLanguage(request.getLocale().getLanguage()));
	I18n.init(i18n);
	getPage().setTitle("BBPlay");
	setErrorHandler(new DefaultErrorHandler() {
		private static final long serialVersionUID = -18984634551415736L;

		@Override
		public void error(com.vaadin.server.ErrorEvent event) {
			if (SecurityExceptionUtils.isAccessDeniedException(event.getThrowable())) {
				BBPlay.error(I18n.t("error.noAccess", "MainUI"));
			} else {
				super.error(event);
			}
		}
	});
	VerticalLayout layout = new VerticalLayout();
	layout.setSizeFull();

	HorizontalLayout horizontalLayout = new HorizontalLayout();
	horizontalLayout.setSizeFull();
	layout.addComponent(horizontalLayout);
	layout.setExpandRatio(horizontalLayout, 1f);

	sideBar.setItemFilter(new VaadinSecurityItemFilter(vaadinSecurity));
	horizontalLayout.addComponent(sideBar);

	CssLayout viewContainer = new CssLayout();
	viewContainer.setSizeFull();
	viewContainer.addStyleName("scrollable-y");
	horizontalLayout.addComponent(viewContainer);
	horizontalLayout.setExpandRatio(viewContainer, 1f);

	Navigator navigator = new Navigator(this, viewContainer);
	springViewProvider.setAccessDeniedViewClass(AccessDeniedView.class);
	navigator.addProvider(springViewProvider);
	navigator.setErrorView(NavigatorErrorView.class);

	Footer footer = new Footer();
	layout.addComponent(footer);
	layout.addComponent(animator = new AnimatorProxy());

	setContent(layout);
}
 
开发者ID:Horuss,项目名称:bbplay,代码行数:46,代码来源:MainUI.java

示例7: init

import com.vaadin.server.DefaultErrorHandler; //导入依赖的package包/类
@Override
protected void init(VaadinRequest request) {
	setLocale(Locale.ENGLISH);
       // Let's register a custom error handler to make the 'access denied' messages a bit friendlier.
       setErrorHandler(new DefaultErrorHandler() {
           @Override
           public void error(com.vaadin.server.ErrorEvent event) {
               if (SecurityExceptionUtils.isAccessDeniedException(event.getThrowable())) {
                   Notification.show("Sorry, you don't have access to do that.");
               } else {
                   super.error(event);
               }
           }
       });
       
	VerticalLayout layout = new VerticalLayout();
	Panel viewContent = new Panel();
	MenuBar menu = new MenuBar();
	menu.addStyleName("navigation-menu");
	
	layout.addComponents(menu, viewContent);
	layout.setSizeFull();
	viewContent.setSizeFull();
	layout.setExpandRatio(viewContent, 1);
	
	menu.addItem("Trading Area", e -> onDashboardClicked());
	menu.addItem("Users", e -> onCustomersClicked());
	
	navigator = new Navigator(this, viewContent);
	springViewProvider.setAccessDeniedViewClass(AccessDeniedView.class);
       navigator.addProvider(springViewProvider);
       navigator.setErrorView(ErrorView.class);
       setContent(layout);
       String state = navigator.getState();
       if(state != null && !state.isEmpty()) {
       	navigator.navigateTo(state);
       }
       else {
       	navigator.navigateTo(TradingAreaView.NAME);
       }
       
}
 
开发者ID:xyfreemind,项目名称:trader,代码行数:43,代码来源:TraderUI.java


注:本文中的com.vaadin.server.DefaultErrorHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。