本文整理匯總了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("/"));
}
}
}