com.yospace.yae.yogi
Class FocusManager
java.lang.Object
|
+--com.yospace.yae.yogi.FocusManager
- Direct Known Subclasses:
- StandardFocusManager, StandardFocusManager
- public abstract class FocusManager
- extends java.lang.Object
Base class of FocusManagers in the YoGI system. UIs will subclass this:
the UIManager provides a reference to the current
FocusManager
The FocusManager has the responsibility of pre-filtering all events and
deciding whether to use them for changing the current focus (ie "tabbing")
or for other high-level purpose (in the sense of the "MSWindows" button
or ALT-Tab on PCs).
It can also search for targets other than the current focus. If, for instance,
the event is a keystroke indicating that we should scroll up, then we may
search for next scrollable parent from the current focus.
It is also the FocusManager's responsibility to ensure that
scrollers and layered windows are adjusted where possible so that the focussed
item stays on screen.
|
Method Summary |
abstract boolean |
processKeyEvent(int keyCode,
int eventType)
This method receives all keypad events from the low-level event system, and
is expected to pick out and act upon focus-traversal commands and other
significant focus controls. |
abstract boolean |
processPointerEvent(int x,
int y,
int eventType)
This method receives pointer events from the low-level event system. |
void |
setRootWindow(YogiRootWindow rootWindow)
Sets the root window component that is to be managed. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
rootWindow
protected YogiRootWindow rootWindow
- The root window component that is to be managed.
- See Also:
setRootWindow(YogiRootWindow)
FocusManager
public FocusManager()
setRootWindow
public void setRootWindow(YogiRootWindow rootWindow)
- Sets the root window component that is to be managed. This can only be set once.
- Parameters:
rootWindow - the root window component to be managed.- Throws:
IllegalStateException - if the root window has already been set.
processKeyEvent
public abstract boolean processKeyEvent(int keyCode,
int eventType)
- This method receives all keypad events from the low-level event system, and
is expected to pick out and act upon focus-traversal commands and other
significant focus controls. If the focus is moved, it is expected that the
focus manager will ensure that the focus is still visible. It should pass
events to the current focussed component's
keyPressed,
keyRepeated or
keyReleased methods,
as appropriate, and also pass them to its UI delegate's
processKeyEvent method.
It may choose to pass events elsewhere (such as to the component's containers, as per
AWT 1.0), but this is UI dependent. It should take account of the
enablement,
context-enablement and
visibility of the components.
- Parameters:
keyCode - the keycode of the key that was pressed, according to
MIDP Canvas.eventType - a key event type, one of
KEY_PRESSED,
KEY_REPEATED or
KEY_RELEASED.
processPointerEvent
public abstract boolean processPointerEvent(int x,
int y,
int eventType)
- This method receives pointer events from the low-level event system.
It is responsible for assigning the component under a pointer-press to be the current
focus, and
It should pass
events to the current focussed component's
pointerPressed,
pointerDragged or
pointerReleased methods,
as appropriate, and also pass them to its UI delegate's
processPointerEvent method.
It may choose to pass events elsewhere (such as to the component's containers, as per
AWT 1.0), but this is UI dependent. It should take account of the
enablement,
context-enablement and
visibility of the components.
- Parameters:
x - the x-coordinate of the pointer event, in global canvas coordinatesy - the y-coordinate of the pointer event, in global canvas coordinateseventType - a key event type, one of
POINTER_PRESSED,
POINTER_DRAGGED or
POINTER_RELEASED.