Module xaos.ui

Class Icons


  • public class Icons
    extends Object
    Provides methods to obtain specific icons.
    Author:
    claudio.rosati@esss.se
    • Field Detail

      • DEFAULT_SIZE

        public static final int DEFAULT_SIZE
        The default icon size to used in menus and toolbars
        See Also:
        Constant Field Values
    • Method Detail

      • iconFor

        public static Node iconFor​(Class<?> clazz,
                                   int size)
        Calls iconForClass(String, int) for the provided Class.
        Parameters:
        clazz - The Class for which a graphical representation is needed.
        size - The size of the square Node to be returned.
        Returns:
        An iconic Node representing the given Class object, or null.
      • iconFor

        public static Node iconFor​(Class<?> clazz,
                                   int size,
                                   Node defaultIcon)
        Calls iconForClass(String, int, Node) for the provided Class and default Node..
        Parameters:
        clazz - The Class for which a graphical representation is needed.
        size - The size of the square Node to be returned.
        defaultIcon - The value to be returned if no provider was able to return a valid alternative.
        Returns:
        An iconic Node representing the given Class object, or null.
      • iconFor

        public static Node iconFor​(File file,
                                   int size)
        Calls iconForFileExtension(String, int) for the provided Path.
        Parameters:
        file - The File for which a graphical representation is needed.
        size - The size of the square Node to be returned.
        Returns:
        An iconic Node representing the given Path object, or null. null is also returned if file is null, or size <= 0.
      • iconFor

        public static Node iconFor​(File file,
                                   int size,
                                   Node defaultIcon)
        Calls iconForFileExtension(String, int, Node) for the provided File and default Node..
        Parameters:
        file - The File for which a graphical representation is needed.
        size - The size of the square Node to be returned.
        defaultIcon - The value to be returned if no provider was able to return a valid alternative.
        Returns:
        An iconic Node representing the given Path object, or null.
      • iconFor

        public static Node iconFor​(Object object,
                                   int size)
        Parameters:
        object - The object for which a graphical representation is needed.
        size - The size of the square Node to be returned.
        Returns:
        An iconic Node representing the given object at the given size, or null. null is also returned if object is null, or size <= 0.
      • iconFor

        public static Node iconFor​(Object object,
                                   int size,
                                   Node defaultIcon)
        Parameters:
        object - The object for which a graphical representation is needed.
        size - The size of the square Node to be returned.
        defaultIcon - The value to be returned if no provider was able to return a valid alternative.
        Returns:
        An iconic Node representing the given object at the given size.
      • iconFor

        public static Node iconFor​(Path path,
                                   int size)
        Calls iconForFileExtension(String, int) for the provided Path.
        Parameters:
        path - The Path for which a graphical representation is needed.
        size - The size of the square Node to be returned.
        Returns:
        An iconic Node representing the given Path object, or null. null is also returned if path is null, or size <= 0.
      • iconFor

        public static Node iconFor​(Path path,
                                   int size,
                                   Node defaultIcon)
        Calls iconForFileExtension(String, int, Node) for the provided Path and default Node..
        Parameters:
        path - The Path for which a graphical representation is needed.
        size - The size of the square Node to be returned.
        defaultIcon - The value to be returned if no provider was able to return a valid alternative.
        Returns:
        An iconic Node representing the given Path object, or null.
      • iconForClass

        public static Node iconForClass​(String clazz,
                                        int size)
        Parameters:
        clazz - The full class name (the one returned by Class.getName()) for which a graphical representation is needed.
        size - The size of the square Node to be returned.
        Returns:
        An iconic Node representing Class with the given name, or null. null is also returned if clazz is null, or size <= 0.
      • iconForClass

        public static Node iconForClass​(String clazz,
                                        int size,
                                        Node defaultIcon)
        Parameters:
        clazz - The full class name (the one returned by Class.getName()) for which a graphical representation is needed.
        size - The size of the square Node to be returned.
        defaultIcon - The value to be returned if no provider was able to return a valid alternative.
        Returns:
        An iconic Node representing Class with the given name, or null.
      • iconForFileExtension

        public static Node iconForFileExtension​(String extension,
                                                int size)
        Parameters:
        extension - The file extension (without the preceding '.').
        size - The size of the square Node to be returned.
        Returns:
        An iconic Node representing a file with the given extension at the given size, or null. null is also returned if extension is null or empty, or size <= 0.
      • iconForFileExtension

        public static Node iconForFileExtension​(String extension,
                                                int size,
                                                Node defaultIcon)
        Parameters:
        extension - The file extension (without the preceding '.').
        size - The size of the square Node to be returned.
        defaultIcon - The value to be returned if no provider was able to return a valid alternative.
        Returns:
        An iconic Node representing a file with the given extension, or null.
      • iconForMIMEType

        public static Node iconForMIMEType​(String mime)
        Parameters:
        mime - The MIME type for which a graphical representation is needed.
        Returns:
        An iconic Node representing the given mime type, or null.
      • iconForMIMEType

        public static Node iconForMIMEType​(String mime,
                                           Node defaultIcon)
        Parameters:
        mime - The MIME type for which a graphical representation is needed.
        defaultIcon - The value to be returned if no provider was able to return a valid alternative.
        Returns:
        An iconic Node representing the given mime type, or null.