/** Checks that all focuskeys reference the correct components */ public void validateFocusKeys(FormComponent root, FocusPolicyMemento memento) { Iterator iter = memento.getFocusPolicyKeys().iterator(); while (iter.hasNext()) { FocusKey fkey = (FocusKey) iter.next(); Component comp = fkey.getComponent(root); assert (comp != null); System.out.print("Focuskey validated: "); fkey.print(); System.out.println(" comp: " + comp.getClass()); } }
/** * Builds an list of components that are ordered in the focus order previously set by a user for a * given form. The form may have changed (components might have been deleted or moved), so we need * to delete those components from the focus order that don't match the current state of the form. */ ArrayList buildStoredFocusList(FormComponent form) { ArrayList focus_list = new ArrayList(); FocusPolicyMemento memento = form.getFocusPolicy(); if (memento != null) { Collection fkeys = memento.getFocusPolicyKeys(); Iterator iter = fkeys.iterator(); while (iter.hasNext()) { FocusKey fkey = (FocusKey) iter.next(); Component comp = fkey.getComponent(form); if (comp != null) { focus_list.add(comp); } } } return focus_list; }