org.kalmeo.kuix.core.focus
Class FocusManager

java.lang.Object
  extended by org.kalmeo.kuix.core.focus.FocusManager

public class FocusManager
extends java.lang.Object

Author:
bbeaulant

Field Summary
protected  Widget focusedWidget
           
protected  Widget rootWidget
           
 
Constructor Summary
FocusManager(Widget rootWidget, boolean loop)
          Construct a FocusManager
 
Method Summary
 void addShortcutHandler(Widget widget)
          Add a shortcut key event handler to shortcuts list
 ScrollPane findFirstScrollPaneParent(Widget widget)
          Try to retrieve the direct or indirect parent scrollPane of the given widget instance.
 Widget getFocusedWidget()
          Returns the focused widget.
 Widget getVirtualFocusedWidget()
          Returns the focused widget.
 boolean isLoop()
           
 boolean processKeyEvent(byte type, int kuixKeyCode)
          Process a key event
 boolean processPointerEvent(byte type, int x, int y)
          Process a pointer event
protected  boolean processSoftKeyEvent(byte type, int kuixKeyCode)
          Process key event if it's generated by soft key
 void removeShortcutHandler(Widget widget)
          Remove a shortcut key event handler to shortcuts list
 void requestFirstFocus()
          Request focus for the first focusable widget
 void requestFocus(Widget widget)
          Request the widget focus
 void requestLastFocus()
          Request focus for the last focusable widget
 void requestOtherFocus(boolean forward, Alignment direction)
          Request the forward or backward focusable Widget.
 void requestOtherFocus(Widget startWidget, boolean forward, Alignment direction)
          Request the forward or backward focusable Widget.
 void reset()
          Reset the focues widget
 void setLoop(boolean loop)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rootWidget

protected Widget rootWidget

focusedWidget

protected Widget focusedWidget
Constructor Detail

FocusManager

public FocusManager(Widget rootWidget,
                    boolean loop)
Construct a FocusManager

Parameters:
rootWidget -
loop -
Method Detail

isLoop

public boolean isLoop()
Returns:
the loop

setLoop

public void setLoop(boolean loop)
Parameters:
loop - the loop to set

getFocusedWidget

public Widget getFocusedWidget()
Returns the focused widget.

Returns:
the focusedWidget

getVirtualFocusedWidget

public Widget getVirtualFocusedWidget()
Returns the focused widget.
Caution : if focused widget is a TabFolder the current TabItem's focused widget is returned.
For focusManager internal use, prefer to use the protected focusedWidget member.

Returns:
the focusedWidget

reset

public void reset()
Reset the focues widget


addShortcutHandler

public void addShortcutHandler(Widget widget)
Add a shortcut key event handler to shortcuts list

Parameters:
widget - the widget that handle the shortcut key event

removeShortcutHandler

public void removeShortcutHandler(Widget widget)
Remove a shortcut key event handler to shortcuts list

Parameters:
widget - the widget that handle the shortcut key event

findFirstScrollPaneParent

public ScrollPane findFirstScrollPaneParent(Widget widget)
Try to retrieve the direct or indirect parent scrollPane of the given widget instance.

Parameters:
widget -
Returns:
The direct or indirect parent ScrollPane if it exists or null

requestFocus

public void requestFocus(Widget widget)
Request the widget focus

Parameters:
widget -

requestOtherFocus

public void requestOtherFocus(Widget startWidget,
                              boolean forward,
                              Alignment direction)
Request the forward or backward focusable Widget. The forward or backward focusable widget search start from widget.
The direction helps to catch the best previous focusable widget. Set direction to null to use only widget tree navigation.

Parameters:
startWidget -
direction -

requestOtherFocus

public void requestOtherFocus(boolean forward,
                              Alignment direction)
Request the forward or backward focusable Widget.
The direction helps to catch the best previous focusable widget. Set direction to null to use only widget tree navigation.

Parameters:
direction -

requestFirstFocus

public void requestFirstFocus()
Request focus for the first focusable widget


requestLastFocus

public void requestLastFocus()
Request focus for the last focusable widget


processKeyEvent

public boolean processKeyEvent(byte type,
                               int kuixKeyCode)
Process a key event

Parameters:
type -
kuixKeyCode -
Returns:
true if the event do something, else false

processSoftKeyEvent

protected boolean processSoftKeyEvent(byte type,
                                      int kuixKeyCode)
Process key event if it's generated by soft key

Parameters:
type -
kuixKeyCode -
Returns:
true if the event do something, else false

processPointerEvent

public boolean processPointerEvent(byte type,
                                   int x,
                                   int y)
Process a pointer event

Parameters:
type -
x -
y -
Returns:
true if the event do something, else false


Copyright © 2007-2008 Kalmeo. All Rights Reserved.