/**
  * Moves the focus to the specified component.
  *
  * @param gainer The component gaining focus
  */
 protected void moveFocus(OFocusableComponent gainer) {
   if (Debug.ON) Logger.dev("@@@ OFocusManager.moveFocus ENTERED");
   focusedComponent.setFocus(OFocusEvent.FOCUS_LOST);
   gainer.setFocus(OFocusEvent.FOCUS_GAINED);
   focusedComponent = gainer;
   screen.adjustBodyOffset(gainer);
   if (Debug.ON) Logger.dev("OFocusManager.moveFocus EXITTING");
 } // moveFocus
  /**
   * Creates a new <code>OFocusManager</code> instance.
   *
   * <p><b>This constructor should only be called AFTER all components have been added to the
   * screen. The object created by this constructor will not manage focus for any components added
   * to the screen AFTER this constructor is called</b>
   *
   * @param container The container for which this object is to manage focus.
   */
  public OFocusManager(OCompositeScreen screen) {
    if (Debug.ON) Logger.dev("OFocusManager.ctor.1 ENTERED");

    this.screen = screen;
    bodyBegin = screen.getBodyRow();
    bodyEnd = bodyBegin + screen.getBodyHeight();

    // populate a vector of components which can have focus, which may be a
    // subset of the components in the screen's container
    OComponent[] components = ((OContainer) screen).getComponents();
    for (int idx = 0; idx < components.length; idx++) {
      OComponent component = components[idx];
      if (!(component instanceof OContainer)) {
        if (component instanceof OFocusableComponent) {
          focusableComponents.addElement(component);
        }
      } else // component is itself a container, so we need to add its focusable
      { // components to the vector of all focusable components=
        OComponent[] subComponents = ((OContainer) component).getComponents();
        for (int idx2 = 0; idx2 < subComponents.length; idx2++) {
          OComponent subComponent = subComponents[idx2];
          if (subComponent instanceof OFocusableComponent) {
            focusableComponents.addElement(subComponent);
          }
        }
      }
    }

    // set the focused component to the first component
    if (focusableComponents.size() > 0) {
      focusedComponent = (OFocusableComponent) focusableComponents.elementAt(focusedComponentIndex);
      focusedComponent.setFocus(OFocusEvent.FOCUS_GAINED);
    }

    if (Debug.ON) Logger.dev("OFocusManager.ctor.1 EXITTING");
  } // constructor