All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.talk2object.plum.interaction.context.InteractionContextUtils Maven / Gradle / Ivy

package com.talk2object.plum.interaction.context;

import com.talk2object.common.Context;
import com.talk2object.plum.interaction.InteractionManager;
import com.talk2object.plum.view.component.containers.window.WindowEventThread;

/**
 * It holds thread (stack) contexts
 * 
 * @author jack
 *
 */
public class InteractionContextUtils {
	private static final String INTERACTION_MANAGER = "interaction-manager";
	
	private static Context getContext() {
		WindowEventThread currentThread = (WindowEventThread) Thread
				.currentThread();
		return currentThread.getContext();
	}

	/**
	 * get interaction context from current thread.
	 * 
	 * @return
	 */
	public static InteractionManager getInteractionManager() {
		return (InteractionManager) getContext().get(INTERACTION_MANAGER);
	}

	public static void setInteractionManager(WindowEventThread thread,
			InteractionManager interactionManager) {
		thread.getContext().set(INTERACTION_MANAGER, interactionManager);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy