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


Java DetachEvent類代碼示例

本文整理匯總了Java中com.vaadin.server.ClientConnector.DetachEvent的典型用法代碼示例。如果您正苦於以下問題:Java DetachEvent類的具體用法?Java DetachEvent怎麽用?Java DetachEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DetachEvent類屬於com.vaadin.server.ClientConnector包,在下文中一共展示了DetachEvent類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import com.vaadin.server.ClientConnector.DetachEvent; //導入依賴的package包/類
@Override
protected void init(VaadinRequest request) {

	setPollInterval(1000);
	hl = new HorizontalSplitPanel();
	hl.setSizeFull();
	setContent(hl);

	buttonsOnTheLeft = new VerticalLayout();
	buttonsOnTheLeft.setSizeUndefined();

	hl.setFirstComponent(buttonsOnTheLeft);
	hl.setSplitPosition(25, Unit.PERCENTAGE);

	ServiceTracker<FragmentFactory, FragmentFactory> tracker = new ServiceTracker<FragmentFactory, FragmentFactory>(
			VaadinActivator.context, FragmentFactory.class, this);
	tracker.open();
	
	addDetachListener(new DetachListener() {
		
		@Override
		public void detach(DetachEvent event) {
			tracker.close();
		}
	});
}
 
開發者ID:vaadin,項目名稱:osgi-bridge-and-fragmentedui-demo,代碼行數:27,代碼來源:VaadinOSGiUI.java

示例2: detach

import com.vaadin.server.ClientConnector.DetachEvent; //導入依賴的package包/類
public synchronized void detach(DetachEvent event) {
	UI ui = (UI) event.getConnector();
	if (log.isDebugEnabled())
		log.debug("UI [" + ui.getUIId() + "] detached, destroying scoped beans");
	
	removeBeans(ui);
	sessions.remove(ui);
	
}
 
開發者ID:chelu,項目名稱:jdal,代碼行數:10,代碼來源:VaadinScope.java

示例3: CollabSketch

import com.vaadin.server.ClientConnector.DetachEvent; //導入依賴的package包/類
public CollabSketch(CollabSketchLineContainer lineContainer, int width, int height) {
	this.lineContainer = lineContainer;
	setImmediate(true);
	getState().canvasWidth = width;
	getState().canvasHeight = height;
	
	String color;
	ui = UI.getCurrent();
	sessionID =  ui.getSession().getSession().getId();
	if (lineContainer.getSessionColors().containsKey(sessionID)) {
		color = lineContainer.getSessionColors().get(sessionID);
	} else {
		int user = this.lineContainer.getListeners().size();
		if (user >= colors.length) {
			color = colors[user % colors.length]; 
		} else {
			color = colors[user];
		}
		lineContainer.getSessionColors().put(sessionID, color.toString());
	}
	
	getState().color = color;
	listener = new CollabSketchUpdateListener(ui) {
			
			@Override
			public void lineAdded(final DrawLine line) {
				listener.getUi().runSafely(new Runnable() {
					
					@Override
					public void run() {
						getRpcProxy(CollabSketchClientRpc.class).drawLine(line); 
					}
				});
			}

			@Override
			public void canvasCleared() {
				listener.getUi().runSafely(new Runnable() {
					
					@Override
					public void run() {
						getRpcProxy(CollabSketchClientRpc.class).clearCanvas(); 
					}
				});
			}
		};
	
	// To receive events from the client, we register ServerRpc
	registerRpc(rpc);
	if (!lineContainer.getLines().isEmpty()) {
		getState().lines = (ArrayList<DrawLine>) lineContainer.getLines();
	}
	
	lineContainer.getListeners().put(sessionID, listener);

	
	ui.addDetachListener(new DetachListener() {
		
		@Override
		public void detach(DetachEvent event) {
			CollabSketch.this.lineContainer.getListeners().remove(listener);
			CollabSketch.this.lineContainer.getSessionColors().remove(sessionID);
		}
	});
}
 
開發者ID:Mazku,項目名稱:collabsketch_vaadin,代碼行數:66,代碼來源:CollabSketch.java


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