|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.alee.managers.focus.FocusManager
public class FocusManager
This manager allows you to track certain component their childs focus state by adding your custom FocusTracker or global focus listeners to track component focus state.
Field Summary | |
---|---|
protected static java.lang.ref.WeakReference<java.awt.Component> |
focusOwner
Reference to currently focused component. |
protected static java.util.List<GlobalFocusListener> |
globalFocusListeners
Global focus listeners list. |
protected static boolean |
initialized
Whether manager is initialized or not. |
protected static java.lang.Object |
listenersLock
Global focus listeners lock. |
protected static java.lang.ref.WeakReference<java.awt.Component> |
oldFocusOwner
Reference to previously focused component. |
protected static java.util.Map<java.awt.Component,java.util.Map<FocusTracker,java.lang.Boolean>> |
trackers
Focus trackers list. |
protected static java.lang.Object |
trackersLock
Tracker list and cache lock. |
Constructor Summary | |
---|---|
FocusManager()
|
Method Summary | |
---|---|
static void |
addFocusTracker(java.awt.Component component,
FocusTracker focusTracker)
Registers focus tracker. |
protected static void |
fireGlobalFocusChanged(java.awt.Component oldComponent,
java.awt.Component newComponent)
Fires about global focus change. |
static java.awt.Component |
getFocusOwner()
Returns currently focused component. |
static java.awt.Component |
getOldFocusOwner()
Returns previously focused component. |
protected static java.util.Map<java.awt.Component,java.util.Map<FocusTracker,java.lang.Boolean>> |
getTrackersCopy()
Returns trackers map copy. |
static void |
initialize()
Initializes manager if it wasn't already initialized. |
static void |
registerGlobalFocusListener(GlobalFocusListener listener)
Registers global focus listener. |
static void |
removeFocusTracker(FocusTracker focusTracker)
Unregisters specified focus tracker. |
static void |
removeFocusTrackers(java.awt.Component component)
Unregisters all focus trackers from the specified component. |
static void |
unregisterGlobalFocusListener(GlobalFocusListener listener)
Unregisters global focus listener. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.Object trackersLock
protected static final java.util.Map<java.awt.Component,java.util.Map<FocusTracker,java.lang.Boolean>> trackers
protected static final java.lang.Object listenersLock
protected static final java.util.List<GlobalFocusListener> globalFocusListeners
protected static java.lang.ref.WeakReference<java.awt.Component> oldFocusOwner
protected static java.lang.ref.WeakReference<java.awt.Component> focusOwner
protected static boolean initialized
Constructor Detail |
---|
public FocusManager()
Method Detail |
---|
public static void initialize()
protected static java.util.Map<java.awt.Component,java.util.Map<FocusTracker,java.lang.Boolean>> getTrackersCopy()
public static java.awt.Component getFocusOwner()
public static java.awt.Component getOldFocusOwner()
public static void registerGlobalFocusListener(GlobalFocusListener listener)
listener
- new global focus listenerpublic static void unregisterGlobalFocusListener(GlobalFocusListener listener)
listener
- global focus listener to unregisterprotected static void fireGlobalFocusChanged(java.awt.Component oldComponent, java.awt.Component newComponent)
oldComponent
- previously focused componentnewComponent
- currently focused componentpublic static void addFocusTracker(java.awt.Component component, FocusTracker focusTracker)
focusTracker
- new focus trackerpublic static void removeFocusTracker(FocusTracker focusTracker)
focusTracker
- focus tracker to unregisterpublic static void removeFocusTrackers(java.awt.Component component)
component
- component to unregister all focus trackers from
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |