Commit b536dfe6d0693103bd4617eb11bce9fc1f0bc711
1 parent
9b1f71c8
Fixed UIFocus to deal with duplicating IDs in different forms.
Showing
3 changed files
with
8 additions
and
8 deletions
| @@ -64,7 +64,7 @@ | @@ -64,7 +64,7 @@ | ||
| 64 | </properties> | 64 | </properties> | 
| 65 | <distributionManagement> | 65 | <distributionManagement> | 
| 66 | <snapshotRepository> | 66 | <snapshotRepository> | 
| 67 | - <id>lemur</id> | 67 | + <id>bernard.labno.pl</id> | 
| 68 | <name>MyCo Internal Repository</name> | 68 | <name>MyCo Internal Repository</name> | 
| 69 | <url>http://bernard.labno.pl/artifactory/libs-snapshot-local</url> | 69 | <url>http://bernard.labno.pl/artifactory/libs-snapshot-local</url> | 
| 70 | </snapshotRepository> | 70 | </snapshotRepository> | 
| @@ -19,19 +19,19 @@ public abstract class UIFocus extends UIComponentBase { | @@ -19,19 +19,19 @@ public abstract class UIFocus extends UIComponentBase { | ||
| 19 | 19 | ||
| 20 | public static final String FOCUS_MODIFIER_FACET_NAME = "focusModifier"; | 20 | public static final String FOCUS_MODIFIER_FACET_NAME = "focusModifier"; | 
| 21 | 21 | ||
| 22 | - public Integer getDefaultPriority() { | 22 | + public Integer getDefaultPriority(FacesContext context) { | 
| 23 | UIComponent parentForm = getParent(); | 23 | UIComponent parentForm = getParent(); | 
| 24 | while (parentForm != null && !(parentForm instanceof UIForm)) { | 24 | while (parentForm != null && !(parentForm instanceof UIForm)) { | 
| 25 | parentForm = parentForm.getParent(); | 25 | parentForm = parentForm.getParent(); | 
| 26 | } | 26 | } | 
| 27 | if (parentForm != null) { | 27 | if (parentForm != null) { | 
| 28 | - return getUIInputChildrenCount(parentForm, getTargetComponentId()); | 28 | + return getUIInputChildrenCount(parentForm, getTargetComponentId(context)); | 
| 29 | } else { | 29 | } else { | 
| 30 | return Integer.MAX_VALUE; | 30 | return Integer.MAX_VALUE; | 
| 31 | } | 31 | } | 
| 32 | } | 32 | } | 
| 33 | 33 | ||
| 34 | - public String getTargetComponentId() { | 34 | + public String getTargetComponentId(FacesContext context) { | 
| 35 | String aFor = getFor(); | 35 | String aFor = getFor(); | 
| 36 | 36 | ||
| 37 | if (aFor != null && !"".equals(aFor)) { | 37 | if (aFor != null && !"".equals(aFor)) { | 
| @@ -44,9 +44,9 @@ public abstract class UIFocus extends UIComponentBase { | @@ -44,9 +44,9 @@ public abstract class UIFocus extends UIComponentBase { | ||
| 44 | allowedClientIds.add(clientIdsWithMessages.next()); | 44 | allowedClientIds.add(clientIdsWithMessages.next()); | 
| 45 | } | 45 | } | 
| 46 | UIComponent component = getFirstInput(getParentForm(this), allowedClientIds); | 46 | UIComponent component = getFirstInput(getParentForm(this), allowedClientIds); | 
| 47 | - return component == null ? null : component.getId(); | 47 | + return component == null ? null : component.getClientId(context); | 
| 48 | } else { | 48 | } else { | 
| 49 | - return getParent().getId(); | 49 | + return getParent().getClientId(context); | 
| 50 | } | 50 | } | 
| 51 | } | 51 | } | 
| 52 | } | 52 | } | 
| @@ -69,11 +69,11 @@ public class HtmlFocusRenderer extends HeaderResourcesRendererBase { | @@ -69,11 +69,11 @@ public class HtmlFocusRenderer extends HeaderResourcesRendererBase { | ||
| 69 | checkValidity(clientId, uiFocus.getName(), uiFocus.getTiming()); | 69 | checkValidity(clientId, uiFocus.getName(), uiFocus.getTiming()); | 
| 70 | Integer priority = uiFocus.getPriority(); | 70 | Integer priority = uiFocus.getPriority(); | 
| 71 | if (priority == null) { | 71 | if (priority == null) { | 
| 72 | - priority = uiFocus.getDefaultPriority(); | 72 | + priority = uiFocus.getDefaultPriority(context); | 
| 73 | } | 73 | } | 
| 74 | String targetClientId = uiFocus.getTargetClientId(); | 74 | String targetClientId = uiFocus.getTargetClientId(); | 
| 75 | if (targetClientId == null || "".equals(targetClientId)) { | 75 | if (targetClientId == null || "".equals(targetClientId)) { | 
| 76 | - String targetComponentId = uiFocus.getTargetComponentId(); | 76 | + String targetComponentId = uiFocus.getTargetComponentId(context); | 
| 77 | String suffix = uiFocus.getSuffix(); | 77 | String suffix = uiFocus.getSuffix(); | 
| 78 | if (targetComponentId == null || "".equals(targetComponentId)) { | 78 | if (targetComponentId == null || "".equals(targetComponentId)) { | 
| 79 | return; | 79 | return; | 
Please
register
or
login
to post a comment