本文整理汇总了Java中com.vaadin.ui.UIDetachedException类的典型用法代码示例。如果您正苦于以下问题:Java UIDetachedException类的具体用法?Java UIDetachedException怎么用?Java UIDetachedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIDetachedException类属于com.vaadin.ui包,在下文中一共展示了UIDetachedException类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateUI
import com.vaadin.ui.UIDetachedException; //导入依赖的package包/类
/**
* Thread safe UI updates
*
* Execute UI changes in a runnable after attaining the applications's lock.
* Runnable won't be run, if the view isn't anymore active.
*
* Make sure this method won't get called before the UI is ready. In
* practice the easiest way to ensure this is to start data queries only
* after the UI is initialized and visible.
*
* @param runnable
*/
public void updateUI(Runnable runnable) {
try {
ui.access(runnable);
// this is needed, because the ChipsterAdminUI is configured
// for manual push
ui.accessSynchronously(new Runnable() {
public void run() {
ui.push();
}
});
} catch (UIDetachedException e) {
// user reloaded the page during the update
}
}
示例2: configError
import com.vaadin.ui.UIDetachedException; //导入依赖的package包/类
/**
* Configure la gestion des erreurs
*/
private void configError(){
/* Log les erreurs non gerees */
VaadinSession.getCurrent().setErrorHandler(e -> {
Throwable cause = e.getThrowable();
while (cause instanceof Throwable) {
/* Gère les accès non autorisés */
if (cause instanceof AccessDeniedException) {
navigateToView(ErreurView.NAME);
return;
}
/* Gère les UIs détachées pour les utilisateurs déconnectés */
if (cause instanceof AuthenticationCredentialsNotFoundException || cause instanceof UIDetachedException
|| cause instanceof UploadException || cause instanceof IllegalStateException
|| cause instanceof SocketTimeoutException
|| MethodUtils.checkCause(cause,"SocketTimeoutException")
|| MethodUtils.checkCause(cause,"ClientAbortException")
|| cause instanceof EOFException
|| cause instanceof URISyntaxException
|| cause instanceof UIException) {
sendError();
cause.printStackTrace();
return;
}
if (MethodUtils.checkCauseByStackTrace(cause,"FileUploadHandler", 0)
||
MethodUtils.checkCauseByStackTrace(cause,"OnDemandPdfBrowserOpener", 1)
||
MethodUtils.checkCauseByStackTrace(cause,"DownloadStream", 3)
||
MethodUtils.checkCauseByStackTrace(cause,"AtmosphereRequest", 7)
||
MethodUtils.checkCauseByStackTrace(cause,"AbstractTextField", 0)
||
MethodUtils.checkCauseByStackTrace(cause,"SocketChannelImpl", 4)
||
MethodUtils.checkCauseEmpty(cause)
){
sendError();
cause.printStackTrace();
return;
}
cause = cause.getCause();
}
sendError();
logger.error("Erreur inconnue", e.getThrowable());
});
}