Skip to content

Commit

Permalink
Fixed #1946
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Dec 22, 2016
1 parent 8d6d315 commit 9278148
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
Expand Up @@ -21,6 +21,7 @@
import java.util.TimeZone;
import java.util.logging.Logger;
import javax.faces.FacesException;
import javax.faces.component.UIForm;
import javax.faces.component.UIViewRoot;
import javax.faces.component.UniqueIdVendor;
import javax.faces.context.FacesContext;
Expand Down Expand Up @@ -226,6 +227,16 @@ private boolean isSelfRequest(FacesContext context) {
}

private String clientId = null;
private StringBuilder idBuilder = new StringBuilder();
private UIComponent parentComponent;

public UIComponent getParentComponent() {
return parentComponent;
}

public void setParentComponent(UIComponent parentComponent) {
this.parentComponent = parentComponent;
}

@Override
public String getClientId(FacesContext context) {
Expand Down Expand Up @@ -254,7 +265,27 @@ public String getClientId(FacesContext context) {
this.setId(id);
}

this.clientId = id;
if(this.parentComponent != null && !(this.parentComponent instanceof UIForm)) {
this.setParent(this.parentComponent);
}

UIComponent namingContainer = ComponentTraversalUtils.closestNamingContainer(this);
if(namingContainer != null) {
String containerClientId = namingContainer.getContainerClientId(context);

if(containerClientId != null) {
this.clientId = this.idBuilder.append(containerClientId).append(UINamingContainer.getSeparatorChar(context)).append(id).toString();
this.idBuilder.setLength(0);
}
else
{
this.clientId = id;
}
}
else
{
this.clientId = id;
}

Renderer renderer = getRenderer(context);
if(renderer != null) {
Expand Down
Expand Up @@ -69,6 +69,8 @@ public void onComponentPopulated(FaceletContext ctx, UIComponent c, UIComponent
} else {
root.addPhaseListener(timelineUpdater);
}

timeline.setParentComponent(parent);
}

private UIViewRoot getViewRoot(FaceletContext ctx, UIComponent parent) {
Expand Down

0 comments on commit 9278148

Please sign in to comment.