public boolean shouldGenerateDatalist()

in myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/input/delegate/HtmlTextInputSuggestionRendererHelper.java [97:123]


    public boolean shouldGenerateDatalist(UIComponent uiComponent)
    {
        if (uiComponent instanceof Html5BaseInputText)
        {
            Html5BaseInputText component = (Html5BaseInputText) uiComponent;
            Object suggestions = component.getSuggestions();
            if (suggestions != null)
                return true;

            List<UIComponent> children = component.getChildren();
            if (children != null && !children.isEmpty())
            {
                for (UIComponent child : children)
                {
                    if (child instanceof UISelectItem || child instanceof UISelectItems)
                        return true;
                }
            }

            return false;
        }
        else
        {
            throw new IllegalArgumentException(
                    "Component " + DebugUtils.getPathToComponent(uiComponent) + " is not instance of Html5BaseInputText. HtmlTextInputSuggestionRendererHelper is unable to determine whether datalist will be generated or not.");
        }
    }