require that all members of a FocusManagerGroup are in the same document. This should alleviate the requirement that groupName is unique throughout the UI which will allow radiobutton templates in MXML and hopefully not break anybody's app
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/d011a516 Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/d011a516 Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/d011a516 Branch: refs/heads/release4.11.0 Commit: d011a51626afcfbdf3746cbcbd5b4b013b2537b8 Parents: edd7d0c Author: Alex Harui <[email protected]> Authored: Tue Oct 15 09:45:02 2013 -0700 Committer: Alex Harui <[email protected]> Committed: Wed Oct 16 10:10:35 2013 -0700 ---------------------------------------------------------------------- .../framework/src/mx/managers/FocusManager.as | 33 +++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/d011a516/frameworks/projects/framework/src/mx/managers/FocusManager.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/framework/src/mx/managers/FocusManager.as b/frameworks/projects/framework/src/mx/managers/FocusManager.as index 6f17a07..64d7b22 100644 --- a/frameworks/projects/framework/src/mx/managers/FocusManager.as +++ b/frameworks/projects/framework/src/mx/managers/FocusManager.as @@ -1397,7 +1397,8 @@ public class FocusManager extends EventDispatcher implements IFocusManager if (obj is IFocusManagerGroup) { tg2 = IFocusManagerGroup(obj); - if (tg2.groupName == tg1.groupName && isEnabledAndVisible(obj)) + if (tg2.groupName == tg1.groupName && isEnabledAndVisible(obj) && + tg2["document"] == tg1["document"]) { if (tg2.selected) { @@ -1412,6 +1413,7 @@ public class FocusManager extends EventDispatcher implements IFocusManager if (tg1 != groupElementToFocus) { + var foundAnotherGroup:Boolean = false; // cycle the entire focusable candidates array forward or backward, // wrapping around boundaries, searching for our focus candidate j = i; @@ -1434,10 +1436,26 @@ public class FocusManager extends EventDispatcher implements IFocusManager obj = focusableCandidates[j]; if (isEnabledAndVisible(obj)) { - if (obj is IFocusManagerGroup) + if (foundAnotherGroup) + { + // we're now just trying to find a selected member of this group + if (obj is IFocusManagerGroup) + { + tg2 = IFocusManagerGroup(obj); + if (tg2.groupName == tg1.groupName && tg2["document"] == tg1["document"]) + { + if (tg2.selected) + { + i = j; + break; + } + } + } + } + else if (obj is IFocusManagerGroup) { tg2 = IFocusManagerGroup(obj); - if (tg2.groupName == tg1.groupName) + if (tg2.groupName == tg1.groupName && tg2["document"] == tg1["document"]) { if (tg2 == groupElementToFocus) { @@ -1451,9 +1469,14 @@ public class FocusManager extends EventDispatcher implements IFocusManager } else { - // element is part of another group, stop (no recursive search) + // switch to new group and hunt for selected item + tg1 = tg2; i = j; - break; + // element is part of another group, stop if selected + if (tg2.selected) + break; + else + foundAnotherGroup = true; } } else
