當前位置: 首頁>>代碼示例>>Java>>正文


Java UI.access方法代碼示例

本文整理匯總了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();
	}		
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:22,代碼來源:OnDemandFileDownloader.java

示例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();
	}		
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:23,代碼來源:OnDemandPdfBrowserOpener.java

示例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("/");
            		});
	}
            }
        }
    }
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:19,代碼來源:UiListenerDelegate.java

示例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("/"));
}
     }
 }
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:15,代碼來源:UiServlet.java


注:本文中的com.vaadin.ui.UI.access方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。