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

The following are Jave code examples for showing how to use getClass() 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.
Example 1
Project: myfaces-trinidad   File: UIXComponent.java   Source Code and License Vote up 6 votes
/**
 * Determine if we can flatten a core JSF component.
 * @param component The component
 * @return true if the component is a core JSF component and we can
 * flatten it successfully.
 */
private static boolean isFlattenableCoreComponent(UIComponent component)
{
  // Optimize the cases of UINamingContainer (<f:subview>) and UIPanel -
  // we will treat these components as FlattenedComponents because they do not render
  // any DOM.
  // Also note that as of JSF 2.0, UINamingContainer components are built
  // by f:subview, as well as composite components.
  Class<? extends UIComponent> componentClass = component.getClass();

  if (UINamingContainer.class == componentClass)
  {
    // Check to see if this component was created as a composite
    // component, which we cannot flatten
    return component.getFacet(UIComponent.COMPOSITE_FACET_NAME) == null;
  }

  // Note that JSF 2.0 creates UIPanel wrappers around multiple components
  // inside of <f:facet>
  return UIPanel.class == componentClass;
}
 
Example 2
Project: myfaces-trinidad   File: ChangeComponentProxy.java   Source Code and License Vote up 5 votes
/**
 * Constructs an ChangeComponentProxy with the specified UIComponent instance.
 * @throws IllegalArgumentException if specified uiComponent were to be null.
 */
public ChangeComponentProxy(
  FacesContext facesContext,
  UIComponent uiComponent)
{
  if (uiComponent == null)
    throw new IllegalArgumentException(_LOG.getMessage(
      "CANNOT_CONSTRUCT_CHANGECOMPONENTPROXY_WITH_NULL_UICOMPONENT"));
  _class = uiComponent.getClass();
  _className = _class.getName();
  _state = uiComponent.saveState(facesContext);
}
 
Example 3
Project: myfaces-trinidad   File: BaseChangeManager.java   Source Code and License Vote up 5 votes
/**
 * {@inheritDoc}
 */
@Override
public void addComponentChange(
  FacesContext facesContext,
  UIComponent uiComponent,
  ComponentChange change)
{
  // if our component is a stamped component by UIXIterator, we 
  // don't want to persist the changes 
  UIComponent parent = uiComponent.getParent();
  UIComponent root = facesContext.getViewRoot();
  while (parent != null && parent != root)
  {
    if (parent.getClass() == UIXIterator.class) 
    {
      _LOG.info("DONT_PERSIST_STAMPED_COMPONENT_INSIDE_ITERATOR");      
      return;
    }
    parent = parent.getParent();      
  }
      
  if (facesContext == null || uiComponent == null || change == null)
    throw new IllegalArgumentException(_LOG.getMessage(
      "CANNOT_ADD_CHANGE_WITH_FACECONTEXT_OR_UICOMPONENT_OR_NULL"));

  // add the change to the component
  addComponentChangeImpl(facesContext, uiComponent, change);

  // add a corresponding DocumentChange if possible
  _addEquivalentDocumentChange(facesContext, uiComponent, change);
}
 
Example 4
Project: myfaces-trinidad   File: UIXComponentBase.java   Source Code and License Vote up 4 votes
ComponentSystemEventListenerWrapper(ComponentSystemEventListener listener, UIComponent component)
{
  _delegate = listener;
  _componentClass = component.getClass();
}