Java Code Examples for javax.faces.component.UIComponent.isCompositeComponent()

The following are Jave code examples for showing how to use isCompositeComponent() of the javax.faces.component.UIComponent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: myfaces-trinidad   File: UIXComponentBase.java   View Source Code Vote up 6 votes
private boolean _isCompositeParentCurrent(FacesContext context, UIComponent component)
{
  UIComponent currentCompositeComponent = UIComponent.getCurrentCompositeComponent(context);
  if(UIComponent.isCompositeComponent(component))
  {
    return component.equals(currentCompositeComponent);
  }
  else
  {
    UIComponent compositeParent = UIComponent.getCompositeComponentParent(component);
    if(compositeParent == null)
    {
      return currentCompositeComponent == null;
    }
    else
    {
      return compositeParent.equals(currentCompositeComponent);
    }
  }
}
 
Example 2
Project: myfaces-trinidad   File: UIXComponent.java   View Source Code Vote up 5 votes
/**
 * Broadcast the FacesEvent after updating the current component and
 * current composite component
 * 
 * @param context The current instance of FacesContext
 * @param event The FacesEvent to be broadcasted
 */
public static void broadcastInContext(FacesContext context, FacesEvent event)
{
  UIComponent component = event.getComponent();
  UIComponent compositeParent = null;
  RequestContext requestContext = RequestContext.getCurrentInstance();
  if (!UIComponent.isCompositeComponent(component))
  {
    compositeParent = UIComponent.getCompositeComponentParent(component);
    if (compositeParent != null) 
    {
      requestContext.pushCurrentComponent(context, compositeParent);
      compositeParent.pushComponentToEL(context, null);
    }
  }
  requestContext.pushCurrentComponent(context, component);
  component.pushComponentToEL(context, null);
  try
  {
    component.broadcast(event);
  }
  finally
  {
    component.popComponentFromEL(context);
    requestContext.popCurrentComponent(context, component);
    if (compositeParent != null) 
    {
      compositeParent.popComponentFromEL(context);
      requestContext.popCurrentComponent(context, compositeParent);
    }
  }
}