ice.pilots.html4
Class FocusManager

java.lang.Object
  extended byice.pilots.html4.FocusManager
Direct Known Subclasses:
DirectionFocusManager

public class FocusManager
extends Object


Field Summary
protected  Hashtable accesskeys
           
protected  Vector cssboxes
           
protected  DDocument doc
           
protected  DocPane docPane
           
protected  Point documentScrollPosition
           
protected  Vector domnodes
           
static int DOWN
           
protected  ice.pilots.html4.CSSLayout layout
           
static int LEFT
           
static int NEXT
           
protected  ThePilot pilot
           
static int PREVIOUS
           
static int RIGHT
           
protected  int theFocusedElement
           
static int UP
           
protected  Dimension viewDimension
           
 
Constructor Summary
FocusManager(DDocument d, ice.pilots.html4.CSSLayout cl, ThePilot p)
           
 
Method Summary
protected  int focusDefaultBox()
           
 DNode getFocusedElement()
           
protected  boolean globalDFM(int dir)
          Direction-based focuschange across frames (global).
protected  boolean isDisabled(int elementno)
           
 boolean isFrameFocused()
          Used to determine if the frame itself has focus (i.e.
protected  boolean isOnScreen(Rectangle r)
          Determines if the given rectangle is regarded visible on screen.
protected  boolean localDFM(int dir)
          Direction-based focuschange within the frame (local).
protected  Object lookupAccesskey(Object key)
          Tries to find a DOM node represented by the given accesskey
protected  void nextExternalFocus()
           
protected  int nextFocus()
          Process a nextFocus request.
protected  void previousExternalFocus()
           
protected  int previousFocus()
          Process a previousFocus request.
protected  void registerAccesskey(String key, Object value)
          Registers an accesskey which triggers focus of a given box.
 boolean requestFocus()
          Requests the focus on the Toolkit-component which holds the focus by calling requestFocus().
protected  void setFocusedBox(DNode dnode)
          Sets the focused node to be given DNode.
protected  void setFocusedBox(int boxno)
          Sets the focused box to be the box with given internal number.
 void setFrameFocused(boolean v)
          Used to signal that the frame associated with the focusmanager has focus.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UP

public static final int UP
See Also:
Constant Field Values

DOWN

public static final int DOWN
See Also:
Constant Field Values

LEFT

public static final int LEFT
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
See Also:
Constant Field Values

NEXT

public static final int NEXT
See Also:
Constant Field Values

PREVIOUS

public static final int PREVIOUS
See Also:
Constant Field Values

theFocusedElement

protected int theFocusedElement

domnodes

protected Vector domnodes

cssboxes

protected Vector cssboxes

accesskeys

protected Hashtable accesskeys

doc

protected DDocument doc

layout

protected ice.pilots.html4.CSSLayout layout

pilot

protected ThePilot pilot

docPane

protected DocPane docPane

documentScrollPosition

protected Point documentScrollPosition

viewDimension

protected Dimension viewDimension
Constructor Detail

FocusManager

public FocusManager(DDocument d,
                    ice.pilots.html4.CSSLayout cl,
                    ThePilot p)
Method Detail

setFrameFocused

public final void setFrameFocused(boolean v)
Used to signal that the frame associated with the focusmanager has focus. Called for example from ComponentFactory.onComponentFocus()

Parameters:
v - true if this frame has gained focus, false otherwise

isFrameFocused

public final boolean isFrameFocused()
Used to determine if the frame itself has focus (i.e. it has user-focus, and no focusable component within it has the focus)


isOnScreen

protected boolean isOnScreen(Rectangle r)
Determines if the given rectangle is regarded visible on screen. The default implementation of this method states that the rectangle is visible if any point of the rectangle is on screen.


focusDefaultBox

protected int focusDefaultBox()

localDFM

protected boolean localDFM(int dir)
Direction-based focuschange within the frame (local).

Parameters:
dir - direction of desired focuschange
Returns:
true if focus-state was changed, false otherwise

globalDFM

protected boolean globalDFM(int dir)
Direction-based focuschange across frames (global).

Parameters:
dir - direction of desired focuschange
Returns:
true if focus-state was changed, false otherwise

registerAccesskey

protected void registerAccesskey(String key,
                                 Object value)
Registers an accesskey which triggers focus of a given box.

Parameters:
key - Long object representing the charCode of the accesskey
value - DNode object representing the DOM node which should be focused when the accesskey is pressed

lookupAccesskey

protected Object lookupAccesskey(Object key)
Tries to find a DOM node represented by the given accesskey

Parameters:
key - Long object representing the charCode of the accesskey
Returns:
DNode object representing the DOM node to be focused

setFocusedBox

protected void setFocusedBox(DNode dnode)
Sets the focused node to be given DNode. This method basically maps the DNode to the internal number and then calls setFocusedBox(int boxno)

Parameters:
dnode - DOM node to give focus

setFocusedBox

protected void setFocusedBox(int boxno)
Sets the focused box to be the box with given internal number. If you overide this method you should call super()!

Parameters:
boxno - internal number of box to focus

isDisabled

protected boolean isDisabled(int elementno)

nextFocus

protected int nextFocus()
Process a nextFocus request. This method will determine the next widget that should recieve the focus. If no widget currently has the focus, this method will return the number of the first widget in the focus order.

Returns:
The internal Widget number that should next recieve the focus. -1 if no widget is available to recieve the focus.

previousFocus

protected int previousFocus()
Process a previousFocus request. This method will determine the next widget that should recieve the focus in the reverse tab order. If no widget currently has the focus, this method will return the number of the last widget in the focus order

Returns:
The internal Widget number that should next recieve the focus. -1 if no widget is available to recieve the focus.

getFocusedElement

public DNode getFocusedElement()

requestFocus

public boolean requestFocus()
Requests the focus on the Toolkit-component which holds the focus by calling requestFocus().

Returns:
true if the focus was requested on a toolkit-component, false if focus was not on any toolkit-component.

This method is currently only used bu the DocView in AWT mode, if a specific SystemProperty is set.


previousExternalFocus

protected void previousExternalFocus()

nextExternalFocus

protected void nextExternalFocus()