Class IconLoaderSupport

java.lang.Object
io.jmix.flowui.xml.layout.support.IconLoaderSupport
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@Component("flowui_IconLoaderSupport") @Scope("prototype") public class IconLoaderSupport extends Object implements org.springframework.context.ApplicationContextAware
Utility class for loading component icons.
  • Field Details

    • DEFAULT_ICON_ELEMENT_NAME

      protected static final String DEFAULT_ICON_ELEMENT_NAME
      See Also:
    • context

      protected ComponentLoader.Context context
    • layoutLoader

      protected LayoutLoader layoutLoader
    • loaderSupport

      protected LoaderSupport loaderSupport
    • icons

      protected Icons icons
    • applicationContext

      protected org.springframework.context.ApplicationContext applicationContext
  • Constructor Details

  • Method Details

    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • loadIcon

      public void loadIcon(org.dom4j.Element element, Consumer<com.vaadin.flow.component.Component> setter)
      Loads an icon component from the given XML element and applies it using the provided setter. The method first attempts to find the nested icon element with the default name within the given element. If the icon element is found, an icon component is loaded and passed to the setter. Otherwise, it attempts to load an icon from the fallback attribute with the default name.
      Parameters:
      element - the XML element to load the icon from
      setter - the setter used to process the loaded icon
    • loadIcon

      public void loadIcon(org.dom4j.Element element, String iconElementName, Consumer<com.vaadin.flow.component.Component> setter)
      Loads an icon component from the given XML element and applies it using the provided setter. The method first attempts to find the nested icon element with the given name within the given element. If the icon element is found, an icon component is loaded and passed to the setter. Otherwise, it attempts to load an icon from the fallback attribute the same name as the given icon element name.
      Parameters:
      element - the XML element to load the icon from
      iconElementName - the name of the child element that stores the icon
      setter - the setter used to process the loaded icon
    • loadIcon

      public void loadIcon(org.dom4j.Element element, String iconElementName, String iconAttributeName, Consumer<com.vaadin.flow.component.Component> setter)
      Loads an icon component from the given XML element and applies it using the provided setter. The method first attempts to find the nested icon element with the given name within the given element. If the icon element is found, an icon component is loaded and passed to the setter. Otherwise, it attempts to load an icon from the specified fallback attribute of the given element.
      Parameters:
      element - the XML element to load the icon from
      iconElementName - the name of the child element that stores the icon
      iconAttributeName - the name of the fallback attribute that represents the icon if no icon element is found
      setter - the setter used to process the loaded icon
    • loadIcon

      public Optional<com.vaadin.flow.component.Component> loadIcon(org.dom4j.Element element)
      Loads an icon component from the given XML element. The method first attempts to find the nested icon element with the default name within the given element. If the icon element is found, the icon component is loaded from it. Otherwise, it attempts to load an icon from the fallback attribute with the default name.
      Parameters:
      element - the XML element to load the icon from
      Returns:
      an Optional containing the loaded icon Component, or an empty Optional if no icon could be loaded
    • loadIcon

      public Optional<com.vaadin.flow.component.Component> loadIcon(org.dom4j.Element element, String iconElementName)
      Loads an icon component from the given XML element. The method first attempts to find the nested icon element with the given name within the given element. If the icon element is found, the icon component is loaded from it. Otherwise, it attempts to load an icon from the fallback attribute with the same name as the given icon element name. If no icon is found, an empty Optional is returned.
      Parameters:
      element - the XML element to load the icon from
      iconElementName - the name of the child element that stores the icon
      Returns:
      an Optional containing the loaded icon Component, or an empty Optional if no icon could be loaded
    • loadIcon

      public Optional<com.vaadin.flow.component.Component> loadIcon(org.dom4j.Element element, String iconElementName, String iconAttributeName)
      Loads an icon component from the given XML element. The method first attempts to find the nested icon element with the given name within the given element. If the icon element is found, the icon component is loaded from it. Otherwise, it attempts to load an icon from the given fallback attribute. If no icon is found, an empty Optional is returned.
      Parameters:
      element - the XML element to load the icon from
      iconElementName - the name of the child element that stores the icon
      iconAttributeName - the name of the fallback attribute that represents the icon if no icon element is found
      Returns:
      an Optional containing the loaded icon Component, or an empty Optional if no icon could be loaded
    • loadIconComponent

      protected Optional<com.vaadin.flow.component.Component> loadIconComponent(org.dom4j.Element iconElement)
    • loaderSupport

      protected LoaderSupport loaderSupport()
    • getLayoutLoader

      protected LayoutLoader getLayoutLoader()
    • getIcons

      protected Icons getIcons()