本文整理汇总了Java中com.vaadin.ui.UI.access方法的典型用法代码示例。如果您正苦于以下问题:Java UI.access方法的具体用法?Java UI.access怎么用?Java UI.access使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.UI
的用法示例。
在下文中一共展示了UI.access方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleConnectorRequest
import com.vaadin.ui.UI; //导入方法依赖的package包/类
@Override
public boolean handleConnectorRequest(VaadinRequest request,
VaadinResponse response, String path) throws IOException {
final BusyIndicatorWindow busyIndicatorWindow = new BusyIndicatorWindow();
final UI ui = UI.getCurrent();
ui.access(() -> ui.addWindow(busyIndicatorWindow));
try {
//on charge le fichier
getStreamSource().loadOndemandFile();
if (getStreamSource().getStream()==null){
return true;
}
getResource().setFilename(getStreamSource().getFileName());
return super.handleConnectorRequest(request, response, path);
}catch(Exception e){
return true;
}
finally {
busyIndicatorWindow.close();
}
}
示例2: handleConnectorRequest
import com.vaadin.ui.UI; //导入方法依赖的package包/类
@Override
public boolean handleConnectorRequest(VaadinRequest request,
VaadinResponse response, String path) throws IOException {
final BusyIndicatorWindow busyIndicatorWindow = new BusyIndicatorWindow();
final UI ui = UI.getCurrent();
ui.access(() -> ui.addWindow(busyIndicatorWindow));
try {
getStreamSource().loadOndemandFile();
if (getStreamSource().getStream()==null){
return true;
}
getDownloadStreamSource().setMIMEType("application/pdf");
getDownloadStreamSource().getStream().setParameter(
"Content-Disposition",
"attachment; filename="+getStreamSource().getFileName());
return super.handleConnectorRequest(request, response, path);
}catch(Exception e){
return true;
}finally {
busyIndicatorWindow.close();
}
}
示例3: closeUserVaadinSessions
import com.vaadin.ui.UI; //导入方法依赖的package包/类
private void closeUserVaadinSessions(String loginName) {
// CopyOnWriteArrayList is thread safe for iteration under update
for (HttpSession session : this.sessions) {
for (VaadinSession vaadinSession : VaadinSession.getAllSessions(session)) {
Object userName = vaadinSession.getAttribute("user");
if (loginName == null || loginName.equals(userName)) {
vaadinSession.close();
// Redirect all UIs to force the close
for (UI ui : vaadinSession.getUIs()) {
ui.access(() -> {
ui.getPage().setLocation("/");
});
}
}
}
}
}
示例4: stop
import com.vaadin.ui.UI; //导入方法依赖的package包/类
@Deactivate
void stop() {
// Terminate Vaadin UI Application
destroy();
for (VaadinSession vaadinSession : sessions) {
vaadinSession.close();
// Redirect all UIs to force the close
for (UI ui : vaadinSession.getUIs()) {
ui.access(() -> ui.getPage().setLocation("/"));
}
}
}