Class ResourceFactory


  • @Service
    public class ResourceFactory
    extends AbstractResourceFactory
    A factory class that builds and/or caches resources (mostly icons and backgrounds).
    Author:
    Johny Andres Ortega Ruiz <johny.ortega@kuwaiba.org>, Orlando Paz <Orlando.paz@kuwaiba.org>
    • Field Detail

      • DEFAULT_ICON_WIDTH

        public static final int DEFAULT_ICON_WIDTH
        Default icon width (used in views)
        See Also:
        Constant Field Values
      • DEFAULT_ICON_HEIGHT

        public static final int DEFAULT_ICON_HEIGHT
        Default icon height (used in views)
        See Also:
        Constant Field Values
      • DEFAULT_SMALL_ICON_WIDTH

        public static final int DEFAULT_SMALL_ICON_WIDTH
        Default icon width (used in navigation trees)
        See Also:
        Constant Field Values
      • DEFAULT_SMALL_ICON_HEIGHT

        public static final int DEFAULT_SMALL_ICON_HEIGHT
        Default icon height (used in navigation trees)
        See Also:
        Constant Field Values
      • DEFAULT_SMALL_NO_ICON_WIDTH

        public static final int DEFAULT_SMALL_NO_ICON_WIDTH
        Default no icon width (used in navigation trees)
        See Also:
        Constant Field Values
      • DEFAULT_SMALL_NO_ICON_HEIGHT

        public static final int DEFAULT_SMALL_NO_ICON_HEIGHT
        Default no icon height (used in navigation trees)
        See Also:
        Constant Field Values
    • Constructor Detail

      • ResourceFactory

        public ResourceFactory()
    • Method Detail

      • getClassIcon

        public com.vaadin.flow.server.StreamResource getClassIcon​(String className)
        Description copied from class: AbstractResourceFactory
        Builds and caches an icon of a given class.
        Specified by:
        getClassIcon in class AbstractResourceFactory
        Parameters:
        className - the class name of the icon will be built for
        Returns:
        The cached resource
      • getClassSmallIcon

        public com.vaadin.flow.server.StreamResource getClassSmallIcon​(String className)
        Description copied from class: AbstractResourceFactory
        Gets or builds (but doesn't caches) the small icon of the given class name
        Specified by:
        getClassSmallIcon in class AbstractResourceFactory
        Parameters:
        className - The class name
        Returns:
        The cached resource if it has been previously cached, or a generic black icon otherwise
      • getRelationshipIcon

        public com.vaadin.flow.server.StreamResource getRelationshipIcon​(Color color,
                                                                         int width,
                                                                         int height)
        Builds an icon resource
        Parameters:
        color - The color of the icon
        width - The width of the icon
        height - The height of the icon
        Returns:
        The icon