code: public static Component findParent(final Component childComponent,
  		final Class<? extends Component> parentClass, final boolean byClassname)
  	{
  		Component parent = childComponent.getParent();
  		while (parent != null)
  		{
  			if (parent.getClass().equals(parentClass))
  			{
  				break;
  			}
  			parent = parent.getParent();
  		}
  		if ((parent == null) && byClassname)
  		{
  			return findParentByClassname(childComponent, parentClass);
  		}
  		return parent;
  	}
docs: Finds the first parent of the given childComponent from the given parentClass and a flag if
  the search shell be continued with the class name if the search with the given parentClass
  returns null.
  
  @param childComponent
  the child component
  @param parentClass
  the parent class
  @param byClassname
  the flag to search by classname if the search with given parentClass returns null.
  @return the component