com.bluemarsh.jswat.ui
Class SessionFrameMapper

java.lang.Object
  |
  +--com.bluemarsh.jswat.ui.SessionFrameMapper

public class SessionFrameMapper
extends java.lang.Object

Class SessionFrameMapper is responsible for providing a mapping between Frame objects and Session objects. This is used by the JSwatAction classes to convert a Frame reference to a Session instance. All UIAdapter implementations that provide instances of the JSwatActions must keep this table up to date.

Author:
Nathan Fiedler

Field Summary
protected static java.util.Hashtable framesToSessions
          Mapping of Frames to Sessions.
 
Constructor Summary
SessionFrameMapper()
           
 
Method Summary
static java.awt.Frame getOwningFrame(java.lang.Object o)
          Find the hosting frame for this object.
static Session getSessionForEvent(java.util.EventObject e)
          Finds the Session that is associated with the window that contains the component that is the source of the given action event.
static Session getSessionForFrame(java.awt.Frame f)
          Looks for a Session that is associated with the given Frame.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

framesToSessions

protected static java.util.Hashtable framesToSessions
Mapping of Frames to Sessions.
Constructor Detail

SessionFrameMapper

public SessionFrameMapper()
Method Detail

getOwningFrame

public static java.awt.Frame getOwningFrame(java.lang.Object o)
Find the hosting frame for this object. Often used when displaying dialogs which require a host frame.
Parameters:
o - Object with which to find the parent frame. Could be a subclass of EventObject or Component.
Returns:
hosting frame or null if none.

getSessionForEvent

public static Session getSessionForEvent(java.util.EventObject e)
Finds the Session that is associated with the window that contains the component that is the source of the given action event.
Parameters:
e - event with which to find Session.
Returns:
Session instance, or null if error.

getSessionForFrame

public static Session getSessionForFrame(java.awt.Frame f)
Looks for a Session that is associated with the given Frame.
Parameters:
f - Frame to look up Session with.
Returns:
Session for the given frame, if any.