@SuppressWarnings("unchecked")
	public static <T> T getSelfOrAncestorOfType(Component component, Class<T> type) {
		if (component != null) {
			if (type.isAssignableFrom(component.getClass())) {
				return (T) component;
			}
			return getAncestorOfType(component, type);
		}
		return null;
	}